Allow exit 1

This commit is contained in:
Alexandre
2022-01-20 20:55:20 +01:00
committed by GitHub
parent e46dd72f86
commit 94cd7576ce

View File

@@ -11,7 +11,7 @@ set +u 2>/dev/null || true
#If no packages, empty #If no packages, empty
PACKAGES="${*:-}" PACKAGES="${*:-}"
#Avoids messages if non interactive #Avoids messages if non interactive
(echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections) || true (echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections) >/dev/null || true
[ "$VERBOSE" = true ] && echo "ENV : $PACKAGES" [ "$VERBOSE" = true ] && echo "ENV : $PACKAGES"
@@ -137,12 +137,13 @@ done
[ "$PACKMANAGER" = "apt" ] && apt-get update >/dev/null || true [ "$PACKMANAGER" = "apt" ] && apt-get update >/dev/null || true
# Install apps one by one to allow failures # Install apps one by one to allow failures
ERROR=0
for packagestoinstall in $PACKAGES; do for packagestoinstall in $PACKAGES; do
[ "$VERBOSE" = true ] && echo "... $packagestoinstall" [ "$VERBOSE" = true ] && echo "... $packagestoinstall"
if [ "$PACKMANAGER" = "apk" ]; then if [ "$PACKMANAGER" = "apk" ]; then
apk add --no-cache $packagestoinstall &>/dev/null || echo "Error : $packagestoinstall not found" apk add --no-cache $packagestoinstall &>/dev/null || (echo "Error : $packagestoinstall not found" && ERROR = 1)
elif [ "$PACKMANAGER" = "apt" ]; then elif [ "$PACKMANAGER" = "apt" ]; then
apt-get install -yqq --no-install-recommends $packagestoinstall &>/dev/null || echo "Error : $packagestoinstall not found" apt-get install -yqq --no-install-recommends $packagestoinstall &>/dev/null || (echo "Error : $packagestoinstall not found" && ERROR = 1)
fi fi
[ "$VERBOSE" = true ] && echo "... $packagestoinstall done" [ "$VERBOSE" = true ] && echo "... $packagestoinstall done"
done done
@@ -211,3 +212,7 @@ for files in "/scripts" "/etc/services.d" "/etc/cont-init.d"; do
fi fi
done done
if [ $ERROR = 1 ]; then
exit 1
fi