/lib/live/boot/3020-swap is in live-boot 1:20170623.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #!/bin/sh
#set -e
Swap ()
{
for _PARAMETER in ${LIVE_BOOT_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
case "${LIVE_SWAP}" in
true)
;;
*)
return 0
;;
esac
LIVE_SWAP_DEVICES="${LIVE_SWAP_DEVICES:-/dev/sd* /dev/vd*}"
for _DEVICE in $(echo ${LIVE_SWAP_DEVICES} | sed -e 's|,| |g')
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" /root/etc/fstab
then
grep -v "swap swap" /root/etc/fstab > /root/etc/fstab.tmp
mv /root/etc/fstab.tmp /root/etc/fstab
fi
# Add new swap entries
for _DEVICE in ${_SWAP_DEVICES}
do
echo "${_DEVICE} swap swap defaults 0 0" >> /root/etc/fstab
done
}
|