[Fai-commit] r3505 - in trunk: debian lib

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Mon Jun 12 12:13:05 UTC 2006


Author: lange
Date: 2006-06-12 12:13:04 +0000 (Mon, 12 Jun 2006)
New Revision: 3505

Modified:
   trunk/debian/changelog
   trunk/lib/mkrw
Log:
add option -n to mkrw


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-06-12 10:31:52 UTC (rev 3504)
+++ trunk/debian/changelog	2006-06-12 12:13:04 UTC (rev 3505)
@@ -5,8 +5,9 @@
     /etc/dhcp3/dhclient-script and /etc/dhcp3/dhclient.conf
   * create_ramdisk: make /etc/lvm writeable (closes: 365035)
   * do not call mkrwsize if directory doe not exist (closes: 365037)
- 
- -- Thomas Lange <lange at debian.org>  Tue,  6 Jun 2006 12:34:38 +0200
+  * lib/mkrw: add option -n
+  
+ -- Thomas Lange <lange at debian.org>  Mon, 12 Jun 2006 14:12:34 +0200
 
 fai (2.10.1) unstable; urgency=low
 

Modified: trunk/lib/mkrw
===================================================================
--- trunk/lib/mkrw	2006-06-12 10:31:52 UTC (rev 3504)
+++ trunk/lib/mkrw	2006-06-12 12:13:04 UTC (rev 3505)
@@ -15,14 +15,26 @@
     # mount tmpfs on top of dir $2
     # extract dirs and files into tmpfs
 
+    local n=
+
     if [ ! -d "$2" ]; then
 	echo "WARNING: $2 is not a directory. Cannot make it writeable."
 	return
     fi
 
+    # test for already writable
+    temp=$(mktemp -q -p $2)
+    if [ $? -eq 0 ]; then
+	echo "mkrw: $2 is already writable."
+	rm $temp
+	return
+    fi
+
+    [ -n "$3" ] && n="-n"
+
     local tmp1=$(mktemp) || exit 12
     tar -C $2 -cf $tmp1 .
-    mount -o size=$1 -t tmpfs tmpfs $2
+    mount $n -o size=$1 -t tmpfs tmpfs $2
     tar -C $2 -xf $tmp1
     rm -f $tmp1
 }
@@ -30,13 +42,14 @@
 
 size=10m # default size
 
-while getopts s: opt ; do
+while getopts s:n opt ; do
     case "$opt" in
         s) size="$OPTARG" ;;
+        n) no_mount=1 ;;
         esac
 done
 shift $(($OPTIND - 1))
 
 for d in "$@"; do
-    [ -d "$d ] && mkrwsize $size $d
+    [ -d "$d ] && mkrwsize $size $d $no_mount
 done




More information about the Fai-commit mailing list