1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

some tweaks for configRun: add -h/--usage option, use portable print instead of echo \c, etc.

This commit is contained in:
Douglas Mencken 2012-08-12 15:13:36 -06:00 committed by Jon Trulson
parent 7153a0e3e2
commit 2b8bd0743b
3 changed files with 39 additions and 14 deletions

View file

@ -214,6 +214,19 @@ XCOMM exists the link is correct /usr/dt/link
EOF 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" #include "../option.func"
XCOMM ########################################################################## XCOMM ##########################################################################
@ -239,6 +252,12 @@ DEFAULT_PRINTER="DtPrint"
HandleOption $* HandleOption $*
if [ "$OPERATION" = "usage" ]
then
PrintUsage
exit 0
fi
if [ "$OPERATION" = "configure" ] if [ "$OPERATION" = "configure" ]
then then
@ -324,7 +343,7 @@ DEFAULT_PRINTER="DtPrint"
then then
awk '{print "kill -1 " $2}' /tmp/tmppsout | /bin/csh awk '{print "kill -1 " $2}' /tmp/tmppsout | /bin/csh
else else
/usr/sbin/inetd -s [ -x /usr/sbin/inetd ] && /usr/sbin/inetd -s 2>/dev/null
fi fi
fi fi

View file

@ -3,7 +3,7 @@ HandleOption()
while [ $# -ne 0 ]; do while [ $# -ne 0 ]; do
case $1 in case $1 in
-e) OPERATION="configure" -e) OPERATION="configure"
shift; shift;
;; ;;
-d) OPERATION="deconfigure" -d) OPERATION="deconfigure"
shift; shift;
@ -14,6 +14,12 @@ HandleOption()
-s) OPERATION="size" -s) OPERATION="size"
shift; shift;
;; ;;
-h | --help | --usage) OPERATION="usage"
shift;
;;
*) OPERATION="usage"
shift;
;;
esac esac
done done
} }

View file

@ -5,9 +5,9 @@
then then
if [ -f ${tokens[0]} ] if [ -f ${tokens[0]} ]
then then
echo "exists \c" printf "exists "
else else
echo "MISSING or REMOVED \c" printf "MISSING or REMOVED "
echo "${tokens[0]}" echo "${tokens[0]}"
continue continue
fi fi
@ -15,9 +15,9 @@
then then
if [ -L ${tokens[0]} ] if [ -L ${tokens[0]} ]
then then
echo "exists \c" printf "exists "
else else
echo "MISSING or REMOVED \c" printf "MISSING or REMOVED "
echo "${tokens[0]}" echo "${tokens[0]}"
continue continue
fi fi
@ -32,36 +32,36 @@
if [ "$tmpperms" = "$realperms" ] if [ "$tmpperms" = "$realperms" ]
then then
echo "correct \c" printf "correct "
else else
echo " WRONG \c" printf " WRONG "
fi fi
owner=`ls -l ${tokens[0]} | awk '{print $3}'` owner=`ls -l ${tokens[0]} | awk '{print $3}'`
if [ "$owner" = "${tokens[4]}" ] if [ "$owner" = "${tokens[4]}" ]
then then
echo "correct \c" printf "correct "
else else
echo " WRONG \c" printf " WRONG "
fi fi
group=`ls -l ${tokens[0]} | awk '{print $4}'` group=`ls -l ${tokens[0]} | awk '{print $4}'`
if [ "$group" = "${tokens[5]}" ] if [ "$group" = "${tokens[5]}" ]
then then
echo "correct \c" printf "correct "
else else
echo " WRONG \c" printf " WRONG "
fi fi
elif [ "${tokens[3]}" = "sym_link" ] elif [ "${tokens[3]}" = "sym_link" ]
then then
linkto=`ls -l ${tokens[0]} | awk '{print $11}'` linkto=`ls -l ${tokens[0]} | awk '{print $11}'`
if [ "${tokens[2]}" = "$linkto" ] if [ "${tokens[2]}" = "$linkto" ]
then then
echo " the link is correct \c" printf " the link is correct "
else else
echo " the link is WRONG \c" printf " the link is WRONG "
fi fi
fi fi
echo "${tokens[0]}" echo "${tokens[0]}"