mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 04:44:05 +02:00
Update automatic_packages.sh
This commit is contained in:
@@ -4,9 +4,15 @@
|
|||||||
# INIT #
|
# INIT #
|
||||||
########
|
########
|
||||||
|
|
||||||
|
#Verbose or not
|
||||||
VERBOSE=false
|
VERBOSE=false
|
||||||
|
#Avoid fails on non declared variables
|
||||||
set +u 2>/dev/null
|
set +u 2>/dev/null
|
||||||
|
#If no packages, empty
|
||||||
PACKAGES="${*:-}"
|
PACKAGES="${*:-}"
|
||||||
|
#Avoids messages if non interactive
|
||||||
|
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections || true
|
||||||
|
|
||||||
[ "$VERBOSE" = true ] && echo "ENV : $PACKAGES"
|
[ "$VERBOSE" = true ] && echo "ENV : $PACKAGES"
|
||||||
|
|
||||||
############################
|
############################
|
||||||
@@ -18,13 +24,10 @@ if command -v $COMMAND &>/dev/null; then
|
|||||||
# If apk based
|
# If apk based
|
||||||
[ "$VERBOSE" = true ] && echo "apk based"
|
[ "$VERBOSE" = true ] && echo "apk based"
|
||||||
PACKMANAGER="apk"
|
PACKMANAGER="apk"
|
||||||
PACKAGES="apk add --no-cache $PACKAGES"
|
|
||||||
else
|
else
|
||||||
# If apt-get based
|
# If apt-get based
|
||||||
[ "$VERBOSE" = true ] && echo "apt based"
|
[ "$VERBOSE" = true ] && echo "apt based"
|
||||||
PACKMANAGER="apt"
|
PACKMANAGER="apt"
|
||||||
PACKAGES="apt-get update \
|
|
||||||
&& apt-get install -yqq --no-install-recommends $PACKAGES"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###################
|
###################
|
||||||
@@ -131,11 +134,22 @@ done
|
|||||||
|
|
||||||
# Install apps
|
# Install apps
|
||||||
[ "$VERBOSE" = true ] && echo "installing packages $PACKAGES"
|
[ "$VERBOSE" = true ] && echo "installing packages $PACKAGES"
|
||||||
eval "$PACKAGES"
|
[ "$PACKMANAGER" = "apt" ] && apt-get update >/dev/null || true
|
||||||
|
|
||||||
|
# Install apps one by one to allow failures
|
||||||
|
for packagestoinstall in $PACKAGES; do
|
||||||
|
[ "$VERBOSE" = true ] && echo "... $packagestoinstall"
|
||||||
|
if [ "$PACKMANAGER" = "apk" ]; then
|
||||||
|
apk add --no-cache $packagestoinstall &>/dev/null || echo "Error : $packagestoinstall not found"
|
||||||
|
elif [ "$PACKMANAGER" = "apt" ]; then
|
||||||
|
apt-get install -yqq --no-install-recommends $packagestoinstall &>/dev/null || echo "Error : $packagestoinstall not found"
|
||||||
|
fi
|
||||||
|
[ "$VERBOSE" = true ] && echo "... $packagestoinstall done"
|
||||||
|
done
|
||||||
|
|
||||||
# Clean after install
|
# Clean after install
|
||||||
[ "$VERBOSE" = true ] && echo "Cleaning apt cache"
|
[ "$VERBOSE" = true ] && echo "Cleaning apt cache"
|
||||||
[ "$PACKMANAGER" = "apt" ] && apt-get clean || true
|
[ "$PACKMANAGER" = "apt" ] && apt-get clean >/dev/null || true
|
||||||
|
|
||||||
# Replace nginx if installed
|
# Replace nginx if installed
|
||||||
if ls /etc/nginx2 1>/dev/null 2>&1; then
|
if ls /etc/nginx2 1>/dev/null 2>&1; then
|
||||||
|
|||||||
Reference in New Issue
Block a user