diff options
author | Patrick J Volkerding <volkerdi@slackware.com> | 2018-06-21 22:58:42 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2018-06-22 09:00:34 +0200 |
commit | ca85aab95397ae918088f8ba2195eb4eb996c739 (patch) | |
tree | 53c83f5d50354f163eeab5dd11c8ba109be9e291 /source/a/pkgtools | |
parent | b893b1174dfcd0fdc84aa597eee76b797d6d7b11 (diff) | |
download | current-ca85aab95397ae918088f8ba2195eb4eb996c739.tar.gz |
Thu Jun 21 22:58:42 UTC 201820180621225842
a/pkgtools-15.0-noarch-20.txz: Rebuilt.
Move pkgtools database to /var/lib/pkgtools/.
Move removed logs to /var/log/pkgtools/.
a/sysvinit-2.90-x86_64-1.txz: Upgraded.
ap/cups-filters-1.20.3-x86_64-3.txz: Rebuilt.
Recompiled against poppler-0.66.0.
kde/calligra-2.9.11-x86_64-22.txz: Rebuilt.
Recompiled against poppler-0.66.0.
l/dbus-python-1.2.8-x86_64-1.txz: Upgraded.
l/gc-7.6.6-x86_64-1.txz: Upgraded.
l/harfbuzz-1.8.1-x86_64-1.txz: Upgraded.
l/poppler-0.66.0-x86_64-1.txz: Upgraded.
Shared library .so-version bump.
l/pulseaudio-12.0-x86_64-1.txz: Upgraded.
n/dhcpcd-7.0.6-x86_64-1.txz: Upgraded.
n/php-7.2.7-x86_64-1.txz: Upgraded.
Added support for libedit.
t/texlive-2017.171108-x86_64-7.txz: Rebuilt.
Recompiled against poppler-0.66.0.
x/libwacom-0.30-x86_64-1.txz: Upgraded.
xfce/exo-0.12.2-x86_64-1.txz: Upgraded.
xfce/tumbler-0.2.1-x86_64-4.txz: Rebuilt.
Recompiled against poppler-0.66.0.
xfce/xfce4-settings-4.12.4-x86_64-1.txz: Upgraded.
Diffstat (limited to 'source/a/pkgtools')
-rw-r--r-- | source/a/pkgtools/doinst.sh | 69 | ||||
-rw-r--r-- | source/a/pkgtools/manpages/explodepkg.8 | 2 | ||||
-rw-r--r-- | source/a/pkgtools/manpages/installpkg.8 | 2 | ||||
-rw-r--r-- | source/a/pkgtools/manpages/makepkg.8 | 8 | ||||
-rw-r--r-- | source/a/pkgtools/manpages/removepkg.8 | 10 | ||||
-rwxr-xr-x | source/a/pkgtools/pkgtools.SlackBuild | 19 | ||||
-rw-r--r-- | source/a/pkgtools/scripts/explodepkg | 4 | ||||
-rw-r--r-- | source/a/pkgtools/scripts/installpkg | 32 | ||||
-rw-r--r-- | source/a/pkgtools/scripts/makebootdisk | 2 | ||||
-rw-r--r-- | source/a/pkgtools/scripts/pkgtool | 15 | ||||
-rw-r--r-- | source/a/pkgtools/scripts/removepkg | 31 | ||||
-rw-r--r-- | source/a/pkgtools/scripts/setup.80.make-bootdisk | 2 | ||||
-rw-r--r-- | source/a/pkgtools/scripts/setup.services | 2 | ||||
-rw-r--r-- | source/a/pkgtools/scripts/upgradepkg | 28 |
14 files changed, 178 insertions, 48 deletions
diff --git a/source/a/pkgtools/doinst.sh b/source/a/pkgtools/doinst.sh new file mode 100644 index 00000000..d14a6787 --- /dev/null +++ b/source/a/pkgtools/doinst.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# Migrate the package database and related directories from the long-time +# (stupid) directory /var/log to /var/lib/pkgtools. +# +# The removed_* directories will remain under /var/log (but moved to +# /var/log/pkgtools) as they contain log files of previous operations, +# not anything that's actively used for package management. Also, the +# removed_* directories can become quite large compared with the database. +# +# First, if it's just a case of missing symlinks, make them. Don't make them +# if the directories exist in /var/log - we'll do a proper migration in that +# case. +for directory in packages scripts setup ; do + if [ ! -L var/log/$directory -a ! -d var/log/$directory ]; then + if [ -d var/lib/pkgtools/$directory ]; then + # Make the symlink: + ( cd var/log ; ln -sf ../lib/pkgtools/$directory . ) + fi + fi +done +for directory in removed_packages removed_scripts ; do + if [ ! -L var/log/$directory -a ! -d var/log/$directory ]; then + mkdir -p var/log/pkgtools/$directory + ( cd var/log ; ln -sf pkgtools/$directory . ) + fi + if [ ! -L var/lib/pkgtools/$directory -a ! -d var/lib/pkgtools/$directory ]; then + mkdir -p var/lib/pkgtools + ( cd var/lib/pkgtools ; ln -sf ../../log/pkgtools/$directory . ) + fi +done +# If at this point /var/log/packages is not a symlink, we need to do the +# migration. We should already have a lock on being the only install script +# that's currently running, but also get a lock on ldconfig to freeze any +# other package operations that are happening now until after the migration +# is complete. +if [ ! -L var/log/packages ]; then + if [ ! -d run/lock/pkgtools ]; then + mkdir -p run/lock/pkgtools + fi + ( flock 9 || exit 11 + # Don't migrate if tar is running, as there may still be package operations + # going on in another process: + while pidof tar 1> /dev/null 2> /dev/null ; do + sleep 15 + done + # Just to be a bit safer from race conditions: + sleep 5 + # First, move the removed_* directories into a pkgtools subdirectory: + mkdir -p var/log/pkgtools + for directory in removed_packages removed_scripts ; do + if [ ! -d var/log/pkgtools/$directory ]; then + mkdir -p var/log/pkgtools/$directory + # Move anything found in the old location, then remove it: + mv var/log/$directory/* var/log/pkgtools/$directory 2> /dev/null + rm -rf var/log/$directory + # Make a symlink: + ( cd var/log ; ln -sf pkgtools/$directory . ) + fi + done + for directory in packages scripts setup ; do + mkdir -p var/lib/pkgtools/$directory + mv var/log/$directory/* var/lib/pkgtools/$directory 2> /dev/null + rm -rf var/log/$directory + ( cd var/log + ln -sf ../lib/pkgtools/$directory . + ) + done + ) 9> run/lock/pkgtools/ldconfig.lock +fi diff --git a/source/a/pkgtools/manpages/explodepkg.8 b/source/a/pkgtools/manpages/explodepkg.8 index 3e11fddc..ddc3d47c 100644 --- a/source/a/pkgtools/manpages/explodepkg.8 +++ b/source/a/pkgtools/manpages/explodepkg.8 @@ -25,7 +25,7 @@ uncompresses and untars Slackware *.tgz (or .tbz, .tlz, .txz) packages (or any a that was created by compressing a tarfile with one of the supported compression utilities) in the current directory. It is not usually used to install packages, since it doesn't execute the installation scripts -in ./install or ./var/log/setup. The primary use for +in ./install or ./var/lib/pkgtools/setup. The primary use for .B explodepkg is in package maintenance - exploding a package in a subdirectory, making fixes to it or upgrading the software, and then building the updated package with diff --git a/source/a/pkgtools/manpages/installpkg.8 b/source/a/pkgtools/manpages/installpkg.8 index f06e611d..204cc841 100644 --- a/source/a/pkgtools/manpages/installpkg.8 +++ b/source/a/pkgtools/manpages/installpkg.8 @@ -61,7 +61,7 @@ not actually install the package. The list is formatted in a suitable fashion t use as a list of files to backup. .TP .B \--md5sum packagename -Record the package md5sum in the metadata written in /var/log/packages. +Record the package md5sum in the metadata written in /var/lib/pkgtools/packages. .TP .B \--root /otherroot Install using a location other than / (the default) as the root of the diff --git a/source/a/pkgtools/manpages/makepkg.8 b/source/a/pkgtools/manpages/makepkg.8 index 0f239a9b..16a98f3f 100644 --- a/source/a/pkgtools/manpages/makepkg.8 +++ b/source/a/pkgtools/manpages/makepkg.8 @@ -110,11 +110,11 @@ or The second type of script is the .B configuration script. This is found in the subdirectory -.B ./var/log/setup +.B ./var/lib/pkgtools/setup and must have a name that starts with .B setup. in order to be recongnized. An example is the timezone script: -.B /var/log/setup/setup.timeconfig. +.B /var/lib/pkgtools/setup/setup.timeconfig. These scripts are executed during the .B CONFIGURE phase of @@ -136,13 +136,13 @@ script. Like the name suggests, these are executed only once after the package is installed, in contrast to the standard .B configuration script. These scripts are also found in the -.B ./var/log/setup +.B ./var/lib/pkgtools/setup directory and must have a name that starts with .B setup., but in addition the name must contain the string .B onlyonce. An example might be a script with the name -.B /var/log/setup/setup.onlyonce.testscript +.B /var/lib/pkgtools/setup/setup.onlyonce.testscript .SH PACKAGE FORMAT .B makepkg uses GNU tar plus GNU gzip to create its packages. A simple way to diff --git a/source/a/pkgtools/manpages/removepkg.8 b/source/a/pkgtools/manpages/removepkg.8 index d6be202c..f92ed8c2 100644 --- a/source/a/pkgtools/manpages/removepkg.8 +++ b/source/a/pkgtools/manpages/removepkg.8 @@ -38,7 +38,7 @@ removepkg \- remove Slackware packages. .B removepkg removes a previously installed Slackware package, while writing a progress report to the standard output. A package may be specified either by the -full package name (as you'd see listed in /var/log/packages/), or by the +full package name (as you'd see listed in /var/lib/pkgtools/packages/), or by the base package name. For example, the package foo-1.0-i586-1.txz may be removed with any of the following commands: @@ -71,12 +71,12 @@ you do this (and maybe pipe the output to be important. .LP When removing a package, it's original file index will be moved from -/var/log/packages to /var/log/removed_packages. Likewise, it's installation -script will be moved from /var/log/scripts to /var/log/removed_scripts. +/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. .SH OPTIONS .TP .B \--copy packagename -Construct a copy of the package under /var/log/setup/tmp/preserved_packages/packagename, +Construct a copy of the package under /var/lib/pkgtools/setup/tmp/preserved_packages/packagename, but don't remove it. (same effect as \-warn \-preserve) .TP .B \--keep @@ -86,7 +86,7 @@ required_list). Mostly useful for debugging purposes. .TP .B \--preserve packagename If specified, the complete package subtree is reconstructed in -/var/log/setup/tmp/preserved_packages/packagename. +/var/lib/pkgtools/setup/tmp/preserved_packages/packagename. .TP .B \--terse Remove the package displaying only a single description line to stdout. diff --git a/source/a/pkgtools/pkgtools.SlackBuild b/source/a/pkgtools/pkgtools.SlackBuild index 0937267d..bdcb11ac 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:-19} +BUILD=${BUILD:-20} # 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 @@ -80,19 +80,24 @@ mkdir -p $PKG chown root:root $PKG/sbin/* chmod 755 $PKG/sbin/* # These scripts are used during the installation: - mkdir -p $PKG/var/log/setup/tmp - chmod 700 $PKG/var/log/setup/tmp + mkdir -p $PKG/var/lib/pkgtools/setup/tmp + chmod 700 $PKG/var/lib/pkgtools/setup/tmp for file in setup.* ; do - cp -a $file $PKG/var/log/setup + cp -a $file $PKG/var/lib/pkgtools/setup done - chown root:root $PKG/var/log/setup/setup.* - chmod 755 $PKG/var/log/setup/setup.* + chown root:root $PKG/var/lib/pkgtools/setup/setup.* + chmod 755 $PKG/var/lib/pkgtools/setup/setup.* # Add a link for makebootstick: - ( cd $PKG/sbin ; ln -sf ../var/log/setup/setup.80.make-bootdisk makebootstick ) + ( cd $PKG/sbin ; ln -sf ../var/lib/pkgtools/setup/setup.80.make-bootdisk makebootstick ) ) +# Create the base directories (not really necessary, but doesn't hurt): +mkdir -p $PKG/var/lib/pkgtools/{packages,scripts} +mkdir -p $PKG/var/log/pkgtools/{removed_packages,removed_scripts} + mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc +zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh # Build the package: cd $PKG diff --git a/source/a/pkgtools/scripts/explodepkg b/source/a/pkgtools/scripts/explodepkg index e1f9b128..72c013d4 100644 --- a/source/a/pkgtools/scripts/explodepkg +++ b/source/a/pkgtools/scripts/explodepkg @@ -32,8 +32,8 @@ Equivalent to (for each package listed): ( umask 000 ; cat package_name | COMPRESSOR -dc | tar xpvf package_name ) Note: This should only be used for debugging or examining packages, not for -installing them. It doesn't execute installation scripts or update the package -indexes in /var/log/packages and /var/log/scripts. +installing them. It doesn't execute installation scripts or update the package +indexes in /var/lib/pkgtools/packages and /var/lib/pkgtools/scripts. EOF fi diff --git a/source/a/pkgtools/scripts/installpkg b/source/a/pkgtools/scripts/installpkg index b777442a..0d82f89c 100644 --- a/source/a/pkgtools/scripts/installpkg +++ b/source/a/pkgtools/scripts/installpkg @@ -21,6 +21,15 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +# Mon Jun 4 21:17:58 UTC 2018 +# Migrate the package database and directories from /var/log to +# /var/lib/pkgtools. /var/log was never a good place for this data, as it is +# considered by many to be a directory that could be wiped to free up some +# space. Originally the package database was in /var/adm, but the FSSTND +# (later FHS) group decided that directory should be a symlink to /var/log, +# and I went along with that since it was years ago and I was a n00b and didn't +# know any better. /var/lib/pkgtools will be a better and safer location. +# # Thu May 24 20:23:55 UTC 2018 # Added --terselength option to set the line length in --terse mode. # Allow adding NOLOCK in an install script to allow it to run without locking. @@ -254,14 +263,33 @@ while [ 0 ]; do done # Set the prefix for the package database directories (packages, scripts). -ADM_DIR="$ROOT/var/log" +ADM_DIR="$ROOT/var/lib/pkgtools" + +# Set the prefix for the removed packages/scripts log files: +LOG_DIR="$ROOT/var/log/pkgtools" + # If the directories don't exist, "initialize" the package database: -for PKGDBDIR in packages removed_packages removed_scripts scripts setup ; do +for PKGDBDIR in packages scripts setup ; do if [ ! -d $ADM_DIR/$PKGDBDIR ]; then mkdir -p $ADM_DIR/$PKGDBDIR chmod 755 $ADM_DIR/$PKGDBDIR fi done +for PKGLOGDIR in removed_packages removed_scripts ; do + if [ ! -d $LOG_DIR/$PKGLOGDIR ]; then + rm -rf $LOG_DIR/$PKGLOGDIR # make sure it's not a symlink or something stupid + mkdir -p $LOG_DIR/$PKGLOGDIR + chmod 755 $LOG_DIR/$PKGLOGDIR + fi +done +# Likewise, make sure that the symlinks in /var/log exist. We no longer +# trust anything to remain in /var/log. Let the admin wipe it if that's +# what they like. +for symlink in packages scripts setup ; do + if [ ! -L $LOG_DIR/../$symlink -a ! -d $LOG_DIR/../$symlink ]; then + ( cd $LOG_DIR/.. ; ln -sf ../lib/pkgtools/$symlink . ) + fi +done # Make sure there's a proper temp directory: TMP=$ADM_DIR/setup/tmp diff --git a/source/a/pkgtools/scripts/makebootdisk b/source/a/pkgtools/scripts/makebootdisk index e1c3cfb6..79379618 100644 --- a/source/a/pkgtools/scripts/makebootdisk +++ b/source/a/pkgtools/scripts/makebootdisk @@ -34,7 +34,7 @@ else fi # Make sure there's a proper temp directory: -TMP=/var/log/setup/tmp +TMP=/var/lib/pkgtools/setup/tmp # If the $TMP directory doesn't exist, create it: if [ ! -d $TMP ]; then mkdir -p $TMP diff --git a/source/a/pkgtools/scripts/pkgtool b/source/a/pkgtools/scripts/pkgtool index 000bb002..076402b8 100644 --- a/source/a/pkgtools/scripts/pkgtool +++ b/source/a/pkgtools/scripts/pkgtool @@ -3,7 +3,7 @@ # Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999 Patrick Volkerding, Moorhead, MN USA # Copyright 2001, 2004 Slackware Linux, Inc., Concord, CA USA # All rights reserved. -# Copyright 2007, 2009, 2010, 2011, 2013, 2015, 2016 Patrick Volkerding, Sebeka, MN, USA +# Copyright 2007, 2009, 2010, 2011, 2013, 2015, 2016, 2018 Patrick Volkerding, Sebeka, MN, USA # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: @@ -23,6 +23,9 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +# Mon Jun 4 21:17:58 UTC 2018 +# Use /var/lib/pkgtools, not /var/log. +# # Sat Apr 25 21:18:53 UTC 2009 # Converted to use new pkgbase() function to remove pathname and # valid package extensions. @@ -67,12 +70,12 @@ pkgbase() { echo $PKGRETURN } -SOURCE_DIR=/var/log/mount +SOURCE_DIR=/var/lib/pkgtools/mount ASK="tagfiles" if [ -L /bin/chmod -a -L /bin/chown ]; then # probably on the bootdisk using busybox TARGET_DIR=/mnt rootdevice="$(mount | grep ' on /mnt ' | tail -n 1 | cut -f 1 -d ' ' 2> /dev/null)" - TMP=/mnt/var/log/setup/tmp + TMP=/mnt/var/lib/pkgtools/setup/tmp if ! mount | grep ' on /mnt ' 1> /dev/null 2> /dev/null ; then echo echo @@ -94,13 +97,13 @@ if [ -L /bin/chmod -a -L /bin/chown ]; then # probably on the bootdisk using bus else TARGET_DIR=/ rootdevice="$(mount | grep ' on / ' | tail -n 1 | cut -f 1 -d ' ')" - TMP=/var/log/setup/tmp + TMP=/var/lib/pkgtools/setup/tmp fi if [ ! -d $TMP ]; then mkdir -p $TMP chmod 700 $TMP fi -ADM_DIR=$TARGET_DIR/var/log +ADM_DIR=$TARGET_DIR/var/lib/pkgtools LOG=$TMP/PKGTOOL.REMOVED # remove whitespace @@ -200,7 +203,7 @@ if [ $# -gt 0 ]; then # there are arguments to the command SOURCE_DIR=$2 ; shift 2 ;; -target_dir | --target_dir) TARGET_DIR=$2 - ADM_DIR=$TARGET_DIR/var/log + ADM_DIR=$TARGET_DIR/var/lib/pkgtools shift 2 ;; -source_device | --source_device) SOURCE_DEVICE=$2 ; shift 2 ;; diff --git a/source/a/pkgtools/scripts/removepkg b/source/a/pkgtools/scripts/removepkg index 6312353a..b033eebf 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 Patrick J. Volkerding, Sebeka, MN, USA +# Copyright 2009, 2015, 2016, 2018 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -24,6 +24,11 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +# 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 +# into /var/log/pkgtools. +# # Sun May 27 18:02:23 UTC 2018 # Added --terse mode to print one line per removed package. # @@ -133,14 +138,19 @@ pkgbase() { # This makes "sort" run much faster: export LC_ALL=C +# Set the prefix for the package database directories (packages, scripts). +ADM_DIR="$ROOT/var/lib/pkgtools" + +# Set the prefix for the removed packages/scripts log files: +LOG_DIR="$ROOT/var/log/pkgtools" + # Make sure there's a proper temp directory: -TMP=$ROOT/var/log/setup/tmp +TMP=$ADM_DIR/setup/tmp # If the $TMP directory doesn't exist, create it: if [ ! -d $TMP ]; then mkdir -p $TMP chmod 700 $TMP # no need to leave it open fi -ADM_DIR=$ROOT/var/log PRES_DIR=$TMP/preserved_packages # Lock directory for ldconfig... share it with installpkg so that upgradepkg @@ -366,10 +376,19 @@ remove_packages() { fi fi if [ ! "$WARN" = "true" ]; then - mkdir -p $ADM_DIR/removed_packages $ADM_DIR/removed_scripts - mv $ADM_DIR/packages/$PKGNAME $ADM_DIR/removed_packages + # 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 + 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 $ADM_DIR/removed_scripts + mv $ADM_DIR/scripts/$PKGNAME $LOG_DIR/removed_scripts fi fi else diff --git a/source/a/pkgtools/scripts/setup.80.make-bootdisk b/source/a/pkgtools/scripts/setup.80.make-bootdisk index c1753bc5..0ed8b9a1 100644 --- a/source/a/pkgtools/scripts/setup.80.make-bootdisk +++ b/source/a/pkgtools/scripts/setup.80.make-bootdisk @@ -5,7 +5,7 @@ if [ -r /usr/lib/setup/setup ]; then else RDIR=/dev/null fi -TMP=/var/log/setup/tmp +TMP=/var/lib/pkgtools/setup/tmp if [ ! -d $TMP ]; then mkdir -p $TMP diff --git a/source/a/pkgtools/scripts/setup.services b/source/a/pkgtools/scripts/setup.services index 47b4cef7..2e83cb93 100644 --- a/source/a/pkgtools/scripts/setup.services +++ b/source/a/pkgtools/scripts/setup.services @@ -1,6 +1,6 @@ #!/bin/sh #BLURB="Select/deselect system daemons (services)" -TMP=/var/log/setup/tmp +TMP=/var/lib/pkgtools/setup/tmp if [ ! -d $TMP ]; then mkdir -p $TMP fi diff --git a/source/a/pkgtools/scripts/upgradepkg b/source/a/pkgtools/scripts/upgradepkg index 3ee3c658..f53d21d9 100644 --- a/source/a/pkgtools/scripts/upgradepkg +++ b/source/a/pkgtools/scripts/upgradepkg @@ -22,6 +22,9 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +# Mon Jun 4 21:17:58 UTC 2018 +# Use /var/lib/pkgtools, not /var/log. +# # Thu May 24 20:23:55 UTC 2018 # Added --terselength option to set the line length in --terse mode. # Use a lockfile to prevent output collisions in --terse mode. @@ -83,8 +86,11 @@ For more details see upgradepkg(8). EOF } +# Set the prefix for the package database directories (packages, scripts). +ADM_DIR="$ROOT/var/lib/pkgtools" + # Make sure there's a proper temp directory: -TMP=$ROOT/var/log/setup/tmp +TMP=$ADM_DIR/setup/tmp # If the $TMP directory doesn't exist, create it: if [ ! -d $TMP ]; then mkdir -p $TMP @@ -204,7 +210,7 @@ for ARG; do # Simple package integrity check: if ! [ -f "$NEW" ]; then ERRCODE=4 - echo "Cannot install $NEW: file not found" + echo "Cannot install $NEW: file not found" continue; fi @@ -226,9 +232,9 @@ for ARG; do # Check and fix the old package name: SHORT="$(package_name $OLD)" - if [ ! -r $ROOT/var/log/packages/$OLD ]; then - if ls $ROOT/var/log/packages/$SHORT* 1> /dev/null 2> /dev/null ; then - for installed_package in $ROOT/var/log/packages/$SHORT* ; do + if [ ! -r $ADM_DIR/packages/$OLD ]; then + if ls $ADM_DIR/packages/$SHORT* 1> /dev/null 2> /dev/null ; then + for installed_package in $ADM_DIR/packages/$SHORT* ; do if [ "$(package_name $installed_package)" = "$SHORT" ]; then # found one OLD="${installed_package##*/}" break @@ -240,14 +246,14 @@ for ARG; do # Test to see if both the old and new packages are where we expect them # to be - skip to the next package (or package pair) if anything's wrong: - if [ ! -r $ROOT/var/log/packages/$OLD ]; then + if [ ! -r $ADM_DIR/packages/$OLD ]; then if [ ! "$INSTALL_NEW" = "yes" ]; then if [ "$DRY_RUN" = "true" ]; then echo "$OLD would not be upgraded (no installed package named $SHORT)." else ! [ $TERSE ] && echo echo "Error: there is no installed package named $OLD." - ! [ $TERSE ] && echo " (looking for $ROOT/var/log/packages/$OLD)" + ! [ $TERSE ] && echo " (looking for $ADM_DIR/packages/$OLD)" ! [ $TERSE ] && echo fi ERRCODE=1 @@ -317,7 +323,7 @@ EOF SHORT="$(package_name $OLD)" if [ "$DRY_RUN" = "true" ]; then echo -n "$NEW would upgrade: " - for installed_package in $ROOT/var/log/packages/$SHORT* ; do + for installed_package in $ADM_DIR/packages/$SHORT* ; do if [ "$(package_name $installed_package)" = "$SHORT" ]; then echo -n "$(pkgbase $installed_package)" fi @@ -325,12 +331,12 @@ EOF echo continue fi - for installed_package in $ROOT/var/log/packages/$SHORT* ; do + for installed_package in $ADM_DIR/packages/$SHORT* ; do if [ "$(package_name $installed_package)" = "$SHORT" ]; then mv $installed_package ${installed_package}-upgraded-$TIMESTAMP fi done - for installed_script in $ROOT/var/log/scripts/$SHORT* ; do + for installed_script in $ADM_DIR/scripts/$SHORT* ; do if [ "$(package_name $installed_script)" = "$SHORT" ]; then if [ -r $installed_script ]; then mv $installed_script ${installed_script}-upgraded-$TIMESTAMP @@ -385,7 +391,7 @@ EOF fi # Now, the leftovers from the old package(s) can go. Pretty simple, huh? :) ( flock 9 || exit 11 - for rempkg in "$ROOT/var/log/packages/"*"-$TIMESTAMP"; do + for rempkg in "$ADM_DIR/packages/"*"-$TIMESTAMP"; do if [ "$VERBOSE" = "verbose" ]; then /sbin/removepkg "${rempkg##*/}" elif ! [ $TERSE ]; then |