From ca85aab95397ae918088f8ba2195eb4eb996c739 Mon Sep 17 00:00:00 2001 From: Patrick J Volkerding Date: Thu, 21 Jun 2018 22:58:42 +0000 Subject: Thu Jun 21 22:58:42 UTC 2018 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. --- source/a/pkgtools/scripts/explodepkg | 4 +-- source/a/pkgtools/scripts/installpkg | 32 ++++++++++++++++++++++-- source/a/pkgtools/scripts/makebootdisk | 2 +- source/a/pkgtools/scripts/pkgtool | 15 ++++++----- source/a/pkgtools/scripts/removepkg | 31 ++++++++++++++++++----- source/a/pkgtools/scripts/setup.80.make-bootdisk | 2 +- source/a/pkgtools/scripts/setup.services | 2 +- source/a/pkgtools/scripts/upgradepkg | 28 +++++++++++++-------- 8 files changed, 86 insertions(+), 30 deletions(-) (limited to 'source/a/pkgtools/scripts') diff --git a/source/a/pkgtools/scripts/explodepkg b/source/a/pkgtools/scripts/explodepkg index e1f9b1281..72c013d4a 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 b777442a5..0d82f89c0 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 e1c3cfb61..793796181 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 000bb0020..076402b86 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 6312353ac..b033eebf2 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 c1753bc59..0ed8b9a14 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 47b4cef77..2e83cb932 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 3ee3c6589..f53d21d99 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 -- cgit v1.2.3-79-gdb01