Skip to content

Commit

Permalink
Making swap function self contained.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-baumann committed Jul 25, 2012
1 parent ee04164 commit d0fe631
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
9 changes: 0 additions & 9 deletions scripts/boot/0110-cmdline
Expand Up @@ -11,15 +11,6 @@ Cmdline ()
LIVE_READ_ONLY="true"
;;

live-boot.swapon=*|swapon=*)
LIVE_SWAPON="true"
LIVE_SWAPON_DEVICES="${_PARAMETER#*swapon=}"
;;

live-boot.swapon|swapon)
LIVE_SWAPON="true"
;;

live-boot.verify-checksums|verify-checksums)
LIVE_VERIFY_CHECKSUMS="true"
;;
Expand Down
22 changes: 18 additions & 4 deletions scripts/boot/3020-swapon
Expand Up @@ -2,14 +2,28 @@

#set -e

Swapon ()
Swap ()
{
if [ "${LIVE_SWAPON}" != "true" ]
for _PARAMETER in ${_CMDLINE}
do
case "${_PARAMETER}" in
live-boot.swap=*|swap=*)
LIVE_SWAP="true"
LIVE_SWAP_DEVICES="${_PARAMETER#*swap=}"
;;

live-boot.swap|swap)
LIVE_SWAP="true"
;;
esac
done

if [ "${LIVE_SWAP}" != "true" ]
then
return 0
fi

LIVE_SWAPON_DEVICES="${LIVE_SWAPON_DEVICES:-/dev/sd* /dev/vd*}"
LIVE_SWAP_DEVICES="${LIVE_SWAP_DEVICES:-/dev/sd* /dev/vd*}"

if [ -e /run ]
then
Expand All @@ -20,7 +34,7 @@ Swapon ()
_FSTAB="/root/etc/fstab"
fi

for _DEVICE in $(echo ${LIVE_SWAPON_DEVICES} | sed -e 's|,| |g')
for _DEVICE in $(echo ${LIVE_SWAP_DEVICES} | sed -e 's|,| |g')
do
if [ ! -b "${_DEVICE}" ]
then
Expand Down
6 changes: 1 addition & 5 deletions scripts/boot/9990-main.sh
Expand Up @@ -203,11 +203,7 @@ Main ()
Fstab
Netbase

case "${LIVE_SWAPON}" in
true)
Swapon
;;
esac
Swap

case "${UNIONFS}" in
unionfs-fuse)
Expand Down

0 comments on commit d0fe631

Please sign in to comment.