drop the init script for handling swap partition in CE again, drop mkswap call

parted enables the swap partition during partition creation time
already, so we'd have to rewrite the partition stuff as well.
Turns out the difference between VM sizes (no swap vs. swap) is just
about 30MB, so let's drop the efforts regarding removal-but-enabling-swap-afterwards
and instead we get a even more homogeneous solution. :)

From: Michael Prokop <mprokop@sipwise.com>
ksolomko/vlan
Michael Prokop 14 years ago
parent 0f72b594b9
commit 8f975fc1eb

@ -730,60 +730,12 @@ fi
sync
mount /dev/${DISK}1 $TARGET
if [[ $(imvirt) == "Physical" ]] || $PRO_EDITION ; then
# provide useable swap partition
SWAP_PARTITION="/dev/${DISK}2"
echo "Initialising swap partition $SWAP_PARTITION"
mkswap "$SWAP_PARTITION"
echo "Enabling swap partition $SWAP_PARTITION via /etc/fstab"
cat >> "${TARGET}/etc/fstab" << EOF
# provide useable swap partition
SWAP_PARTITION="/dev/${DISK}2"
echo "Enabling swap partition $SWAP_PARTITION via /etc/fstab"
cat >> "${TARGET}/etc/fstab" << EOF
$SWAP_PARTITION none swap sw,pri=0 0 0
EOF
elif $CE_EDITION ; then
# install self destructing init script which enables swap partition on first
# boot so we have swap in CE installations but don't add the initialised
# swap partition to our VM images (which would increase its size)
cat > ${TARGET}/etc/init.d/enableswap << EOF
#!/bin/sh
### BEGIN INIT INFO
# Provides: enableswap
# Required-Start: checkroot
# Required-Stop:
# Default-Start: S
# Default-Stop:
# X-Interactive: true
# Short-Description: Enable swap partition(s) on first boot
### END INIT INFO
PATH=/sbin:/bin
# hardcoded for now
partition=/dev/sda2
[ -b "\$partition" ] || exit 0
if grep -q "^\${partition}.*swap" /etc/fstab ; then
echo "\$0 - Nothing to do as \$partition is enabled already"
else
echo "\$0 - Enabling swap partition \$partition in /etc/fstab"
echo "# enabled on 1st boot:" >> /etc/fstab
echo "\${partition} none swap sw 0 0" >> /etc/fstab
fi
echo "\$0 - Removing itself now..."
insserv -r enableswap
rm -f "\$0"
exit 0
# EOF
EOF
chroot $TARGET chmod 775 /etc/init.d/enableswap
chroot $TARGET ln -s /etc/init.d/enableswap /etc/rcS.d/S03enableswap
chroot $TARGET insserv enableswap
fi
# removals: packages which debootstrap installs but d-i doesn't
chroot $TARGET apt-get --purge -y remove \

Loading…
Cancel
Save