Blame 0016-30convertfs-convertfs.sh-correct-check-for-usr-bin.patch

Harald Hoyer a92557
From 95268ffed378ac2bb3b5959cdbbf2e8b7e10534e Mon Sep 17 00:00:00 2001
Harald Hoyer 66318b
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 66318b
Date: Wed, 29 Feb 2012 13:21:51 +0100
Harald Hoyer 66318b
Subject: [PATCH] 30convertfs/convertfs.sh: correct check for /usr/bin
Harald Hoyer 66318b
Harald Hoyer 66318b
---
Harald Hoyer a92557
 modules.d/30convertfs/convertfs.sh |   17 ++++++++++-------
Harald Hoyer 9e9f8f
 1 file changed, 10 insertions(+), 7 deletions(-)
Harald Hoyer 66318b
Harald Hoyer 66318b
diff --git a/modules.d/30convertfs/convertfs.sh b/modules.d/30convertfs/convertfs.sh
Harald Hoyer a92557
index 036ec51..d1d25aa 100755
Harald Hoyer 66318b
--- a/modules.d/30convertfs/convertfs.sh
Harald Hoyer 66318b
+++ b/modules.d/30convertfs/convertfs.sh
Harald Hoyer a92557
@@ -21,13 +21,13 @@ while [[ "$ROOT" != "${ROOT%/}" ]]; do
Harald Hoyer a92557
     ROOT=${ROOT%/}
Harald Hoyer a92557
 done
Harald Hoyer a92557
 
Harald Hoyer a92557
-if [ ! -L $ROOT/var/run ]; then
Harald Hoyer a92557
+if [ ! -L $ROOT/var/run -a -e $ROOT/var/run ]; then
Harald Hoyer a92557
     echo "Converting /var/run to symlink"
Harald Hoyer a92557
     mv -f $ROOT/var/run $ROOT/var/run.runmove~
Harald Hoyer a92557
     ln -sfn ../run $ROOT/var/run
Harald Hoyer 66318b
 fi
Harald Hoyer 66318b
 
Harald Hoyer a92557
-if [ ! -L $ROOT/var/lock ]; then
Harald Hoyer a92557
+if [ ! -L $ROOT/var/lock -a -e $ROOT/var/lock ]; then
Harald Hoyer a92557
     echo "Converting /var/lock to symlink"
Harald Hoyer a92557
     mv -f $ROOT/var/lock $ROOT/var/lock.lockmove~
Harald Hoyer a92557
     ln -sfn ../run/lock $ROOT/var/lock
Harald Hoyer a92557
@@ -42,16 +42,19 @@ needconvert() {
Harald Hoyer a92557
     return 1
Harald Hoyer a92557
 }
Harald Hoyer a92557
 
Harald Hoyer 66318b
+if ! [ -e "$ROOT/usr/bin" ]; then
Harald Hoyer a92557
+    echo "$ROOT/usr/bin does not exist!"
Harald Hoyer a92557
+    echo "Make sure, the kernel command line has enough information"
Harald Hoyer a92557
+    echo "to mount /usr (man dracut.cmdline)"
Harald Hoyer a92557
+    exit 1
Harald Hoyer a92557
+fi
Harald Hoyer a92557
+
Harald Hoyer a92557
+
Harald Hoyer a92557
 if ! needconvert; then
Harald Hoyer a92557
     echo "Your system is already converted."
Harald Hoyer a92557
     exit 0
Harald Hoyer 66318b
 fi
Harald Hoyer a92557
 
Harald Hoyer a92557
-if [ -e "$ROOT/usr/bin" ]; then
Harald Hoyer a92557
-    echo "$ROOT/usr/bin does not exist"
Harald Hoyer a92557
-    exit 1
Harald Hoyer a92557
-fi
Harald Hoyer a92557
-
Harald Hoyer a92557
 testfile="$ROOT/.usrmovecheck$$"
Harald Hoyer a92557
 rm -f "$testfile"
Harald Hoyer a92557
 > "$testfile"