filesystem: enable swap after adding to fstab

This commit is contained in:
Silvan Calarco 2013-09-29 18:35:08 +02:00
parent d18482236a
commit f7e9e7befb
2 changed files with 6 additions and 5 deletions

View File

@ -234,7 +234,7 @@ blkid | grep /dev/sd | while read line; do
case $devfstype in case $devfstype in
linux-swap|swap) # Linux swap linux-swap|swap) # Linux swap
[ "$FS_SWAP_UPDATE" = "yes" ] || continue [ "$FS_SWAP_UPDATE" = "yes" ] || continue
mount_point="swap" mount_point="swap "
fstype="swap" fstype="swap"
options="pri=1" options="pri=1"
let "swapon = 1" ;; let "swapon = 1" ;;
@ -288,9 +288,6 @@ blkid | grep /dev/sd | while read line; do
;; ;;
esac esac
logmsg "$me" $"\
added device \`$dev' (${uuid}) mount point:\`$mount_point'"
# note: if 'mount_point' is yet undefined there is a bug # note: if 'mount_point' is yet undefined there is a bug
if [[ "$mount_point" ]]; then if [[ "$mount_point" ]]; then
# default values: fstype="auto", options="noauto,user" # default values: fstype="auto", options="noauto,user"
@ -299,16 +296,20 @@ added device \`$dev' (${uuid}) mount point:\`$mount_point'"
echo "\ echo "\
UUID=${uuid} $mount_point \ UUID=${uuid} $mount_point \
${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab ${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab
[ "$fstype" = "swap" ] && /sbin/swapon -p 1 ${uuid}
else else
echo "\ echo "\
$dev $mount_point \ $dev $mount_point \
${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab ${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab
[ "$fstype" = "swap" ] && /sbin/swapon -p 1 ${dev}
fi fi
# create the mount point and mount the new device # create the mount point and mount the new device
[ "${mount_point:0:${#rootmp}}" = "${rootmp}" ] && { [ "${mount_point:0:${#rootmp}}" = "${rootmp}" ] && {
mkdir -p "$mount_point" mkdir -p "$mount_point"
mount "$mount_point" mount "$mount_point"
} }
logmsg "$me" $"\
added device \`$dev' (${uuid}) mount point:\`$mount_point'"
fi fi
fi fi
done done

View File

@ -2,7 +2,7 @@
Description=openmamba system configuration script Description=openmamba system configuration script
DefaultDependencies=no DefaultDependencies=no
After=systemd-udev-trigger.service systemd-remount-fs.service After=systemd-udev-trigger.service systemd-remount-fs.service
Before=swap.target sysinit.target Before=sysinit.target
[Service] [Service]
Type=oneshot Type=oneshot