diff --git a/src/cmake/install.sh b/src/cmake/install.sh index 27f6b2b..287d87a 100644 --- a/src/cmake/install.sh +++ b/src/cmake/install.sh @@ -9,6 +9,12 @@ echo "Activating feature 'CMake'" VERSION="${VERSION:-latest}" +# Install curl if not in system +if ! which curl > /dev/null; then + CURLINSTALLED="true" + apt update && apt -y install --no-install-recommends curl ca-certificates +fi + # Fetch the latest release if [ ${VERSION} = "latest" ]; then VERSION=$(curl --silent -I https://github.com/Kitware/CMake/releases/latest | awk -F '/' '/^location/ {print substr($NF, 1, length($NF)-1)}') @@ -43,9 +49,14 @@ rm man/man1/cmake-gui.1 rm -rf share/applications # Install CMake -sudo mv -v bin/* /usr/local/bin -sudo mkdir /usr/local/share/man/cmake && sudo mv -v man/* /usr/local/share/man/cmake -sudo mv -v share/* /usr/local/share/ +mv -v bin/* /usr/local/bin +mkdir /usr/local/share/man/cmake && sudo mv -v man/* /usr/local/share/man/cmake +mv -v share/* /usr/local/share/ + +# Remove curl and dependencies if installed by script +if [ ! -Z ${CURLINSTALLED+x} ]; then + apt remove -y curl ca-certificates && apt autoremove -y +fi # Remove temporary files cd /tmp && rm -rf ${SOURCEDIR}-${ARCHITECTURE} diff --git a/src/ninja-build/install.sh b/src/ninja-build/install.sh index d5d5008..cb3a244 100644 --- a/src/ninja-build/install.sh +++ b/src/ninja-build/install.sh @@ -9,6 +9,12 @@ echo "Activating feature 'Ninja'" VERSION="${VERSION:-latest}" +# Install curl if not in system +if ! which curl > /dev/null; then + CURLINSTALLED="true" + apt update && apt -y install --no-install-recommends curl ca-certificates +fi + # Fetch the latest release if [ ${VERSION} = "latest" ]; then VERSION=$(curl --silent -I https://github.com/ninja-build/ninja/releases/latest | awk -F '/' '/^location/ {print substr($NF, 1, length($NF)-1)}') @@ -26,8 +32,24 @@ SOURCEDIR=ninja-linux.zip # ninja-linux-aarch64.zip if ARM64 # Fetch binaries curl -JLo ${SOURCE} https://github.com/ninja-build/ninja/releases/download/v${VERSION#v}/ninja-linux.zip +# Install unzip if not in system +if ! which unzip > /dev/null; then + UNZIPINSTALLED="true" + apt update && apt install -y --no-install-recommends unzip +fi + # Unzip binaries unzip ${SOURCE} && rm ${SOURCE} # Install CMake -sudo mv -v ninja /usr/local/bin +mv -v ninja /usr/local/bin + +# Remove curl and dependencies if installed by script +if [ ! -Z ${CURLINSTALLED+x} ]; then + apt remove -y curl ca-certificates && apt autoremove -y +fi + +# Remove unzip and dependencies if installed by script +if [ ! -Z ${UNZIPINSTALLED+x} ]; then + apt remove -y unzip && apt autoremove -y +fi \ No newline at end of file