|
1 | 1 | #!/usr/bin/with-contenv bash |
| 2 | +# shellcheck shell=bash |
2 | 3 |
|
3 | 4 | # Exit if no installable packages are provided |
4 | | -if [ -z "${INSTALL_PACKAGES+x}" ] && [ -z "${INSTALL_PIP_PACKAGES+x}" ]; then |
5 | | - echo "**** No packages to install ****" |
| 5 | +if [[ -z "${INSTALL_PACKAGES+x}" ]] && [[ -z "${INSTALL_PIP_PACKAGES+x}" ]]; then |
| 6 | + echo "[pkg-install-init] **** No packages to install ****" |
6 | 7 | exit 0 |
7 | 8 | fi |
8 | 9 |
|
9 | | -if [ -n "${INSTALL_PIP_PACKAGES}" ] && [ -f /usr/bin/apt ]; then |
| 10 | +if [[ -n "${INSTALL_PIP_PACKAGES}" ]] && [[ -f /usr/bin/apt ]]; then |
10 | 11 | echo "\ |
11 | 12 | python3-dev \ |
12 | 13 | python3-pip" >> /mod-repo-packages-to-install.list |
13 | | -elif [ -n "${INSTALL_PIP_PACKAGES}" ] && [ -f /sbin/apk ]; then |
| 14 | +elif [[ -n "${INSTALL_PIP_PACKAGES}" ]] && [[ -f /sbin/apk ]]; then |
14 | 15 | echo "\ |
15 | 16 | python3-dev \ |
16 | 17 | py3-pip" >> /mod-repo-packages-to-install.list |
17 | 18 | fi |
18 | 19 |
|
19 | | - |
20 | | -#Split list of packages on delimiter '|' |
21 | | -IFS='|' |
22 | | -INSTALL_PACKAGES=(${INSTALL_PACKAGES}) |
23 | | -for PKG in "${INSTALL_PACKAGES[@]}"; do |
24 | | - echo "**** Adding ${PKG} to OS package install list ****" |
| 20 | +# Split list of packages on delimiter '|' |
| 21 | +IFS="|" read -r -a SPLIT_INSTALL_PACKAGES <<< "${INSTALL_PACKAGES}" |
| 22 | +for PKG in "${SPLIT_INSTALL_PACKAGES[@]}"; do |
| 23 | + echo "[pkg-install-init] **** Adding ${PKG} to OS package install list ****" |
25 | 24 | echo "${PKG}" >> /mod-repo-packages-to-install.list |
26 | 25 | done |
27 | 26 |
|
28 | | -INSTALL_PIP_PACKAGES=(${INSTALL_PIP_PACKAGES}) |
29 | | -for PKG in "${INSTALL_PIP_PACKAGES[@]}"; do |
30 | | - echo "**** Adding ${PKG} to pip install list ****" |
| 27 | +IFS="|" read -r -a SPLIT_INSTALL_PIP_PACKAGES <<< "${INSTALL_PIP_PACKAGES}" |
| 28 | +for PKG in "${SPLIT_INSTALL_PIP_PACKAGES[@]}"; do |
| 29 | + echo "[pkg-install-init] **** Adding ${PKG} to pip install list ****" |
31 | 30 | echo "${PKG}" >> /mod-pip-packages-to-install.list |
32 | 31 | done |
0 commit comments