[SCM] live-boot branch, debian-next, updated. debian/3.0_a29-1-11-ge86f3b6
Daniel Baumann
daniel at debian.org
Tue Jun 5 16:44:06 UTC 2012
The following commit has been merged in the debian-next branch:
commit e86f3b6f67c3b2757b4bd1794016026c6a7fb63e
Author: Daniel Baumann <daniel at debian.org>
Date: Tue Jun 5 18:43:37 2012 +0200
Splitting out swap handling and rewriting to a live-boot subscript.
diff --git a/initramfs-tools/scripts/live-bottom/12fstab b/initramfs-tools/scripts/live-bottom/12fstab
index 94adddb..848fc2f 100755
--- a/initramfs-tools/scripts/live-bottom/12fstab
+++ b/initramfs-tools/scripts/live-bottom/12fstab
@@ -44,45 +44,6 @@ then
echo "tmpfs /tmp tmpfs nosuid,nodev 0 0" >> "${FSTAB}"
fi
-if [ -n "${LIVE_SWAPON}" ]
-then
- devices=""
-
- for device in /dev/[sv]d[a-z][0-9]*
- do
- if ! [ -b "${device}" ]
- then
- continue
- fi
-
- /sbin/blkid -o udev -p ${device%%[0-9]*} | grep -q "^ID_FS_USAGE=raid" && continue
-
- magic=$(/bin/dd if="${device}" bs=4086 skip=1 count=1 2>/dev/null | /bin/dd bs=10 count=1 2>/dev/null) || continue
-
- if [ "${magic}" = "SWAPSPACE2" -o "${magic}" = "SWAP-SPACE" ]
- then
- #log "Found ${device}"
- devices="${devices} ${device}"
- fi
- done
-
- # Remove all auto swap entries
- if grep -qs "swap swap" "${FSTAB}"
- then
- grep -v "swap swap" "${FSTAB}" > "${FSTAB}".tmp
- mv "${FSTAB}".tmp "${FSTAB}"
- fi
-
- # Add new swap entries
- for device in ${devices}
- do
- echo "${device} swap swap defaults 0 0" >> "${FSTAB}"
- done
-fi
-
-# disabled for now
-#rm -f /root/etc/rcS.d/S*checkroot.sh
-
if [ "${NOFASTBOOT}" != "true" ]
then
touch root/fastboot
diff --git a/scripts/boot.sh b/scripts/boot.sh
index 6304c97..02ac43a 100755
--- a/scripts/boot.sh
+++ b/scripts/boot.sh
@@ -636,6 +636,12 @@ mountroot ()
run_scripts /scripts/live-bottom
log_end_msg
+ case "${LIVE_SWAPON}" in
+ true)
+ Swapon
+ ;;
+ esac
+
if [ "${UNIONFS}" = unionfs-fuse ]
then
umount "${rootmnt}/dev"
diff --git a/scripts/boot/swapon b/scripts/boot/swapon
new file mode 100755
index 0000000..158d81b
--- /dev/null
+++ b/scripts/boot/swapon
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+#set -e
+
+Swapon ()
+{
+ _DEVICES="/dev/sd* /dev/vd*"
+
+ if [ -e /run ]
+ then
+ # wheezy
+ _FSTAB="/root/etc/fstab.d/swap"
+ else
+ # squeeze
+ _FSTAB="/root/etc/fstab"
+ fi
+
+ for _DEVICE in ${_DEVICES}
+ do
+ if [ ! -b "${_DEVICE}" ]
+ then
+ continue
+ fi
+
+ blkid -o udev -p ${_DEVICE%%[0-9]*} | grep -q "^ID_FS_USAGE=raid" && continue
+
+ _MAGIC="$(/bin/dd if=${_DEVICE} bs=4086 skip=1 count=1 2>/dev/null | /bin/dd bs=10 count=1 2>/dev/null)" || continue
+
+ case "${_MAGIC}" in
+ SWAPSPACE2|SWAP-SPACE)
+ _SWAP_DEVICES="${_SWAP_DEVICES} ${_DEVICE}"
+ ;;
+ esac
+ done
+
+ # Remove all auto swap entries
+ if grep -qs "swap swap" "${_FSTAB}"
+ then
+ grep -v "swap swap" "${_FSTAB}" > "${_FSTAB}".tmp
+ mv "${_FSTAB}".tmp "${_FSTAB}"
+ fi
+
+ # Add new swap entries
+ for _DEVICE in _SWAP_DEVICES
+ do
+ echo "${_DEVICE} swap swap defaults 0 0" >> "${_FSTAB}"
+ done
+}
--
live-boot
More information about the debian-live-changes
mailing list