diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-07-31 15:36:32 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-08-11 00:17:56 +0300 |
commit | c4210c5a69b611b5cc2f779b381699eecb9d0e71 (patch) | |
tree | b84a88493b45174b3ab1a0d42d8608d0944d43b9 | |
parent | 6f8d55351085257457ffd8ecd7a31b045a577689 (diff) |
fix swapfile with automountv0.18.4
-rw-r--r-- | etc/nextcloudpi-config.d/nc-swapfile.sh | 5 |
1 files changed, 5 insertions, 0 deletions
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 "/\<start)/asleep 15" /etc/init.d/dphys-swapfile + service dphys-swapfile restart && swapoff "$ORIG" && rm -f "$ORIG" } |