diff --git a/README.md b/README.md index c3f5f21a..c5d030ce 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ E.g., to install `rsync`, `git` and `nginx` OS packages and `apprise` python pac ## Notes: - Package names entered should match the names in the relevant distro repo: https://pkgs.alpinelinux.org/packages or https://packages.ubuntu.com/ +- To install a specific version of a package include it in the name e.g. `apprise==1.10.0`. Note that `apt` requires a single `=`, while `apk` and `pip` use double `==`. - Setting the env var `INSTALL_PIP_PACKAGES` will result in automatic install of the `python3-dev` and `python3-pip` OS packages, updating of `pip` to the latest version and installation of the latest `setuptools` and `wheel` packages to set up the necessary environment. - Any other OS dependency such as `make` or `git`, which may be needed by the pip install process, should be manually added to `INSTALL_PACKAGES`. - The OS packages defined will be installed first, followed by the pip packages. diff --git a/root/etc/s6-overlay/s6-rc.d/init-mod-universal-package-install-add-package/run b/root/etc/s6-overlay/s6-rc.d/init-mod-universal-package-install-add-package/run index 0df05cf7..052edf51 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-mod-universal-package-install-add-package/run +++ b/root/etc/s6-overlay/s6-rc.d/init-mod-universal-package-install-add-package/run @@ -1,32 +1,31 @@ #!/usr/bin/with-contenv bash +# shellcheck shell=bash # Exit if no installable packages are provided -if [ -z "${INSTALL_PACKAGES+x}" ] && [ -z "${INSTALL_PIP_PACKAGES+x}" ]; then - echo "**** No packages to install ****" +if [[ -z "${INSTALL_PACKAGES+x}" ]] && [[ -z "${INSTALL_PIP_PACKAGES+x}" ]]; then + echo "[pkg-install-init] **** No packages to install ****" exit 0 fi -if [ -n "${INSTALL_PIP_PACKAGES}" ] && [ -f /usr/bin/apt ]; then +if [[ -n "${INSTALL_PIP_PACKAGES}" ]] && [[ -f /usr/bin/apt ]]; then echo "\ python3-dev \ python3-pip" >> /mod-repo-packages-to-install.list -elif [ -n "${INSTALL_PIP_PACKAGES}" ] && [ -f /sbin/apk ]; then +elif [[ -n "${INSTALL_PIP_PACKAGES}" ]] && [[ -f /sbin/apk ]]; then echo "\ python3-dev \ py3-pip" >> /mod-repo-packages-to-install.list fi - -#Split list of packages on delimiter '|' -IFS='|' -INSTALL_PACKAGES=(${INSTALL_PACKAGES}) -for PKG in "${INSTALL_PACKAGES[@]}"; do - echo "**** Adding ${PKG} to OS package install list ****" +# Split list of packages on delimiter '|' +IFS="|" read -r -a SPLIT_INSTALL_PACKAGES <<< "${INSTALL_PACKAGES}" +for PKG in "${SPLIT_INSTALL_PACKAGES[@]}"; do + echo "[pkg-install-init] **** Adding ${PKG} to OS package install list ****" echo "${PKG}" >> /mod-repo-packages-to-install.list done -INSTALL_PIP_PACKAGES=(${INSTALL_PIP_PACKAGES}) -for PKG in "${INSTALL_PIP_PACKAGES[@]}"; do - echo "**** Adding ${PKG} to pip install list ****" +IFS="|" read -r -a SPLIT_INSTALL_PIP_PACKAGES <<< "${INSTALL_PIP_PACKAGES}" +for PKG in "${SPLIT_INSTALL_PIP_PACKAGES[@]}"; do + echo "[pkg-install-init] **** Adding ${PKG} to pip install list ****" echo "${PKG}" >> /mod-pip-packages-to-install.list done