OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-registry Date: 29-Nov-2005 20:16:48
Branch: HEAD Handle: 2005112919164700
Modified files:
openpkg-registry register.sh
Log:
coding style cleanup (mainly consistent indentations)
Summary:
Revision Changes Path
1.18 +88 -96 openpkg-registry/register.sh
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-registry/register.sh
============================================================================
$ cvs diff -u -r1.17 -r1.18 register.sh
--- openpkg-registry/register.sh 29 Nov 2005 17:59:37 -0000 1.17
+++ openpkg-registry/register.sh 29 Nov 2005 19:16:47 -0000 1.18
@@ -73,7 +73,7 @@
{
[ ".$REGISTRY_CONF" = . ] && return
if [ -r "$REGISTRY_CONF" ]; then
- sanitycheck "$REGISTRY_CONF" && . "$REGISTRY_CONF"
+ sanitycheck "$REGISTRY_CONF" && . "$REGISTRY_CONF"
fi
}
@@ -81,7 +81,7 @@
{
[ ".$REGISTRY_UUID" = . ] && return
if [ -r "$REGISTRY_UUID" ]; then
- sanitycheck "$REGISTRY_UUID" && . "$REGISTRY_UUID"
+ sanitycheck "$REGISTRY_UUID" && . "$REGISTRY_UUID"
fi
}
@@ -89,7 +89,7 @@
{
[ ".$REGISTRY_UTIL" = . ] && return
if [ -r "$REGISTRY_UTIL" ]; then
- sanitycheck "$REGISTRY_UTIL" && . "$REGISTRY_UTIL"
+ sanitycheck "$REGISTRY_UTIL" && . "$REGISTRY_UTIL"
fi
}
@@ -99,16 +99,16 @@
# default parameters
-# Primary operations
+# primary operations
op="automatical"
-# Standard options
+# standard options
REGISTRY_MODE=""
REGISTRY_ARGS="http://registry.openpkg.org/register"
REGISTRY_USER=""
REGISTRY_DESC="openpkg://${HOSTNAME}${PREFIX}"
-# Advanced options
+# advanced options
REGISTRY_PLAT="`$oldbinnewsh --eval '%{l_platform -p}'`"
REGISTRY_OREL="`$oldbinnewsh --eval '%{l_openpkg_release}'`"
REGISTRY_UUID="$PREFIX/etc/openpkg/uuid"
@@ -117,10 +117,10 @@
REGISTRY_TRAN="$PREFIX/etc/openpkg/register.tran"
REGISTRY_UTIL="$PREFIX/etc/openpkg/register.util"
-# Read baseline config early and allow options to override contents
+# read baseline config early and allow options to override contents
readconf
-# Debug options
+# debug options
verbose="no"
help="no"
@@ -136,84 +136,85 @@
*) arg='' ;;
esac
case $opt in
- # Primary operations
+ # primary operations
-P|--preparation ) op="preparation" ;;
-T|--transaction ) op="transaction" ;;
-U|--utilization ) op="utilization" ;;
-C|--convenience ) op="convenience" ;;
-I|--interaction ) op="interaction" ;;
- # Additional features
+ # additional features
-S|--printstatus ) op="printstatus" ;;
-R|--rewriteurls ) op="rewriteurls" ;;
- # Standard options
+ # standard options
-m|--mode )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_MODE="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_MODE="$arg"
+ ;;
-a|--args )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_ARGS="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_ARGS="$arg"
+ ;;
-u|--user )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_USER="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_USER="$arg"
+ ;;
-d|--desc )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_DESC="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_DESC="$arg"
+ ;;
- # Advanced options
+ # advanced options
--plat )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_PLAT="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_PLAT="$arg"
+ ;;
--orel )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_VERS="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_VERS="$arg"
+ ;;
--uuid )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_UUID="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_UUID="$arg"
+ ;;
--conf )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_CONF="$arg"; readconf
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_CONF="$arg"; readconf
+ ;;
--prep )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_PREP="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_PREP="$arg"
+ ;;
--tran )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_TRAN="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_TRAN="$arg"
+ ;;
--util )
- if [ ".$arg" = . ]; then shift; arg="$1"; fi
- if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
- REGISTRY_UTIL="$arg"
- ;;
+ if [ ".$arg" = . ]; then shift; arg="$1"; fi
+ if [ ".$arg" = . ]; then help="Missing argument to \"$opt\"";
break; fi
+ REGISTRY_UTIL="$arg"
+ ;;
- # Debug options
+ # debug options
-v|--verbose ) verbose="yes" ;;
-h|--help ) help="Usage" ;;
-* ) help="Invalid option \`$opt'"; break ;;
- # Optional arguments
+ # optional arguments
* ) a[$i]="$opt"
i=i+1
+ ;;
esac
shift
done
@@ -225,19 +226,15 @@
if [ ".$help" != ".Usage" ]; then
echo "$progname:ERROR: $help" 1>&2
fi
- echo "Usage: $progname:
- -m|--mode=fake|post|wipe [-a|--args=<args>] -u|--user=<user>
[-d|--desc=<text>]
- [-v|--verbose] [-h|--help]
- [--plat=<text>] [--orel=<text>]
- [--uuid=<file>]
- [--conf=<file>] [--prep=<file>] [--tran=<file>] [--util=<file>]
- [-P|--preparation] [-T|--transaction] [-U|--utilization]
[-C|--convenience] [-I|--interaction]
-
- Usage: $progname:
- -S|--printstatus
-
- Usage: $progname:
- -R|--rewriteurls [[url]...]]" 1>&2
+ echo "Usage: $progname -m|--mode=fake|post|wipe [-a|--args=<args>]"
+ echo " -u|--user=<user> [-d|--desc=<text>]"
+ echo " [--plat=<text>] [--orel=<text>] [--uuid=<file>]"
+ echo " [--conf=<file>] [--prep=<file>] [--tran=<file>]
[--util=<file>]"
+ echo " [-P|--preparation] [-T|--transaction] [-U|--utilization]"
+ echo " [-C|--convenience] [-I|--interaction]"
+ echo " [-v|--verbose] [-h|--help]"
+ echo "Usage: $progname -S|--printstatus"
+ echo "Usage: $progname -R|--rewriteurls [[url]...]]"
if [ ".$help" != ".Usage" ]; then
exit 1
else
@@ -268,7 +265,7 @@
[ ".$REGISTRY_PREP" = . ] && error "missing information REGISTRY_PREP"
if [ -r "$REGISTRY_UUID" ]; then
- sanitycheck "$REGISTRY_UUID" && . "$REGISTRY_UUID"
+ sanitycheck "$REGISTRY_UUID" && . "$REGISTRY_UUID"
fi
[ ".$UUID_REGISTRY" = . ] && error "missing information UUID_REGISTRY"
[ ".$UUID_INSTANCE" = . ] && error "missing information UUID_INSTANCE"
@@ -315,16 +312,13 @@
[ ".$REGISTRY_TRAN" = . ] && error "missing information REGISTRY_TRAN"
if [ ".$REGISTRY_MODE" = .fake ]; then
-
- request=`
- awk '
- BEGIN { registry=0 }
- /<registry>/ { registry=1 }
- /<request / { if (registry) { print $0 } }
- /<\/registry>/ { registry=0 }' \
- | sed -e 's;^.*<request id=";;' -e 's;"$;;'`
+ request=`awk '
+ BEGIN { registry=0 }
+ /<registry>/ { registry=1 }
+ /<request / { if (registry) { print $0 } }
+ /<\/registry>/ { registry=0 }' | \
+ sed -e 's;^.*<request id=";;' -e 's;"$;;'`
if [ ".$request" = . ]; then error "no request seen on stdin"; fi
-
(
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"
standalone=\"no\"?>"
echo "<!DOCTYPE registry"
@@ -343,9 +337,8 @@
--form 'page=dropxml' \
--form 'data=<-' \
--form 'submit=DROPXML' \
- $REGISTRY_ARGS \
+ $REGISTRY_ARGS \
| tee $REGISTRY_TRAN
-
fi
}
@@ -365,13 +358,12 @@
[ ".$REGISTRY_UTIL" = . ] && error "missing information REGISTRY_UTIL"
- response=`
- awk '
- BEGIN { registry=0 }
- /<registry>/ { registry=1 }
- /<response / { if (registry) { print $0 } }
- /<\/registry>/ { registry=0 }' \
- | sed -e 's;^.*<response id=";;' -e 's;" done="; ;' -e 's;">; ;' -e
's;</response>.*$;;'`
+ response=`awk '
+ BEGIN { registry=0 }
+ /<registry>/ { registry=1 }
+ /<response / { if (registry) { print $0 } }
+ /<\/registry>/ { registry=0 }' | \
+ sed -e 's;^.*<response id=";;' -e 's;" done="; ;' -e 's;">; ;' -e
's;</response>.*$;;'`
if [ ".$response" = . ]; then error "no response seen on stdin"; fi
REGISTRY_UUID=`echo $response | awk '/./ { print $1 }'`
@@ -432,7 +424,7 @@
read -p "==== Preparation ==== [press RETURN to continue]"
echo "Attempting to write to the configuration file \"$REGISTRY_CONF\""
echo "#`TZ= date '+%Y-%m-%d %H:%M:%S'`" | tee -a "$REGISTRY_CONF"
2>/dev/null \
- || error "Configuration file not writable. Get more permissions and try
again"
+ || error "Configuration file not writable. Get more permissions and
try again"
read -p "[REGISTRY_USER=\"$REGISTRY_USER\"] username "; [
".$REPLY" != . ] && REGISTRY_USER="$REPLY"
read -p "[REGISTRY_DESC=\"$REGISTRY_DESC\"] description (*)"; [
".$REPLY" != . ] && REGISTRY_DESC="$REPLY"
@@ -449,7 +441,7 @@
[ ".$REGISTRY_PREP" = . ] && error "missing information REGISTRY_PREP"
if [ -r "$REGISTRY_UUID" ]; then
- sanitycheck "$REGISTRY_UUID" && . "$REGISTRY_UUID"
+ sanitycheck "$REGISTRY_UUID" && . "$REGISTRY_UUID"
fi
[ ".$UUID_REGISTRY" = . ] && error "missing information UUID_REGISTRY"
[ ".$UUID_INSTANCE" = . ] && error "missing information UUID_INSTANCE"
@@ -524,10 +516,10 @@
if [ ".$REGISTRY_DONE" = .yes ]; then
# URL rewriting
while [ ".$1" != . ]; do
- printf '%s\n' "$1" | sed \
- -e "s;^\(ftp\)://\(ftp.openpkg.com\)/;\1://$UUID_REGISTRY:[EMAIL
PROTECTED]/;" \
- -e "s;^\(ftp\)://\(ftp.openpkg.org\)/;\1://$UUID_REGISTRY:[EMAIL
PROTECTED]/;" \
- -e "s;^\(ftp\)://\(ftp.openpkg.net\)/;\1://$UUID_REGISTRY:[EMAIL
PROTECTED]/;"
+ printf '%s\n' "$1" | \
+ sed -e
"s;^\(ftp\)://\(ftp.openpkg.com\)/;\1://$UUID_REGISTRY:[EMAIL PROTECTED]/;" \
+ -e
"s;^\(ftp\)://\(ftp.openpkg.org\)/;\1://$UUID_REGISTRY:[EMAIL PROTECTED]/;" \
+ -e
"s;^\(ftp\)://\(ftp.openpkg.net\)/;\1://$UUID_REGISTRY:[EMAIL PROTECTED]/;"
shift
done
return 0
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]