commit 50a045b20f3b7bcdea84f6c8f662935020080cf7
parent 6c4f1105314c7d3a93560f821af169058ca9f012
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue,  8 Jul 2014 11:40:26 +0000
ns-prepare: fix rc.conf write, minor whitespace fix
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat:
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/bin/ns-boot b/bin/ns-boot
@@ -4,5 +4,3 @@ for ns in $(ls -1 /ns);
 do
 	ns-prepare -b $(ns-root "$ns")
 done
-
-
diff --git a/bin/ns-prepare b/bin/ns-prepare
@@ -45,18 +45,22 @@ fi
 if [ ! -d "$nsroot/.ns" ];
 then
 	mkdir -p "$nsroot/.ns"
-	printf "MOUNTFS=\"\"\n" \
-	       "UMOUNTFS=\"\"\n" \
-	       "TOUCHFILES=\"\"\n" \
-	       "LINKFILES=\"\"\n" \ 
-	       "COPYFILES=\"\"\n" > "$nsroot/.ns/rc.conf"
+	cat > "$nsroot/.ns/rc.conf" <<!__EOF__
+MOUNTFS=""
+UMOUNTFS=""
+TOUCHFILES=""
+COPYFILES=""
+LINKFILES=""
+!__EOF__
 fi
 
 filesystems="$MOUNTFS proc sys tmp dev dev/pts mnt home run devel nix usr/share/terminfo"
 for m in $filesystems;
 do
 	mkdir -p "$nsroot/$m"
-	mountpoint -q "$nsroot/$m" || mount -o rbind "/$m" "$nsroot/$m"
+	if test -d "/$m"; then
+		mountpoint -q "$nsroot/$m" || mount -o rbind "/$m" "$nsroot/$m"
+	fi
 done
 
 #[ -d "$nsroot/mnt/root" ] || mkdir -p "$nsroot/mnt/root"
diff --git a/bin/ns-umount b/bin/ns-umount
@@ -15,4 +15,3 @@ mount | cut -d' ' -f 3 | grep "^${nsroot}" | sort -r \
 		printf "Unmounting '%s'.\n" "$m"
 		umount "$m";
 	done
-