Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# bash based sh version
# partition for swap
if [[ "${MACHTYPE%%-*}" == 'x86_64' ]] # where was '$(arch)' comming from?
then
SWAPSIZE=$[$(free -m | awk '/^Mem:/{print $2}')*2]
if (( SWAPSIZE > 4096 ))
then
SWAPSIZE=4096
fi
sfdisk -uM /dev/sdb << EOF
,$SWAPSIZE,S
,,L
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment