Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/Makefile.am43
-rwxr-xr-xcontrib/bacman.in28
-rw-r--r--contrib/bash_completion.in4
-rwxr-xr-xcontrib/paccache.in26
-rwxr-xr-xcontrib/pacdiff.in22
-rwxr-xr-xcontrib/paclist.in29
-rwxr-xr-xcontrib/paclog-pkglist.in21
-rwxr-xr-xcontrib/pacscripts.in18
-rwxr-xr-xcontrib/pacsearch.in26
-rwxr-xr-xcontrib/pacsysclean.in13
-rw-r--r--contrib/zsh_completion.in4
11 files changed, 173 insertions, 61 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 0ff1d9db..eca39e75 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,3 +1,9 @@
+# enforce that all scripts have a --help and --version option
+AUTOMAKE_OPTIONS = std-options
+
+bin_SCRIPTS = \
+ $(OURSCRIPTS)
+
OURSCRIPTS = \
bacman \
paccache \
@@ -30,29 +36,44 @@ EXTRA_DIST = \
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(OURSCRIPTS) $(OURFILES) *.tmp
+if USE_GIT_VERSION
+GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
+REAL_PACKAGE_VERSION = $(GIT_VERSION)
+else
+REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
+endif
+
edit = sed \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
+ -e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
-e '1s|!/bin/bash|!$(BASH_SHELL)|g'
$(OURSCRIPTS): Makefile
- @echo ' ' GEN $@;
- @$(RM) $@ $@.tmp
- @$(edit) $(srcdir)/$@.in >$@.tmp
- @chmod +x $@.tmp
- @chmod a-w $@.tmp
- @mv $@.tmp $@
+ $(AM_V_at)$(RM) $@ $@.tmp
+ $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
+ $(AM_V_at)chmod +x,a-w $@.tmp
+ $(AM_V_at)mv $@.tmp $@
$(OURFILES): Makefile
- @echo ' ' GEN $@;
- @$(RM) $@ $@.tmp
- @$(edit) $(srcdir)/$@.in >$@.tmp
- @chmod a-w $@.tmp
- @mv $@.tmp $@
+ $(AM_V_at)$(RM) $@ $@.tmp
+ $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
+ $(AM_V_at)chmod a-w $@.tmp
+ $(AM_V_at)mv $@.tmp $@
all-am: $(OURSCRIPTS) $(OURFILES)
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
+ $(INSTALL_DATA) bash_completion $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
+ $(MKDIR_P) $(DESTDIR)$(datarootdir)/zsh/site-functions/
+ $(INSTALL_DATA) zsh_completion $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
+
+uninstall-local:
+ $(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
+ $(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
+
bacman: $(srcdir)/bacman.in
bash_completion: $(srcdir)/bash_completion.in
paccache: $(srcdir)/paccache.in
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
diff --git a/contrib/bash_completion.in b/contrib/bash_completion.in
index 8983c92b..529734c3 100644
--- a/contrib/bash_completion.in
+++ b/contrib/bash_completion.in
@@ -76,8 +76,8 @@ _pacman() {
remove=('cascade dbonly nodeps nosave print recursive unneeded' 'c n p s u')
sync=('asdeps asexplicit clean dbonly downloadonly force groups ignore ignoregroup
info list needed nodeps print refresh recursive search sysupgrade'
- 'c f g i l p s u w y')
- upgrade=('asdeps asexplicit force needed nodeps print recursive' 'f p')
+ 'c g i l p s u w y')
+ upgrade=('asdeps asexplicit force needed nodeps print recursive' 'p')
common=('arch cachedir config dbpath debug help logfile noconfirm
noprogressbar noscriptlet quiet root verbose' 'b d h q r v')
core=('database help query remove sync upgrade version' 'D Q R S U V h')
diff --git a/contrib/paccache.in b/contrib/paccache.in
index a9e5bfbc..da65f476 100755
--- a/contrib/paccache.in
+++ b/contrib/paccache.in
@@ -20,6 +20,9 @@
shopt -s extglob
+declare -r myname='paccache'
+declare -r myver='@PACKAGE_VERSION@'
+
declare -a candidates=() cmdopts=() whitelist=() blacklist=()
declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0
declare cachedir=@localstatedir@/cache/pacman/pkg delim=$'\n' keep=3 movedir= scanarch=
@@ -174,9 +177,9 @@ summarize() {
usage() {
cat <<EOF
-usage: ${0##*/} <operation> [options] [targets...]
+usage: $myname <operation> [options] [targets...]
-${0##*/} is a flexible pacman cache cleaning utility, which has numerous
+$myname is a flexible pacman cache cleaning utility, which has numerous
options to help control how much, and what, is deleted from any directory
containing pacman package tarballs.
@@ -200,19 +203,32 @@ containing pacman package tarballs.
EOF
}
+version() {
+ printf "%s %s\n" "$myname" "$myver"
+ echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
+}
+
if (( ! UID )); then
error "Do not run this script as root. You will be prompted for privilege escalation."
exit 42
fi
-while getopts ':a:c:dfhi:k:m:rsuvz' opt; do
+# TODO: remove this workaround and use a sane command line parser (like the
+# parse_options library from scripts/) here
+if [[ $1 = -@(h|-help) ]]; then
+ usage
+ exit 0
+elif [[ $1 = -@(V|-version) ]]; then
+ version
+ exit 0
+fi
+
+while getopts ':a:c:dfi:k:m:rsuvz' opt; do
case $opt in
a) scanarch=$OPTARG ;;
c) cachedir=$OPTARG ;;
d) dryrun=1 ;;
f) cmdopts=(-f) ;;
- h) usage
- exit 0 ;;
i) if [[ $OPTARG = '-' ]]; then
[[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign
else
diff --git a/contrib/pacdiff.in b/contrib/pacdiff.in
index 3f26f381..bfafda26 100755
--- a/contrib/pacdiff.in
+++ b/contrib/pacdiff.in
@@ -17,17 +17,25 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+declare -r myname='pacdiff'
+declare -r myver='@PACKAGE_VERSION@'
+
diffprog=${DIFFPROG:-vimdiff}
diffsearchpath=${DIFFSEARCHPATH:-/etc}
locate=0
usage() {
- echo "pacdiff : a simple pacnew/pacorig/pacsave updater"
- echo "Usage : pacdiff [-l]"
- echo " -l/--locate makes pacdiff use locate rather than find"
+ echo "$myname : a simple pacnew/pacorig/pacsave updater"
+ echo "Usage : $myname [-l]"
+ echo " -l/--locate makes $myname use locate rather than find"
echo " DIFFPROG variable allows to override the default vimdiff"
echo " DIFFSEARCHPATH allows to override the default /etc path"
- echo "Example : DIFFPROG=meld DIFFSEARCHPATH=\"/boot /etc /usr\" pacdiff"
+ echo "Example : DIFFPROG=meld DIFFSEARCHPATH=\"/boot /etc /usr\" $myname"
+}
+
+version() {
+ printf "%s %s\n" "$myname" "$myver"
+ echo 'Copyright (C) 2007 Aaron Griffin <aaronmgriffin@gmail.com>'
}
cmd() {
@@ -42,8 +50,12 @@ if [ $# -gt 0 ]; then
case $1 in
-l|--locate)
locate=1;;
- *)
+ -V|--version)
+ version; exit 0;;
+ -h|--help)
usage; exit 0;;
+ *)
+ usage; exit 1;;
esac
fi
diff --git a/contrib/paclist.in b/contrib/paclist.in
index 06b06f2c..7883e21b 100755
--- a/contrib/paclist.in
+++ b/contrib/paclist.in
@@ -17,6 +17,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+declare -r myname='paclist'
+declare -r myver='@PACKAGE_VERSION@'
+
export TEXTDOMAIN='pacman'
export TEXTDOMAINDIR='/usr/share/locale'
@@ -27,13 +30,31 @@ if ! type gettext &>/dev/null; then
}
fi
-if [[ -z $1 || $1 = -@(h|-help) ]]; then
- printf '%s - List all packages installed from a given repo\n' "${0##*/}"
- printf 'Usage: %s <repo>\n' "${0##*/}"
- printf 'Example: %s testing\n' "${0##*/}"
+usage() {
+ printf '%s - List all packages installed from a given repo\n' "$myname"
+ printf 'Usage: %s <repo>\n' "$myname"
+ printf 'Example: %s testing\n' "$myname"
+}
+
+version() {
+ printf "%s %s\n" "$myname" "$myver"
+ echo 'Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>'
+ echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
+}
+
+if [[ -z $1 ]]; then
+ usage
exit 1
fi
+if [[ $1 = -@(h|-help) ]]; then
+ usage
+ exit 0
+elif [[ $1 = -@(V|-version) ]]; then
+ version
+ exit 0
+fi
+
printf -v installed '[%s]' "$(gettext installed)"
pacman -Sl $1 | awk -v i="$installed" '$NF == i { print $2,$3 }'
diff --git a/contrib/paclog-pkglist.in b/contrib/paclog-pkglist.in
index 27dfd302..222bbc4c 100755
--- a/contrib/paclog-pkglist.in
+++ b/contrib/paclog-pkglist.in
@@ -17,15 +17,30 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+declare -r myname='paclog-pkglist'
+declare -r myver='@PACKAGE_VERSION@'
+
export TEXTDOMAIN='pacman'
export TEXTDOMAINDIR='/usr/share/locale'
declare logfile=${1:-@localstatedir@/log/pacman.log}
+usage() {
+ printf 'usage: %s [pacman log]\n' "$myname"
+ printf 'example: %s @localstatedir@/log/pacman.log\n' "$myname"
+ printf '\ndefaults to: @localstatedir@/log/pacman.log\n'
+}
+
+version() {
+ printf "%s %s\n" "$myname" "$myver"
+ echo 'Copyright (C) 2011 Dave Reisner <dave@archlinux.org>'
+}
+
if [[ $1 ]]; then
if [[ $1 = -@(h|-help) ]]; then
- printf 'usage: %s [pacman log]\n' "${0##*/}"
- printf 'example: %s @localstatedir@/log/pacman.log\n' "${0##*/}"
- printf '\ndefaults to: @localstatedir@/log/pacman.log\n'
+ usage
+ exit 0
+ elif [[ $1 = -@(V|-version) ]]; then
+ version
exit 0
elif [[ ! -e $logfile ]]; then
printf $"target not found: %s\n" "$1"
diff --git a/contrib/pacscripts.in b/contrib/pacscripts.in
index 37d3feae..84687145 100755
--- a/contrib/pacscripts.in
+++ b/contrib/pacscripts.in
@@ -24,8 +24,8 @@
set -o nounset
set -o errexit
-progname=$(basename $0)
-progver="0.4"
+declare -r myname='pacscripts'
+declare -r myver='@PACKAGE_VERSION@'
conf="@sysconfdir@/pacman.conf"
@@ -47,14 +47,20 @@ error() {
usage() {
echo "This program prints out the {pre,post}_{install,remove,upgrade} scripts"
echo "of a given package."
- echo "Usage: $progname pkgname|pkgfile"
+ echo "Usage: $myname pkgname|pkgfile"
echo
echo " OPTIONS:"
echo " -h, --help Print this help message"
echo " -v, --version Print program name and version"
echo
- echo "Example: $progname gconf-editor"
- echo "Example: $progname gconf-editor-2.24.1-1-x86_64.pkg.tar.gz"
+ echo "Example: $myname gconf-editor"
+ echo "Example: $myname gconf-editor-2.24.1-1-x86_64.pkg.tar.gz"
+}
+
+version() {
+ printf "%s %s\n" "$myname" "$myver"
+ echo 'Copyright (c) 2009 Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>'
+ echo 'Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>'
}
spacman() {
@@ -127,6 +133,6 @@ fi
case "$1" in
--help|-h) usage; exit 0 ;;
- --version|-v) echo "$progname version $progver"; exit 0 ;;
+ --version|-V) version; exit 0 ;;
*) print_scriptlet $1 ;;
esac
diff --git a/contrib/pacsearch.in b/contrib/pacsearch.in
index db9d6ad1..b1db8abe 100755
--- a/contrib/pacsearch.in
+++ b/contrib/pacsearch.in
@@ -24,22 +24,32 @@
use strict;
use warnings;
-my $progname = "pacsearch";
-my $version = "2.0";
+my $myname = 'pacsearch';
+my $myver = '@PACKAGE_VERSION@';
+
+sub usage {
+ print "$myname - Add color and install information to a pacman -Ss search\n";
+ print "Usage: $myname <pattern>\n";
+ print "Example: $myname ^gnome\n";
+}
+
+sub version {
+ printf "%s %s\n", $myname, $myver;
+ print "Copyright (C) 2008-2011 Dan McGee <dan\@archlinux.org>\n\n";
+ print "Based off original shell script version:\n";
+ print "Copyright (C) 2006-2007 Dan McGee <dan\@archlinux.org>\n";
+}
if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
- print "$progname - Add color and install information to a pacman -Ss search\n";
- print "Usage: $progname <pattern>\n";
- print "Example: $progname ^gnome\n";
+ usage;
if ($#ARGV lt 0) {
exit 1;
}
exit 0;
}
-if ($ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
- print "$progname version $version\n";
- print "Copyright (C) 2006-2011 Dan McGee\n";
+if ($ARGV[0] eq "--version" || $ARGV[0] eq "-V") {
+ version;
exit 0;
}
diff --git a/contrib/pacsysclean.in b/contrib/pacsysclean.in
index c87082e0..17f7681b 100755
--- a/contrib/pacsysclean.in
+++ b/contrib/pacsysclean.in
@@ -2,23 +2,32 @@
# pacsysclean - Sort installed packages by decreasing installed size. Useful for system clean-up.
+declare -r myname='pacsysclean'
+declare -r myver='@PACKAGE_VERSION@'
+
PACMAN_OPTS=
usage() {
- echo "pacsysclean - Sort installed packages by decreasing installed size."
+ echo "$myname - Sort installed packages by decreasing installed size."
echo
- echo "Usage: pacsysclean [options]"
+ echo "Usage: $myname [options]"
echo
echo "Options:"
echo " -o <options> Specify custom pacman query options (e.g., dt)"
echo " -h, --help Show this help message and exit"
}
+version() {
+ printf "%s %s\n" "$myname" "$myver"
+ echo 'Copyright (C) 2011 Eric BĂ©langer <snowmaniscool@gmail.com>'
+}
+
if [ -n "$1" ]; then
case "$1" in
-o) PACMAN_OPTS="${2}" ;;
-h|--help) usage; exit 0 ;;
+ -V|--version) version; exit 0 ;;
*) usage; exit 1 ;;
esac
fi
diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in
index 2cfc946c..b30e9600 100644
--- a/contrib/zsh_completion.in
+++ b/contrib/zsh_completion.in
@@ -32,8 +32,8 @@ _pacman_opts_common=(
# options for passing to _arguments: options for --upgrade commands
_pacman_opts_pkgfile=(
'-d[Skip dependency checks]'
- '-f[Overwrite conflicting files]'
'--dbonly[Only remove database entry, do not remove files]'
+ '--force[Overwrite conflicting files]'
'--needed[Do not reinstall up to date packages]'
'--recursive[Reinstall all dependencies of target packages]'
'*:package file:_files -g "*.pkg.tar*(.)"'
@@ -85,7 +85,6 @@ _pacman_opts_sync_actions=(
# options for passing to _arguments: options for --sync command
_pacman_opts_sync_modifiers=(
'-d[Skip dependency checks]'
- '-f[Overwrite conflicting files]'
'-i[View package information]'
'-l[List all packages in a repository]'
'-p[Print download URIs for each package to be installed]'
@@ -98,6 +97,7 @@ _pacman_opts_sync_modifiers=(
_pacman_completions_all_groups'
'--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]'
+ '--force[Overwrite conflicting files]'
)
# handles --help subcommand