summaryrefslogtreecommitdiffstats
path: root/contrib/pacscripts.sh.in
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2016-10-09 14:52:27 +0200
committerAllan McRae <allan@archlinux.org>2016-10-10 02:38:05 +0200
commit0c99eabd50752310f42ec808c8734a338122ec86 (patch)
tree499801a8c046001ddab0b11439e9e948b257d726 /contrib/pacscripts.sh.in
parent2e76c184aac74c4848fa5ee092fe54c9954c4054 (diff)
downloadpacman-0c99eabd50752310f42ec808c8734a338122ec86.tar.gz
pacman-0c99eabd50752310f42ec808c8734a338122ec86.tar.xz
Remove contrib
The contrib directory takes too much of the pacman developer's limited time, which could be better spent developing and reviewing patches for the primary projects. The community can pick this up in a separate repository if wanted. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'contrib/pacscripts.sh.in')
-rw-r--r--contrib/pacscripts.sh.in140
1 files changed, 0 insertions, 140 deletions
diff --git a/contrib/pacscripts.sh.in b/contrib/pacscripts.sh.in
deleted file mode 100644
index 4a1e0c50..00000000
--- a/contrib/pacscripts.sh.in
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/bin/bash
-#
-# pacscripts : tries to print out the {pre,post}_{install,remove,upgrade}
-# scripts of a given package
-#
-# Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>
-# Copyright (c) 2009-2016 Pacman Development Team <pacman-dev@archlinux.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-# bash options
-set -o nounset
-set -o errexit
-
-declare -r myname='pacscripts'
-declare -r myver='@PACKAGE_VERSION@'
-
-conf="@sysconfdir@/pacman.conf"
-
-if [ ! -r "$conf" ]; then
- echo "ERROR: unable to read $conf"
- exit 1
-fi
-
-eval $(awk '/DBPath/ {print $1$2$3}' "$conf")
-eval $(awk '/CacheDir/ {print $1$2$3}' "$conf")
-pac_db="${DBPath:-@localstatedir@/lib/pacman}/local"
-pac_cache="${CacheDir:-@localstatedir@/cache/pacman/pkg}"
-
-error() {
- local mesg=$1; shift
- printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2
-}
-
-usage() {
- echo "${myname} (pacman) v${myver}"
- echo
- echo "Prints the {pre,post}_{install,remove,upgrade} scripts of a given package."
- echo
- 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: ${myname} gconf-editor"
- echo "Example: ${myname} gconf-editor-3.0.1-3-x86_64.pkg.tar.xz"
-}
-
-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() {
- if [ $EUID -eq 0 ]; then
- pacman "$@"
- else
- if ! type -p sudo; then
- error "Cannot find the sudo binary!"
- error "${myname} requires root privileges. Either install \"sudo\" or run as root."
- exit 1
- else
- sudo pacman "$@"
- fi
- fi
-}
-
-print_db() {
- pkg=$(pacman -Q "$1")
- pkg=${pkg/ /-}
- if [ -f $pac_db/$pkg*/install ]; then
- cat $pac_db/$pkg*/install
- echo
- return 0
- else
- error "Package $1 does not include any .INSTALL script"
- return 1
- fi
-}
-
-print_pkg() {
- if ! bsdtar -xqOf "$1" .INSTALL 2>/dev/null; then
- error "Package $1 does not include any .INSTALL script"
- return 1
- fi
- echo
-}
-
-print_scriptlet() {
- if [ -f "$1" ]; then
- if bsdtar tf "$1" .PKGINFO &>/dev/null; then
- print_pkg "$1"
- return
- fi
- fi
- if pacman -Q "$1" &>/dev/null; then
- print_db "$1"
- return
- fi
- if ! pacman -Si $1 &>/dev/null; then
- error "Package $1 not found"
- return 1
- fi
- url=$(pacman -Sddp $1)
- filename=$(basename $url)
- if [ ! -f "$pac_cache/$filename" ]; then
- if ! spacman -Sddw --noconfirm $1 >&2; then
- error "Failed to download $1"
- return 1
- fi
- echo >&2
- fi
- print_pkg "$pac_cache/$filename"
- return
-}
-
-if [ $# -ne 1 ] ; then
- usage
- exit 1
-fi
-
-case "$1" in
- --help|-h) usage; exit 0 ;;
- --version|-V) version; exit 0 ;;
- *) print_scriptlet $1 ;;
-esac