From 1038e669649dae98c1cf9c354e680c62cf25638c Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 6 Dec 2011 22:29:32 +0100 Subject: contrib/*: Hardcode program names Add a read-only variable "$myname" to every contrib script and hardcode program names instead of relying on "$0". The variable name "$myname" was chosen because it is already used in pacman and because we use "$myver" to specify the program version in the official scripts. Signed-off-by: Lukas Fleischer Signed-off-by: Dan McGee --- contrib/bacman.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'contrib/bacman.in') diff --git a/contrib/bacman.in b/contrib/bacman.in index c55d7161..00d0691b 100755 --- a/contrib/bacman.in +++ b/contrib/bacman.in @@ -23,7 +23,7 @@ shopt -s extglob shopt -s nullglob -readonly progname="bacman" +declare -r myname='bacman' readonly progver="0.2.1" # @@ -31,8 +31,8 @@ readonly progver="0.2.1" # usage() { echo "This program recreates a package using pacman's db and system files" - echo "Usage: $progname " - echo "Example: $progname kernel26" + echo "Usage: $myname " + echo "Example: $myname kernel26" } if (( $# != 1 )); then @@ -46,7 +46,7 @@ if [[ $1 == "--help" || $1 == "-h" ]]; then fi if [[ $1 == "--version" || $1 == "-v" ]]; then - echo "$progname version $progver" + echo "$myname version $progver" echo "Copyright (C) 2008 locci" exit 0 fi @@ -61,7 +61,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 +151,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 +177,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 $progver" > .PKGINFO if [[ $INFAKEROOT == "1" ]]; then echo "# Using $(fakeroot -v)" >> .PKGINFO fi -- cgit v1.2.3-54-g00ecf