summaryrefslogtreecommitdiff
path: root/source/a
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2020-03-31 04:00:43 +0000
committerEric Hameleers <alien@slackware.com>2020-03-31 08:59:49 +0200
commitc53350a4854e6d348955bdc9a5ca27b3a7a44756 (patch)
tree3dd9b1864d314a7f4ef6d6764bc79d28ab28d7fe /source/a
parent4f2bf4aab6138916c8b1a2db874c95d92d89703b (diff)
downloadcurrent-c53350a4854e6d348955bdc9a5ca27b3a7a44756.tar.gz
Tue Mar 31 04:00:43 UTC 202020200331040043
a/pkgtools-15.0-noarch-31.txz: Rebuilt. removepkg: support an uninstall script. See removepkg(8). d/meson-0.54.0-x86_64-1.txz: Upgraded.
Diffstat (limited to 'source/a')
-rw-r--r--source/a/pkgtools/manpages/removepkg.810
-rwxr-xr-xsource/a/pkgtools/pkgtools.SlackBuild4
-rw-r--r--source/a/pkgtools/scripts/removepkg44
3 files changed, 42 insertions, 16 deletions
diff --git a/source/a/pkgtools/manpages/removepkg.8 b/source/a/pkgtools/manpages/removepkg.8
index f92ed8c2..58a88ce6 100644
--- a/source/a/pkgtools/manpages/removepkg.8
+++ b/source/a/pkgtools/manpages/removepkg.8
@@ -70,9 +70,17 @@ you do this (and maybe pipe the output to
) before removing packages to make sure you've backed up anything that might
be important.
.LP
-When removing a package, it's original file index will be moved from
+When removing a package, its original file index will be moved from
/var/lib/pkgtools/packages to /var/log/pkgtools/removed_packages. Likewise, its installation
script will be moved from /var/lib/pkgtools/scripts to /var/log/pkgtools/removed_scripts.
+.LP
+.B removepkg
+supports /bin/sh compatible uninstall scripts.
+If the package shipped with an uninstall script, it will be run after the package
+is removed. If present, the uninstall script resides in the /var/lib/pkgtools/douninst.sh/
+directory and has the same full name as the package (without the extension). For example,
+a package named foo-1.0-noarch-1.txz might contain an uninstall script named:
+/var/lib/pkgtools/douninst.sh/foo-1.0-noarch-1
.SH OPTIONS
.TP
.B \--copy packagename
diff --git a/source/a/pkgtools/pkgtools.SlackBuild b/source/a/pkgtools/pkgtools.SlackBuild
index f0bf5c78..37315121 100755
--- a/source/a/pkgtools/pkgtools.SlackBuild
+++ b/source/a/pkgtools/pkgtools.SlackBuild
@@ -30,7 +30,7 @@ PKGNAM=pkgtools
# *** UPDATE THESE WITH EACH BUILD:
VERSION=15.0
ARCH=${ARCH:-noarch}
-BUILD=${BUILD:-30}
+BUILD=${BUILD:-31}
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
@@ -92,7 +92,7 @@ mkdir -p $PKG
)
# Create the base directories (not really necessary, but doesn't hurt):
-mkdir -p $PKG/var/lib/pkgtools/{packages,scripts}
+mkdir -p $PKG/var/lib/pkgtools/{packages,scripts,douninst.sh}
mkdir -p $PKG/var/log/pkgtools/{removed_packages,removed_scripts}
mkdir -p $PKG/install
diff --git a/source/a/pkgtools/scripts/removepkg b/source/a/pkgtools/scripts/removepkg
index d94031dc..0166a59b 100644
--- a/source/a/pkgtools/scripts/removepkg
+++ b/source/a/pkgtools/scripts/removepkg
@@ -3,7 +3,7 @@
#
# Copyright 1994, 1995, 1998 Patrick Volkerding, Moorhead, Minnesota USA
# Copyright 2001, Slackware Linux, Inc., Concord, CA USA
-# Copyright 2009, 2015, 2016, 2018 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2009, 2015, 2016, 2018, 2020 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -24,6 +24,12 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+# Tue Mar 31 03:06:25 UTC 2020
+# Support an uninstall script to be executed when the package is removed.
+# The script should be a standard sh script with the same name as the package
+# (without the .txz or other extension), and should be installed in
+# /var/lib/pkgtools/douninst.sh.
+#
# Tue Jun 5 20:04:45 UTC 2018
# Use /var/lib/pkgtools for the package database, not /var/log.
# Logs of the removed packages and scripts will remain in /var/log, but moved
@@ -327,10 +333,17 @@ remove_packages() {
fi
popd > /dev/null
fi
-
if [ -r $ADM_DIR/packages/$PKGNAME ]; then
if [ ! "$WARN" = true ]; then
echo "Removing package: $(basename $ADM_DIR/packages/$PKGNAME)"
+ # If there's an uninstall script, save it:
+ if [ -r $ADM_DIR/douninst.sh/$PKGNAME ]; then
+ cp -a $ADM_DIR/douninst.sh/$PKGNAME $TMP/$PKGNAME
+ elif [ -r $ADM_DIR/douninst.sh/$(echo ${PKGNAME} | sed "s/-upgraded.*//") ]; then
+ cp -a $ADM_DIR/douninst.sh/$(echo ${PKGNAME} | sed "s/-upgraded.*//") $TMP/$PKGNAME
+ else
+ rm -f $TMP/$PKGNAME
+ fi
fi
if fgrep "./" $ADM_DIR/packages/$PKGNAME 1> /dev/null 2>&1; then
TRIGGER="^\.\/"
@@ -380,27 +393,32 @@ remove_packages() {
# so we'll remake the directories and symlinks first:
mkdir -p $LOG_DIR/removed_packages $LOG_DIR/removed_scripts
for symlink in removed_packages removed_scripts ; do
- if [ ! -L $LOG_DIR/../$symlink ]; then
- rm -rf $LOG_DIR/../$symlink
- ( cd $LOG_DIR/.. ; ln -sf pkgtools/$symlink . )
- fi
+ if [ ! -L $LOG_DIR/../$symlink ]; then
+ rm -rf $LOG_DIR/../$symlink
+ ( cd $LOG_DIR/.. ; ln -sf pkgtools/$symlink . )
+ fi
done
# Now that we know we have log directories, move the files:
mv $ADM_DIR/packages/$PKGNAME $LOG_DIR/removed_packages
if [ -r $ADM_DIR/scripts/$PKGNAME ]; then
mv $ADM_DIR/scripts/$PKGNAME $LOG_DIR/removed_scripts
fi
+ # If there is an uninstall script, run it here:
+ if [ -r $TMP/$PKGNAME ]; then
+ cd $ROOT/ ; sh $TMP/$PKGNAME
+ rm -f $TMP/$PKGNAME
+ fi
+ # In the case where a library and symlink are removed but an earlier version
+ # remains on the machine, this will link it up and save potential problems:
+ if [ "$ROOT" = "" ] && [ -x /sbin/ldconfig ]; then
+ ( flock 9 || exit 11
+ /sbin/ldconfig 2> /dev/null
+ ) 9> $INSTLOCKDIR/ldconfig.lock
+ fi
fi
else
echo "No such package: $(basename $ADM_DIR/packages/$PKGNAME). Can't remove."
fi
- # In the case where a library and symlink are removed but an earlier version
- # remains on the machine, this will link it up and save potential problems:
- if [ "$ROOT" = "" ] && [ -x /sbin/ldconfig ]; then
- ( flock 9 || exit 11
- /sbin/ldconfig 2> /dev/null
- ) 9> $INSTLOCKDIR/ldconfig.lock
- fi
done
}