diff --git a/checks/backups.sh b/checks/backups.sh index e245252ea5656b6829db0c12b46044c31061e5d0..f0d1902a55177a238341c65caaedb832daf229b4 100644 --- a/checks/backups.sh +++ b/checks/backups.sh @@ -2,6 +2,16 @@ echo "RUN $(basename "$0") ===" +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] +then + echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" + exit 1 +else + echo "Environment file loaded" +fi +. $DIR/../main.env + backup_system="" duplicity_dir="/opt/duplicity-ftp-backup/" duplicity_alt_dir="/root/duplicity-ftp-backup/" diff --git a/install/AptCacher.sh b/install/AptCacher.sh index 162fad5ce37a0f750540364f6cc6eaf3fa249c64..f445048130c54e4c4d5f4fb2cb57a04c3a280663 100755 --- a/install/AptCacher.sh +++ b/install/AptCacher.sh @@ -2,15 +2,15 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env - +. $DIR/../main.env apt-get update apt-get -y install apt-cacher-ng diff --git a/install/Base.sh b/install/Base.sh index f4d5c104bf6ef4c913c7ba1f8d44d3dc8d0cc62f..21449624edba8dc01296a826cd7d2a6bb299a484 100644 --- a/install/Base.sh +++ b/install/Base.sh @@ -20,15 +20,15 @@ set -o nounset # Treat unset variables as an error echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env - +. $DIR/../main.env apt-get clean diff --git a/install/Certbot.sh b/install/Certbot.sh index 164bdd629a2da6321acc66b50838a195e297dd4f..91dbb5c5de85c8af11be3dd1d7721db54bf031d8 100755 --- a/install/Certbot.sh +++ b/install/Certbot.sh @@ -18,14 +18,15 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env apt-get update && apt-get install certbot python-certbot-apache diff --git a/install/Collabora.sh b/install/Collabora.sh index 128e02583a90adb80e5853187edaf52039f061f0..414a5be34af5cc78a7e1a2c5fc262e97944632c4 100644 --- a/install/Collabora.sh +++ b/install/Collabora.sh @@ -20,14 +20,15 @@ set -o nounset # Treat unset variables as an error echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env ########################################################################### diff --git a/install/Dolibarr.sh b/install/Dolibarr.sh index 99524c6275d66a8d847393abc52e0a455f470249..3ccde650e1f286a47daee057810946d960341e65 100644 --- a/install/Dolibarr.sh +++ b/install/Dolibarr.sh @@ -20,14 +20,15 @@ set -o nounset # Treat unset variables as an error echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env diff --git a/install/Monit.sh b/install/Monit.sh index ffa51e7ef08d7a128868125914707a5f0bf3cb30..ffa5253c9d4dc645400b529d62fe65a31b427669 100644 --- a/install/Monit.sh +++ b/install/Monit.sh @@ -2,14 +2,15 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env # Install monit if not installed diff --git a/install/MySQL.sh b/install/MySQL.sh index b59fd778434cdcc7bdcc2db50896ecea3926849d..79567efe78c437c4fcb7a3649150c9048e88f08a 100644 --- a/install/MySQL.sh +++ b/install/MySQL.sh @@ -20,14 +20,15 @@ set -o nounset # Treat unset variables as an error echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env if [ -f installMySQL.env ] diff --git a/install/OnlyOffice.sh b/install/OnlyOffice.sh index c2d8f6253f5745ed227e10642206e8a929c704dd..5cb54f61008239cc5825e5aa52ad38f95054a684 100644 --- a/install/OnlyOffice.sh +++ b/install/OnlyOffice.sh @@ -2,14 +2,15 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env . $DIR/install/main.env diff --git a/install/Traefik.sh b/install/Traefik.sh index 0b928be3713238f5926e7e73dbdfe86d91a7bd26..d321f96a89e9fadc185d40fd5d7e203c9890e70f 100644 --- a/install/Traefik.sh +++ b/install/Traefik.sh @@ -2,14 +2,15 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main. +. $DIR/../main.env apt-get update diff --git a/install/WebServer.sh b/install/WebServer.sh index 715d0e484c1a2503c12b54b0e3f1133bb4b94cb4..2ba01ad5dc10d8d0ec3152ec07d99e36e62cc67c 100644 --- a/install/WebServer.sh +++ b/install/WebServer.sh @@ -20,14 +20,15 @@ set -o nounset # Treat unset variables as an error echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env apt-get update diff --git a/main.env.sample b/main.env.sample index 5abc8858cb107ce45d816b009ac836ada91c13f5..30a746dbe7e66c7e9a9178ff7a9db7f7b0a13456 100644 --- a/main.env.sample +++ b/main.env.sample @@ -5,9 +5,6 @@ export MODS="Base GlpiAgent Traefik" -# TODO Racine of NoCloud Auto Instaler -export DIR=/opt/NoCloud-Auto-Installer - # Valid levels are security and upgrade export MAINTENANCE_LEVEL="security" diff --git a/upgrade/All.sh b/upgrade/All.sh index 01761f63a9e308d760ab4d7b04560956cafed8a5..fc45e369b6ffae62fdb8b7906c102e4c22d4d2e6 100644 --- a/upgrade/All.sh +++ b/upgrade/All.sh @@ -18,15 +18,16 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] + +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env - +. $DIR/../main.env $DIR/utils/configure_base_tools.sh . $DIR/install/Nextcloud.env diff --git a/upgrade/Backups.sh b/upgrade/Backups.sh index 04780e8b59e6350c6dc6e1faed2bc335033ca9a5..541be2f7618c7ad1d01ebd3d8e52768f7bcc2e72 100644 --- a/upgrade/Backups.sh +++ b/upgrade/Backups.sh @@ -1,15 +1,16 @@ #!/bin/bash echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] + +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env - +. $DIR/../main.env duplicity_dir="/opt/duplicity-ftp-backup/" duplicity_alt_dir="/root/duplicity-ftp-backup/" diff --git a/upgrade/Collabora.sh b/upgrade/Collabora.sh index 30bbe0d24b767f84dac8b85c41e8847c6ef8a6cc..3762ee4b88b7f431d505420adccfaa17a37854e9 100644 --- a/upgrade/Collabora.sh +++ b/upgrade/Collabora.sh @@ -2,14 +2,15 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env SCRIPT_DIRECTORY=$(dirname $0) if [ -z "$(grep 'capabilities' /etc/apache2/sites-available/collabora.conf)" ]; then diff --git a/upgrade/Dolibarr.sh b/upgrade/Dolibarr.sh index d38b951ae063c09482465d19b8ea43a3717c9304..65e8383b6a5c06aa37406ebc6ec6f961c6ce6057 100644 --- a/upgrade/Dolibarr.sh +++ b/upgrade/Dolibarr.sh @@ -18,14 +18,15 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env DOLIBARR_DB=${DOLIBARR_DB:-"dolibarr"} if [ -z "`dpkg -l | grep dolibarr`" ] diff --git a/upgrade/Monit.sh b/upgrade/Monit.sh index b0ec7993fcf8f6f708a87444499058f2cb21314f..6d3d091c3e3c088f81b4325cb3895f09fb5fed36 100644 --- a/upgrade/Monit.sh +++ b/upgrade/Monit.sh @@ -2,14 +2,15 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env # Install monit if not installed and general config if [ -z "$(dpkg -l | grep ' monit ')" ]; then diff --git a/upgrade/Traefik.sh b/upgrade/Traefik.sh index 4e71b24ebaa816fd0391c2c10be7989394aa0ad8..380471fdba3d94113f7e7d77adb2bed70634966f 100644 --- a/upgrade/Traefik.sh +++ b/upgrade/Traefik.sh @@ -1,7 +1,16 @@ #!/bin/bash echo "RUN $(basename "$0") ===" -. $(dirname "$0")/../main.env + +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] +then + echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" + exit 1 +else + echo "Environment file loaded" +fi +. $DIR/../main.env # Add systemd script to control container boot order order_systemd_file="/etc/systemd/system/docker-order.service" diff --git a/upgrade/WebServer.sh b/upgrade/WebServer.sh index 3a01476880cd10167a9a153931c5e11d96a259ed..d38642e39e0fde719d3420ff8487773ab2e9e99e 100644 --- a/upgrade/WebServer.sh +++ b/upgrade/WebServer.sh @@ -2,14 +2,15 @@ echo "RUN $(basename "$0") ===" -if [ ! -e $(dirname "$0")/../main.env ] +DIR=$(realpath $(dirname $0/..)) +if [ ! -e $DIR/main.env ] then echo "Please copy in racine of NoCloud Auto Installer main.env.sample to main.env and edit it" exit 1 else echo "Environment file loaded" fi -. $(dirname "$0")/../main.env +. $DIR/../main.env # Switch to php-fpm ver=$(php --version | awk '{print $2}' | head -n 1 | cut -d . -f 1,2)