[Fedora-livecd-list] tools/livecd-iso-to-disk.sh

Brian C. Lane bcl at fedoraproject.org
Thu Dec 19 00:38:33 UTC 2013


 tools/livecd-iso-to-disk.sh |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 75fc59b57741e43e920f74f8e320784ed70f3db6
Author: Brian C. Lane <bcl at redhat.com>
Date:   Wed Dec 18 16:38:13 2013 -0800

    Cleanup arg parsing a bit (#725047)

diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 0759dee..d6f21a4 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -719,12 +719,9 @@ updates=
 ks=
 label="LIVE"
 
-if [[ "$*" =~ "--help" ]]; then
-    usage
-fi
-while [ $# -gt 2 ]; do
+while true ; do
     case $1 in
-        --help)
+        --help | -h | -?)
             usage
             ;;
         --noverify)
@@ -818,17 +815,26 @@ while [ $# -gt 2 ]; do
 	    label=$2
 	    shift
 	    ;;
-        *)
+        --*)
             echo "invalid arg -- $1"
             shortusage
             exit 1
             ;;
+        *)
+            break
+            ;;
     esac
     shift
 done
 
-SRC=$(readlink -f "$1")
-TGTDEV=$(readlink -f "$2")
+if [ $# -ne 2 ]; then
+    echo "Missing arguments"
+    shortusage
+    exit 1
+fi
+
+SRC=$(readlink -f "$1") || :
+TGTDEV=$(readlink -f "$2") || :
 
 if [ -z "$SRC" ]; then
     echo "Missing source"




More information about the livecd mailing list