projects
/
feisty_meow.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of feistymeow.org:feisty_meow
[feisty_meow.git]
/
scripts
/
system
/
add_swap_mount.sh
diff --git
a/scripts/system/add_swap_mount.sh
b/scripts/system/add_swap_mount.sh
index 64547bd5248db246b4d6d46b6627fae46c3edb01..593115fe2f58784938efbdde9c730f8c1024b4f2 100644
(file)
--- a/
scripts/system/add_swap_mount.sh
+++ b/
scripts/system/add_swap_mount.sh
@@
-1,14
+1,24
@@
#!/bin/bash
#!/bin/bash
-#hmmm: should check at each step if it worked.
+# 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: 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
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
+test_or_die "creating swap file"
+
+/bin/chmod 600 /var/swap.1
+test_or_die "setting swap file permissions"
/sbin/mkswap /var/swap.1
/sbin/mkswap /var/swap.1
+test_or_die "formatting swap file as swap partition"
/sbin/swapon /var/swap.1
/sbin/swapon /var/swap.1
+test_or_die "enabling new swap partition"
free
free