some tweaks for configRun: add -h/--usage option, use portable print instead of echo...
authorDouglas Mencken <dougmencken@gmail.com>
Sun, 12 Aug 2012 21:13:36 +0000 (15:13 -0600)
committerJon Trulson <jon@radscan.com>
Sun, 12 Aug 2012 21:13:36 +0000 (15:13 -0600)
cde/admin/IntegTools/post_install/linux/configRun.src
cde/admin/IntegTools/post_install/option.func
cde/admin/IntegTools/post_install/verify.func

index 00c7e89930608dfb993da1876f8b3709606abd5b..1736b8f23187e7c71b91a0360eeb2b7d60be349b 100755 (executable)
@@ -214,6 +214,19 @@ XCOMM        exists    the link is correct    /usr/dt/link
        EOF
 }
 
+
+PrintUsage()
+{
+  echo "Usage:" $0 "[OPERATION]"
+  echo ""
+  echo "Operations:"
+  echo "    -e        configure"
+  echo "    -d        deconfigure"
+  echo "    -v        verify"
+  echo "    -s        size"
+  echo "    -h        help"
+}
+
 #include "../option.func"
 
 XCOMM ##########################################################################
@@ -239,6 +252,12 @@ DEFAULT_PRINTER="DtPrint"
 
   HandleOption $*
 
+  if [ "$OPERATION" = "usage" ]
+  then
+    PrintUsage
+    exit 0
+  fi
+
   if [ "$OPERATION" = "configure" ]
   then
 
@@ -324,7 +343,7 @@ DEFAULT_PRINTER="DtPrint"
     then
        awk '{print "kill -1 " $2}' /tmp/tmppsout | /bin/csh
     else
-       /usr/sbin/inetd -s
+       [ -x /usr/sbin/inetd ] && /usr/sbin/inetd -s 2>/dev/null
     fi
   fi
 
index 27b8cc7237ab9e12db1057e6dcee2db2d3d273d2..d6ce94e4bb6545483add26f7f7ee2351db9df61e 100644 (file)
@@ -3,7 +3,7 @@ HandleOption()
   while [ $# -ne 0 ]; do
     case $1 in
         -e) OPERATION="configure"
-            shift;
+           shift;
             ;;
        -d) OPERATION="deconfigure"
            shift;
@@ -14,6 +14,12 @@ HandleOption()
        -s) OPERATION="size"
            shift;
            ;;
+       -h | --help | --usage) OPERATION="usage"
+           shift;
+           ;;
+       *) OPERATION="usage"
+           shift;
+           ;;
     esac
   done
 }
index db7079c84cc9fce8731d4865e04dc0f7e4d1a472..886d472e4f60bfb78366c6b8a5258403ff3e8b28 100644 (file)
@@ -5,9 +5,9 @@
        then
          if [ -f ${tokens[0]} ]
          then
-           echo "exists  \c"
+           printf "exists  "
          else
-           echo "MISSING or REMOVED               \c"
+           printf "MISSING or REMOVED               "
            echo "${tokens[0]}"
            continue
          fi
@@ -15,9 +15,9 @@
        then
          if [ -L ${tokens[0]} ]
          then
-           echo "exists  \c"
+           printf "exists  "
          else
-           echo "MISSING or REMOVED               \c"
+           printf "MISSING or REMOVED               "
            echo "${tokens[0]}"
            continue
          fi
 
          if [ "$tmpperms" = "$realperms" ]
          then
-           echo "correct \c"
+           printf "correct "
          else
-           echo " WRONG  \c"
+           printf " WRONG  "
          fi
 
          owner=`ls -l ${tokens[0]} | awk '{print $3}'`
 
          if [ "$owner" = "${tokens[4]}" ]
          then
-           echo "correct \c"
+           printf "correct "
          else
-           echo " WRONG  \c"
+           printf " WRONG  "
          fi
 
          group=`ls -l ${tokens[0]} | awk '{print $4}'`
 
          if [ "$group" = "${tokens[5]}" ]
          then
-           echo "correct  \c"
+           printf "correct  "
          else
-           echo " WRONG   \c"
+           printf " WRONG   "
          fi
        elif [ "${tokens[3]}" = "sym_link" ]
        then
          linkto=`ls -l ${tokens[0]} | awk '{print $11}'`
          if [ "${tokens[2]}" = "$linkto" ]
          then
-           echo "  the link is correct    \c"
+           printf "  the link is correct    "
          else
-           echo "  the link is WRONG      \c"
+           printf "  the link is WRONG      "
          fi
        fi
        echo "${tokens[0]}"