This commit is contained in:
Alexandre
2022-01-20 21:19:51 +01:00
parent 3072b45533
commit 73a4d2b5ff

View File

@@ -134,23 +134,23 @@ done
# Install apps # Install apps
[ "$VERBOSE" = true ] && echo "installing packages $PACKAGES" [ "$VERBOSE" = true ] && echo "installing packages $PACKAGES"
[ "$PACKMANAGER" = "apt" ] && apt-get update >/dev/null || true if [ "$PACKMANAGER" = "apt" ]; then apt-get update >/dev/null; fi
# Install apps one by one to allow failures # Install apps one by one to allow failures
ERROR=0 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" && ERROR=1) apk add --no-cache "$packagestoinstall" &>/dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR)
elif [ "$PACKMANAGER" = "apt" ]; then elif [ "$PACKMANAGER" = "apt" ]; then
apt-get install -yqq --no-install-recommends $packagestoinstall &>/dev/null || (echo "Error : $packagestoinstall not found" && ERROR=1) apt-get install -yqq --no-install-recommends "$packagestoinstall" &>/dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR)
fi fi
[ "$VERBOSE" = true ] && echo "... $packagestoinstall done" [ "$VERBOSE" = true ] && echo "... $packagestoinstall done"
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 >/dev/null || true if [ "$PACKMANAGER" = "apt" ]; then apt-get clean >/dev/null; fi
# 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
@@ -201,18 +201,18 @@ for files in "/scripts" "/etc/services.d" "/etc/cont-init.d"; do
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required" [ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && apk add --no-cache go npm && [ "$PACKMANAGER" = "apk" ] && apk add --no-cache go npm &&
apk upgrade --no-cache && apk upgrade --no-cache &&
apk add --no-cache --virtual .build-deps build-base git go && apk add --no-cache --virtual .build-deps build-base git go &&
go get -u github.com/quantumew/mustache-cli && go get -u github.com/quantumew/mustache-cli &&
cp "$GOPATH"/bin/* /usr/bin/ && cp "$GOPATH"/bin/* /usr/bin/ &&
rm -rf "$GOPATH" /var/cache/apk/* /tmp/src && rm -rf "$GOPATH" /var/cache/apk/* /tmp/src &&
apk del .build-deps xz build-base apk del .build-deps xz build-base
[ "$PACKMANAGER" = "apt" ] && apt-get update && [ "$PACKMANAGER" = "apt" ] && apt-get update &&
apt-get install -yqq go npm node-mustache apt-get install -yqq go npm node-mustache
fi fi
done done
if [ $ERROR = 1 ]; then if [ -f /ERROR ]; then
exit 1 exit 1
fi fi