Commit e5d8e68a authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmcs: add -h, --help support

parent 80c0d018
...@@ -82,21 +82,39 @@ toalt_grprepl() ...@@ -82,21 +82,39 @@ toalt_grprepl()
return 1 return 1
} }
Usage="Usage: rpmcs [specfile]
spec file can be autodetected from git repo"
mygetopts()
{
Descr="rpmcs - cleanup spec (like cleanup_spec command)"
phelp()
{
# TODO: improve description
echog "$Descr"
echog "$Usage"
echog " specfile - spec file (copy will be saved as specfile~)"
exit 0
}
if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
phelp
fi
# pass other options to RPM:
LISTRPMARGS=$@
}
# If run without params, try autodetect spec # If run without params, try autodetect spec
if [ -z "$1" ] ; then if [ -z "$1" ] ; then
LISTNAMES=$(get_gear_spec) LISTNAMES=$(get_gear_spec)
[ -n "$LISTNAMES" ] && echo "Using autodetected spec $LISTNAMES..." [ -n "$LISTNAMES" ] && echo "Using autodetected spec $LISTNAMES..."
else else
parse_cmd_pre "$@" parse_cmd_pre "$@"
mygetopts $LISTARGS
fi fi
if [ "$1" = "-h" ]; then
echog "rpmcs spec - cleanup spec (like cleanup_spec command), adapted to ALT"
exit 0
fi
for i in $LISTNAMES for i in $LISTNAMES
do do
if [ -z ${i/*rpm/} ] ; then if [ -z ${i/*rpm/} ] ; then
...@@ -104,7 +122,7 @@ do ...@@ -104,7 +122,7 @@ do
fi fi
# Make backup copy # Make backup copy
cp -f $i ${i}~ cp -f $i ${i}~ || fatal "Cannot find spec file '$i'"
# Unneeded on ALT # Unneeded on ALT
subst "s|^Prefix:.*$||" $i subst "s|^Prefix:.*$||" $i
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment