X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fsystem%2Fadd_swap_mount.sh;h=593115fe2f58784938efbdde9c730f8c1024b4f2;hb=9600af2adfa343924d7d600022f40d8b9eb1cff6;hp=200cb365095decb42ec8f4b4ed4ff1b4e3966954;hpb=c8527998bb0cfdbb0244bd919b017fd8772155b2;p=feisty_meow.git diff --git a/scripts/system/add_swap_mount.sh b/scripts/system/add_swap_mount.sh index 200cb365..593115fe 100644 --- a/scripts/system/add_swap_mount.sh +++ b/scripts/system/add_swap_mount.sh @@ -1,22 +1,24 @@ #!/bin/bash -source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" +# auto-find the scripts, since we might want to run this as sudo. +export WORKDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory. +source "$WORKDIR/../core/launch_feisty_meow.sh" #hmmm: should be able to add a new swap drive if desired. #hmmm: why all the hard-coded paths below? /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 -check_result "creating swap file" +test_or_die "creating swap file" /bin/chmod 600 /var/swap.1 -check_result "setting swap file permissions" +test_or_die "setting swap file permissions" /sbin/mkswap /var/swap.1 -check_result "formatting swap file as swap partition" +test_or_die "formatting swap file as swap partition" /sbin/swapon /var/swap.1 -check_result "enabling new swap partition" +test_or_die "enabling new swap partition" free