summaryrefslogtreecommitdiffstats
path: root/source/a/pkgtools/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/pkgtools/scripts')
-rw-r--r--source/a/pkgtools/scripts/installpkg18
-rw-r--r--source/a/pkgtools/scripts/removepkg22
2 files changed, 29 insertions, 11 deletions
diff --git a/source/a/pkgtools/scripts/installpkg b/source/a/pkgtools/scripts/installpkg
index f334728c6..f19cf59c0 100644
--- a/source/a/pkgtools/scripts/installpkg
+++ b/source/a/pkgtools/scripts/installpkg
@@ -1,7 +1,7 @@
#!/bin/sh
# Copyright 1994, 1998, 2000 Patrick Volkerding, Concord, CA, USA
# Copyright 2001, 2003 Slackware Linux, Inc., Concord, CA, USA
-# Copyright 2007, 2009, 2011, 2017, 2018, 2019 Patrick Volkerding, Sebeka, MN, USA
+# Copyright 2007, 2009, 2011, 2017, 2018, 2019, 2020 Patrick Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,6 +21,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+# Wed Apr 1 21:59:41 UTC 2020
+# If the package contains /install/douninst.sh, copy the uninstall script to
+# $ADM_DIR/douninst.sh/$shortname and add the filename to the package list
+# in $ADM_DIR/packages/$shortname.
+#
# Fri Oct 4 06:04:39 UTC 2019
# Add support for --no-overwrite so that upgradepkg can be kind to SSDs.
#
@@ -281,7 +286,7 @@ ADM_DIR="$ROOT/var/lib/pkgtools"
LOG_DIR="$ROOT/var/log/pkgtools"
# If the directories don't exist, "initialize" the package database:
-for PKGDBDIR in packages scripts setup ; do
+for PKGDBDIR in douninst.sh packages scripts setup ; do
if [ ! -d $ADM_DIR/$PKGDBDIR ]; then
mkdir -p $ADM_DIR/$PKGDBDIR
chmod 755 $ADM_DIR/$PKGDBDIR
@@ -697,9 +702,14 @@ EOF
cp $ROOT/$INSTDIR/doinst.sh $ADM_DIR/scripts/$shortname
chmod 755 $ADM_DIR/scripts/$shortname
fi
- # /install/doinst.sh and /install/slack-* are reserved locations for the package system.
+ if [ -r $ROOT/$INSTDIR/douninst.sh ]; then
+ cp $ROOT/$INSTDIR/douninst.sh $ADM_DIR/douninst.sh/$shortname
+ chmod 755 $ADM_DIR/douninst.sh/$shortname
+ echo "$(echo $ADM_DIR | rev | cut -f 1-3 -d / | rev)/douninst.sh/$shortname" >> $ADM_DIR/packages/$shortname
+ fi
+ # /install/do*inst.sh and /install/slack-* are reserved locations for the package system.
# Heh, not any more with a recent tar :-)
- ( cd $ROOT/$INSTDIR ; rm -f doinst.sh slack-* 1> /dev/null 2>&1 )
+ ( cd $ROOT/$INSTDIR ; rm -f do*inst.sh slack-* 1> /dev/null 2>&1 )
rmdir $ROOT/$INSTDIR 1> /dev/null 2>&1
fi
# If we used a scan directory, get rid of it:
diff --git a/source/a/pkgtools/scripts/removepkg b/source/a/pkgtools/scripts/removepkg
index 0166a59bd..5a1c7dcdd 100644
--- a/source/a/pkgtools/scripts/removepkg
+++ b/source/a/pkgtools/scripts/removepkg
@@ -24,6 +24,10 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+# Wed Apr 1 22:14:46 UTC 2020
+# Add --skip-douninst option to skip running the uninstall script.
+# Save removed uninstall scripts in /var/log/removed_uninstall_scripts.
+#
# 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
@@ -252,7 +256,9 @@ delete_files() {
preserve_file "$FILE"
fi
else
- ! [ $TERSE ] && echo " --> $ROOT/$FILE no longer exists. Skipping."
+ if [ "$(echo $FILE | cut -b1-8)" != "install/" ]; then
+ ! [ $TERSE ] && echo " --> $ROOT/$FILE no longer exists. Skipping."
+ fi
fi
else
preserve_dir "$FILE"
@@ -337,9 +343,9 @@ remove_packages() {
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
+ if [ -r $ADM_DIR/douninst.sh/$PKGNAME -a ! "$SKIP_DOUNINST" = "true" ]; then
cp -a $ADM_DIR/douninst.sh/$PKGNAME $TMP/$PKGNAME
- elif [ -r $ADM_DIR/douninst.sh/$(echo ${PKGNAME} | sed "s/-upgraded.*//") ]; then
+ elif [ -r $ADM_DIR/douninst.sh/$(echo ${PKGNAME} | sed "s/-upgraded.*//") -a ! "$SKIP_DOUNINST" = "true" ]; then
cp -a $ADM_DIR/douninst.sh/$(echo ${PKGNAME} | sed "s/-upgraded.*//") $TMP/$PKGNAME
else
rm -f $TMP/$PKGNAME
@@ -391,8 +397,8 @@ remove_packages() {
if [ ! "$WARN" = "true" ]; then
# We won't assume that anything in /var/log can be trusted to remain there,
# 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
+ mkdir -p $LOG_DIR/removed_packages $LOG_DIR/removed_scripts $LOG_DIR/removed_uninstall_scripts
+ for symlink in removed_packages removed_scripts removed_uninstall_scripts ; do
if [ ! -L $LOG_DIR/../$symlink ]; then
rm -rf $LOG_DIR/../$symlink
( cd $LOG_DIR/.. ; ln -sf pkgtools/$symlink . )
@@ -406,7 +412,8 @@ remove_packages() {
# If there is an uninstall script, run it here:
if [ -r $TMP/$PKGNAME ]; then
cd $ROOT/ ; sh $TMP/$PKGNAME
- rm -f $TMP/$PKGNAME
+ # Move the uninstall script to $LOG_DIR/removed_uninstall_scripts:
+ mv $TMP/$PKGNAME $LOG_DIR/removed_uninstall_scripts
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:
@@ -423,7 +430,7 @@ remove_packages() {
}
if [ "$#" = "0" ]; then
- echo "Usage: $(basename $0) [--copy] [--keep] [--preserve] [--terse] [--warn] packagename ..."; exit 1
+ echo "Usage: $(basename $0) [--copy] [--keep] [--preserve] [--skip-douninst] [--terse] [--warn] packagename ..."; exit 1
fi
while : ; do
@@ -431,6 +438,7 @@ while : ; do
-copy | --copy) WARN=true; PRESERVE=true; shift;;
-keep | --keep) KEEP=true; shift;;
-preserve | --preserve) PRESERVE=true; shift;;
+ -skip-douninst | --skip-douninst) SKIP_DOUNINST=true; shift;;
-terse | --terse) TERSE=0; shift;;
-warn | --warn) WARN=true; shift;;
-* | --*) echo "Usage: $(basename $0) [-copy] [-keep] [-preserve] [-warn] packagename ..."; exit 1;;