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

View File

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