[Fai-commit] r4302 - trunk/bin

lange at alioth.debian.org lange at alioth.debian.org
Sun Jun 10 20:02:42 UTC 2007


Author: lange
Date: 2007-06-10 20:02:42 +0000 (Sun, 10 Jun 2007)
New Revision: 4302

Modified:
   trunk/bin/make-fai-nfsroot
Log:
add option -p (closes: #359323)


Modified: trunk/bin/make-fai-nfsroot
===================================================================
--- trunk/bin/make-fai-nfsroot	2007-06-10 19:00:40 UTC (rev 4301)
+++ trunk/bin/make-fai-nfsroot	2007-06-10 20:02:42 UTC (rev 4302)
@@ -31,7 +31,7 @@
 usage() {
 
     cat <<-EOF
-	Copyright (C) 1999-2006 Thomas Lange
+	Copyright (C) 1999-2007 Thomas Lange
 	Report bugs to <fai at informatik.uni-koeln.de>.
 
 	Usage: make-fai-nfsroot [OPTIONS]
@@ -53,8 +53,9 @@
 kfile="vmlinuz" # some architectures use different names
 kernelname="$kfile-install"
 merror="properly"
+sshpreserve=0
 # option e currently does nothing
-while getopts hervC:f:kKV: opt ; do
+while getopts hervC:f:kKV:p opt ; do
     case "$opt" in
         C) cfdir=$OPTARG ;;
         v) verbose=1 ; v=-v ;;
@@ -64,7 +65,8 @@
         k) kinstall=1 ;;
         K) kremove=1; kinstall=1 ;;
         h) usage ;;
-	e) expert=1 ;;
+        e) expert=1 ;;
+        p) sshpreserve=1 ;;
         ?) exit 5 ;; # error in option parsing
     esac
 done
@@ -156,6 +158,12 @@
 
     # nothing to do if no ssh is available in nfsroot
     [ -f $NFSROOT/usr/bin/ssh ] || return 0
+    if [ $sshpreserve = 1 ]; then
+	tar -C $NFSROOT -xf $tmptar
+	rm $tmptar
+	return 0
+    fi
+
     mkdir -p -m 700 $NFSROOT/root/.ssh
     if [ -n "$LOGUSER" ] ; then
         loguserhome=`eval "cd ~$LOGUSER 2>/dev/null && pwd;true"`
@@ -454,6 +462,13 @@
 echo "By default it needs more than 250 MBytes disk space."
 echo "This may take a long time."
 
+if [ $sshpreserve = 1 ]; then
+    # save old .ssh directory
+    tmptar=$(mktemp) || exit 12
+    # should we set the umask before? Does it influence the other parts?
+    tar -C $NFSROOT -cvf $tmptar root/.ssh
+fi
+
 # Kill the directory if not in recover mode
 if [ -d $NFSROOT/$FAI -a ! "$recover" ]
 then




More information about the Fai-commit mailing list