Correcting swap partition handling in fstab to not always append entries forever...
authorDaniel Baumann <daniel@debian.org>
Fri, 27 Mar 2009 10:32:22 +0000 (11:32 +0100)
committerDaniel Baumann <daniel@debian.org>
Wed, 9 Mar 2011 16:48:04 +0000 (17:48 +0100)
scripts/live-bottom/13swap

index 8fc718c..448c90a 100755 (executable)
@@ -55,9 +55,10 @@ done
 for device in ${devices}
 do
 
-cat >> ${FSTAB} << EOF
-${device} swap swap defaults 0 0
-EOF
+if ! grep -qs  "^${device} swap" "${FSTAB}"
+then
+       echo "${device} swap swap defaults 0 0" >> "${FSTAB}"
+fi
 
 done