Commit 0eef2731 authored by David Johnson's avatar David Johnson

A couple bugfixes to new systemd swap stuff; improve logging too.

parent 828e7acd
......@@ -88,7 +88,9 @@ fi
# Ok, we are running this on a clean Emulab node.
mkdir -p $RUNDIR
# Use truncate to either create or zero the file; we only append to it,
# so it has to be empty.
truncate -s 0 $TMPFSTAB
# Get our configuration.
......@@ -193,8 +195,10 @@ while read -r line ; do
if [ -n "$dev" ] ; then
# Maybe it is already a sane swap partition.
blkid "$dev" | grep -q "TYPE=['\"]swap['\"]"
output=`blkid "$dev"`
echo "$output" | grep -q "TYPE=['\"]swap['\"]"
if [ ! $? -eq 0 ]; then
logit "$dev needs mkswap: blkid reports '$output'"
# Needs a mkswap, so check partition type.
npdev=`echo "$dev" | sed -r -n -e 's/^(.*[^0-9])[0-9]+$/\1/p'`
......@@ -12,10 +12,16 @@ FSTAB=/etc/fstab
if [ -f $RUNDIR/generated_swaps ]; then
echo "Recording Emulab-generated swaps"
mv $RUNDIR/generated_swaps $BOOTDIR/
if [ -f $RUNDIR/generated_fstab ]; then
echo "Moving Emulab-generated fstab to /etc/fstab"
mv $RUNDIR/generated_fstab $FSTAB
# NB: copy instead of mv, because systemd re-runs generators
# regularly, and we don't want to re-run the Emulab-specific part of
# the generator if anybody (i.e. prepare) cleans out
# /var/emulab/boot, as long as $RUNDIR state is still in place.
cp -p $RUNDIR/generated_swaps $BOOTDIR/
if [ -s $RUNDIR/generated_fstab ]; then
echo "Moving Emulab-generated fstab to /etc/fstab"
mv $RUNDIR/generated_fstab $FSTAB
elif [ -f $RUNDIR/generated_fstab ]; then
echo "Not Moving Emulab-generated fstab to /etc/fstab; 0 bytes!"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment