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/doinst.sh | |
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/doinst.sh')
-rw-r--r-- | source/a/pkgtools/doinst.sh | 69 |
1 files changed, 69 insertions, 0 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 |