summaryrefslogtreecommitdiffstats
path: root/contrib/bacman.in
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bacman.in')
-rwxr-xr-xcontrib/bacman.in28
1 files changed, 15 insertions, 13 deletions
diff --git a/contrib/bacman.in b/contrib/bacman.in
index c55d7161..93623565 100755
--- a/contrib/bacman.in
+++ b/contrib/bacman.in
@@ -23,16 +23,21 @@
shopt -s extglob
shopt -s nullglob
-readonly progname="bacman"
-readonly progver="0.2.1"
+declare -r myname='bacman'
+declare -r myver='@PACKAGE_VERSION@'
#
# User Friendliness
#
usage() {
echo "This program recreates a package using pacman's db and system files"
- echo "Usage: $progname <installed package name>"
- echo "Example: $progname kernel26"
+ echo "Usage: $myname <installed package name>"
+ echo "Example: $myname kernel26"
+}
+
+version() {
+ printf "%s %s\n" "$myname" "$myver"
+ echo 'Copyright (C) 2008 locci <carlocci_at_gmail_dot_com>'
}
if (( $# != 1 )); then
@@ -40,14 +45,11 @@ if (( $# != 1 )); then
exit 1
fi
-if [[ $1 == "--help" || $1 == "-h" ]]; then
+if [[ $1 = -@(h|-help) ]]; then
usage
exit 0
-fi
-
-if [[ $1 == "--version" || $1 == "-v" ]]; then
- echo "$progname version $progver"
- echo "Copyright (C) 2008 locci"
+elif [[ $1 = -@(V|-version) ]]; then
+ version
exit 0
fi
@@ -61,7 +63,7 @@ if (( EUID )); then
/usr/bin/fakeroot -u -- "$0" "$@"
exit $?
else
- echo "WARNING: installing fakeroot or running ${progname} as root is required to"
+ echo "WARNING: installing fakeroot or running $myname as root is required to"
echo " preserve the ownership permissions of files in some packages"
echo ""
fi
@@ -151,7 +153,7 @@ while read i; do
echo ""
echo "ERROR: unable to add /$i to the package"
echo " If your user does not have permssion to read this file then"
- echo " you will need to run $progname as root"
+ echo " you will need to run $myname as root"
rm -rf "$work_dir"
exit 1
fi
@@ -177,7 +179,7 @@ pkg_size=$(du -sk | awk '{print $1 * 1024}')
# TODO adopt makepkg's write_pkginfo() into this or scripts/library
#
echo Generating .PKGINFO metadata...
-echo "# Generated by $progname $progver" > .PKGINFO
+echo "# Generated by $myname $myver" > .PKGINFO
if [[ $INFAKEROOT == "1" ]]; then
echo "# Using $(fakeroot -v)" >> .PKGINFO
fi