From c4210c5a69b611b5cc2f779b381699eecb9d0e71 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Mon, 31 Jul 2017 14:36:32 +0200 Subject: fix swapfile with automount --- etc/nextcloudpi-config.d/nc-swapfile.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/nextcloudpi-config.d/nc-swapfile.sh b/etc/nextcloudpi-config.d/nc-swapfile.sh index 8ff79540..82e781df 100644 --- a/etc/nextcloudpi-config.d/nc-swapfile.sh +++ b/etc/nextcloudpi-config.d/nc-swapfile.sh @@ -23,6 +23,7 @@ configure() { local ORIG=$( grep -oP "CONF_SWAPFILE=.*" /etc/dphys-swapfile | cut -f2 -d= ) [[ "$ORIG" == "$SWAPFILE_" ]] && return + test -d "$SWAPFILE_" && { echo "$SWAPFILE_ is a directory. Abort"; return 1; } [[ $( 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" @@ -30,6 +31,10 @@ configure() 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 + + # workaround for automount, systemd doesn't get the order right + grep -q sleep /etc/init.d/dphys-swapfile || sed -i "/\