diff --git a/installBase.sh b/installBase.sh index 60556773e4165c97e7ea6dd80e4fa7f376a162a0..977dc0525fa203586adea102b79381c0399a967b 100644 --- a/installBase.sh +++ b/installBase.sh @@ -38,6 +38,12 @@ then ) > /etc/apt/preferences.d/backports fi +if [ "${WEB_SERVER}" == "apache2" ] +then + export WEB_SERVER_PACKAGES="apache2 libapache2-mod-php" +else + export WEB_SERVER_PACKAGES="nginx-extras php-fpm" +fi apt-get update diff --git a/main.env.sample b/main.env.sample index 6cac0bfb0164eee9a6a0159729a854f0aaebb19e..184cb6adaec0d2ab9bdefee23d49c851f01f6d40 100644 --- a/main.env.sample +++ b/main.env.sample @@ -1,8 +1,7 @@ export MODS="Base MySQL Nextcloud Dolibarr TetrasBack" +# Valid levels are security and upgrade +export MAINTENANCE_LEVEL="security" export DOMAIN="dev.tetras-libre.fr" export SERVER_ADMIN="admin@dev.tetras-libre.fr" +# can be set to nginx export WEB_SERVER=apache2 -export WEB_SERVER_PACKAGES="apache2 libapache2-mod-php" -# If you'd rather use nginx, uncomment the following lines -# export WEB_SERVER=nginx -# export WEB_SERVER_PACKAGES="nginx-extras php-fpm" diff --git a/upgradeAll.sh b/upgradeAll.sh index 9ce073afa6970a7b5b85c7555ae6e2f2a1caa41d..2b07a9279f36aff293296dcf5c619e44e1177259 100644 --- a/upgradeAll.sh +++ b/upgradeAll.sh @@ -16,15 +16,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -aptitude update && aptitude upgrade DIR=`dirname $0` . $DIR/main.env . $DIR/installNextcloud.env -if [ -z "$MODS" ] +if [ -z "$MODS" ] || [ -z "$MAINTENANCE_LEVEL" ] then - echo "Please update your main.env to list the installed modules" + echo "Please update your main.env" exit 1 fi +aptitude update +if [ "$MAINTENANCE_LEVEL" == "upgrade" ] +then + aptitude upgrade +else + unattended-upgrade +fi for mod in $MODS do script="$DIR/upgrade$mod.sh" @@ -34,4 +40,5 @@ do fi done systemctl restart systemd-logind +systemctl restart `checkrestart | awk '/^service/{print $2} /^systemctl/{print $3}'` checkrestart diff --git a/upgradeDolibarr.sh b/upgradeDolibarr.sh index 235cdcf135b46bbabc9c6b9ff53f202fa58c572d..3e413e6a886bfe79abd0dcf188e0e94ca3dc4459 100644 --- a/upgradeDolibarr.sh +++ b/upgradeDolibarr.sh @@ -22,6 +22,12 @@ then echo "Dolibarr not installed, aborting" exit 1 fi +if [ "$MAINTENANCE_LEVEL" == "security" ] && [ "$1" != "force" ] +then + echo "Dolibar upgrade is disabled for security mode, to for upgrade, run:" + echo -e "\t$0 force" + exit 1 +fi git pull current_version=`apt-cache policy dolibarr | grep Installed | awk '{print $2}'` echo "Current version of Dolibarr: $current_version"