diff options
-rwxr-xr-x | etc/nextcloudpi-config.d/modsecurity.sh | 1 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-database.sh | 2 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-ramlogs.sh | 4 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-swapfile.sh | 7 |
4 files changed, 9 insertions, 5 deletions
diff --git a/etc/nextcloudpi-config.d/modsecurity.sh b/etc/nextcloudpi-config.d/modsecurity.sh index 43639815..37a1b8ea 100755 --- a/etc/nextcloudpi-config.d/modsecurity.sh +++ b/etc/nextcloudpi-config.d/modsecurity.sh @@ -33,6 +33,7 @@ install() # CONFIGURE cp /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf + sed -i "s|SecRuleEngine .*|SecRuleEngine Off|" /etc/modsecurity/modsecurity.conf sed -i 's|SecTmpDir .*|SecTmpDir /var/cache/modsecurity/|' /etc/modsecurity/modsecurity.conf sed -i 's|SecDataDir .*|SecDataDir /var/cache/modsecurity/|' /etc/modsecurity/modsecurity.conf diff --git a/etc/nextcloudpi-config.d/nc-database.sh b/etc/nextcloudpi-config.d/nc-database.sh index b00098af..ce6c0917 100755 --- a/etc/nextcloudpi-config.d/nc-database.sh +++ b/etc/nextcloudpi-config.d/nc-database.sh @@ -32,7 +32,7 @@ configure() rmdir "$DBDIR_" } - local BASEDIR=$( dirname "$DATADIR_" ) + local BASEDIR=$( dirname "$DBDIR_" ) mkdir -p "$BASEDIR" [[ $( stat -fc%d / ) == $( stat -fc%d $BASEDIR ) ]] && \ diff --git a/etc/nextcloudpi-config.d/nc-ramlogs.sh b/etc/nextcloudpi-config.d/nc-ramlogs.sh index e90531d6..3e75286f 100755 --- a/etc/nextcloudpi-config.d/nc-ramlogs.sh +++ b/etc/nextcloudpi-config.d/nc-ramlogs.sh @@ -32,10 +32,10 @@ tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0 # Logs in RAM tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0 # /tmp in RAM EOF - local HTTPUNIT=/etc/systemd/system/multi-user.target.wants/apache2.service + local HTTPUNIT=/lib/systemd/system/apache2.service grep -q mkdir /etc/init.d/mysql || sed -i "/\<start)/amkdir -p /var/log/mysql" /etc/init.d/mysql grep -q mkdir /etc/init.d/apache2 || sed -i "/\<start)/amkdir -p /var/log/apache2" /etc/init.d/apache2 - grep -q mkdir $HTTPUNIT || sed -i "ExecStartPre=/bin/mkdir -p /var/log/apache2" $HTTPUNIT + grep -q mkdir $HTTPUNIT || sed -i "/ExecStart/iExecStartPre=/bin/mkdir -p /var/log/apache2" $HTTPUNIT grep -q vm.swappiness /etc/sysctl.conf || echo "vm.swappiness = 10" >> /etc/sysctl.conf && sysctl --load echo "Logs in RAM. Reboot for changes to take effect" diff --git a/etc/nextcloudpi-config.d/nc-swapfile.sh b/etc/nextcloudpi-config.d/nc-swapfile.sh index a5ad26a7..8ff79540 100755 --- a/etc/nextcloudpi-config.d/nc-swapfile.sh +++ b/etc/nextcloudpi-config.d/nc-swapfile.sh @@ -21,13 +21,16 @@ DESCRIPTION="Move and resize your swapfile. Recommended to move to a permanent U configure() { - [[ $( stat -fc%d / ) == $( stat -fc%d $SWAPFILE_ ) ]] && \ + local ORIG=$( grep -oP "CONF_SWAPFILE=.*" /etc/dphys-swapfile | cut -f2 -d= ) + [[ "$ORIG" == "$SWAPFILE_" ]] && return + + [[ $( stat -fc%d / ) == $( stat -fc%d $( dirname $SWAPFILE_ ) ) ]] && \ echo -e "INFO: moving swapfile to another place in the same SD card\nIf you want to use an external mount, make sure it is properly set up" sed -i "s|#\?CONF_SWAPFILE=.*|CONF_SWAPFILE=$SWAPFILE_|" /etc/dphys-swapfile sed -i "s|#\?CONF_SWAPSIZE=.*|CONF_SWAPSIZE=$SWAPSIZE_|" /etc/dphys-swapfile grep -q vm.swappiness /etc/sysctl.conf || echo "vm.swappiness = 10" >> /etc/sysctl.conf && sysctl --load - service dphys-swapfile restart + service dphys-swapfile restart && swapoff "$ORIG" && rm -f "$ORIG" } install() { :; } |