xbps-src: add -h flag to show usage.

--HG--
extra : convert_revision : 51fbff55d296a3f818e736835a10763aff278f2d
This commit is contained in:
Juan RP 2010-04-27 14:23:53 +02:00
parent b59a6e55ff
commit 9ddcd8fe72

View file

@ -38,7 +38,7 @@ trap "echo && exit 1" INT QUIT
usage() usage()
{ {
cat << _EOF cat << _EOF
$progname: [-C] [-c <config_file>] [-m <masterdir>] [-p <pkgdir>] <target> $progname: [-Ch] [-c <config_file>] [-m <masterdir>] [-p <pkgdir>] <target>
Targets: Targets:
build Build a package (fetch + extract + configure + build). build Build a package (fetch + extract + configure + build).
@ -67,13 +67,13 @@ Options:
-C Do not remove build directory after successful installation. -C Do not remove build directory after successful installation.
-c Path to global configuration file: -c Path to global configuration file:
if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used. if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used.
-h Usage output.
-m Master directory, overwritting the value set in the configuration -m Master directory, overwritting the value set in the configuration
file at @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf. file at @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf.
-p Package directory, overwritting default path at -p Package directory, overwritting default path at
<XBPS_MASTERDIR>/pkg-binpkgs. <XBPS_MASTERDIR>/pkg-binpkgs.
_EOF _EOF
exit 1
} }
basename_cwd() basename_cwd()
@ -135,10 +135,11 @@ check_config_vars()
# #
# main() # main()
# #
while getopts "Cc:m:p:" opt; do while getopts "Cc:hm:p:" opt; do
case $opt in case $opt in
C) export dontrm_builddir=yes;; C) export dontrm_builddir=yes;;
c) config_file_specified=yes; XBPS_CONFIG_FILE="$OPTARG";; c) config_file_specified=yes; XBPS_CONFIG_FILE="$OPTARG";;
h) usage && exit 0;;
m) m)
_MASTERDIR="$OPTARG" _MASTERDIR="$OPTARG"
if [ ! -d ${_MASTERDIR} ]; then if [ ! -d ${_MASTERDIR} ]; then
@ -157,12 +158,12 @@ while getopts "Cc:m:p:" opt; do
done done
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))
[ $# -eq 0 -o $# -gt 2 ] && usage [ $# -eq 0 -o $# -gt 2 ] && usage && exit 1
target="$1" target="$1"
if [ -z "$target" ]; then if [ -z "$target" ]; then
echo "=> ERROR: missing target." echo "=> ERROR: missing target."
usage usage && exit 1
fi fi
# #
@ -312,7 +313,7 @@ unstow)
;; ;;
*) *)
echo "=> ERROR: invalid target: $target." echo "=> ERROR: invalid target: $target."
usage usage && exit 1
esac esac
# Agur # Agur