[SCM] Debian Live initramfs hook branch, master, updated. 1.157.1-1-9-g892bcb9

Daniel Baumann daniel at debian.org
Thu Apr 9 16:21:40 UTC 2009


The following commit has been merged in the master branch:
commit 892bcb904b9538211eda69e93a38b7d88c0d96db
Author: Daniel Baumann <daniel at debian.org>
Date:   Thu Apr 9 18:19:35 2009 +0200

    Adding force parameter for live-swapfile.

diff --git a/bin/live-swapfile b/bin/live-swapfile
index 7d6d885..2c61036 100755
--- a/bin/live-swapfile
+++ b/bin/live-swapfile
@@ -14,6 +14,7 @@ _SWAP_SIZE="${_SWAP_SIZE:-auto}"
 _SWAP_FACTOR="${_SWAP_FACTOR:-2}"
 
 _SWAP_PURGE="${_SWAP_PURGE:-true}"
+_FORCE="${_FORCE:-true}"
 
 case "${1}" in
 	add)
@@ -45,16 +46,22 @@ case "${1}" in
 		# Creating new swap file
 		if [ "${_SWAP_FILESIZE}" != "${_SWAP_SIZE_MB}M" ]
 		then
-			# Removing old swapfile
-			rm -f "${_SWAP_DIRECTORY}/${_SWAP_FILE}"
-
-			echo "Creating ${_SWAP_SIZE_MB} MB swapfile."
-
-			mkdir -p "${_SWAP_DIRECTORY}"
-
-			# Unfortunately, swapon does not support files with
-			# holes, therefore we cannot preallocate.
-			dd if=/dev/zero of="${_SWAP_DIRECTORY}/${_SWAP_FILE}"  bs=1024k count="${_SWAP_SIZE_MB}"
+			if [ "${_FORCE}" = "true" ]
+			then
+				# Removing old swapfile
+				rm -f "${_SWAP_DIRECTORY}/${_SWAP_FILE}"
+
+				echo "Creating ${_SWAP_SIZE_MB} MB swapfile."
+
+				mkdir -p "${_SWAP_DIRECTORY}"
+
+				# Unfortunately, swapon does not support files
+				# with holes, therefore we cannot preallocate.
+				dd if=/dev/zero of="${_SWAP_DIRECTORY}/${_SWAP_FILE}"  bs=1024k count="${_SWAP_SIZE_MB}"
+			else
+				echo "Exit."
+				return 1
+			fi
 		fi
 
 		echo "Enabling ${_SWAP_DIRECTORY}/${_SWAP_FILE}."

-- 
Debian Live initramfs hook



More information about the debian-live-changes mailing list