summaryrefslogtreecommitdiff
path: root/source/a/pkgtools
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2018-05-28 19:12:29 +0000
committerEric Hameleers <alien@slackware.com>2018-05-31 23:39:35 +0200
commit646a5c1cbfd95873950a87b5f75d52073a967023 (patch)
treeb8b8d2ab3b0d432ea69ad1a64d1c789649d65020 /source/a/pkgtools
parentd31c50870d0bee042ce660e445c9294a59a3a65b (diff)
downloadcurrent-646a5c1cbfd95873950a87b5f75d52073a967023.tar.gz
Mon May 28 19:12:29 UTC 201820180528191229
a/pkgtools-15.0-noarch-13.txz: Rebuilt. installpkg: default line length for --terselength is the number of columns. removepkg: added --terse mode. upgradepkg: default line length for --terselength is the number of columns. upgradepkg: accept -option in addition to --option. ap/vim-8.1.0026-x86_64-1.txz: Upgraded. d/bison-3.0.5-x86_64-1.txz: Upgraded. e/emacs-26.1-x86_64-1.txz: Upgraded. kde/kopete-4.14.3-x86_64-8.txz: Rebuilt. Recompiled against libidn-1.35. n/conntrack-tools-1.4.5-x86_64-1.txz: Upgraded. n/libnetfilter_conntrack-1.0.7-x86_64-1.txz: Upgraded. n/libnftnl-1.1.0-x86_64-1.txz: Upgraded. n/links-2.16-x86_64-2.txz: Rebuilt. Rebuilt to enable X driver for -g mode. n/lynx-2.8.9dev.19-x86_64-1.txz: Upgraded. n/nftables-0.8.5-x86_64-1.txz: Upgraded. n/p11-kit-0.23.11-x86_64-1.txz: Upgraded. n/ulogd-2.0.7-x86_64-1.txz: Upgraded. n/whois-5.3.1-x86_64-1.txz: Upgraded. xap/network-manager-applet-1.8.12-x86_64-1.txz: Upgraded. xap/vim-gvim-8.1.0026-x86_64-1.txz: Upgraded.
Diffstat (limited to 'source/a/pkgtools')
-rw-r--r--source/a/pkgtools/manpages/installpkg.817
-rw-r--r--source/a/pkgtools/manpages/makepkg.835
-rw-r--r--source/a/pkgtools/manpages/pkgdiff.857
-rw-r--r--source/a/pkgtools/manpages/removepkg.846
-rw-r--r--source/a/pkgtools/manpages/upgradepkg.820
-rw-r--r--source/a/pkgtools/obsolete-scripts/README5
-rw-r--r--source/a/pkgtools/obsolete-scripts/setup.90.modem-device44
-rwxr-xr-xsource/a/pkgtools/pkgtools.SlackBuild25
-rw-r--r--source/a/pkgtools/scripts/explodepkg64
-rw-r--r--source/a/pkgtools/scripts/installpkg327
-rw-r--r--source/a/pkgtools/scripts/makebootdisk42
-rw-r--r--source/a/pkgtools/scripts/makepkg249
-rw-r--r--source/a/pkgtools/scripts/pkgdiff164
-rw-r--r--source/a/pkgtools/scripts/pkgtool69
-rw-r--r--source/a/pkgtools/scripts/removepkg175
-rw-r--r--source/a/pkgtools/scripts/setup.80.make-bootdisk28
-rw-r--r--source/a/pkgtools/scripts/setup.htmlview14
-rw-r--r--source/a/pkgtools/scripts/setup.services45
-rw-r--r--source/a/pkgtools/scripts/upgradepkg209
-rw-r--r--source/a/pkgtools/slack-desc12
20 files changed, 1097 insertions, 550 deletions
diff --git a/source/a/pkgtools/manpages/installpkg.8 b/source/a/pkgtools/manpages/installpkg.8
index 534f2084..f06e611d 100644
--- a/source/a/pkgtools/manpages/installpkg.8
+++ b/source/a/pkgtools/manpages/installpkg.8
@@ -31,6 +31,9 @@ installpkg \- install Slackware packages.
.B \--terse
]
[
+.B \--terselength <length>
+]
+[
.B \--ask
]
[
@@ -39,13 +42,16 @@ installpkg \- install Slackware packages.
[
.B \--tagfile /somedir/tagfile
]
+[
+.B \--threads <number>
+]
.BI packagename
[
.B packagename2 ...
]
.SH DESCRIPTION
.B installpkg
-installs single or multiple *.tgz (or .tbz, .tlz, .txz) binary packages designed
+installs single or multiple *.txz (or .tbz, .tgz, .tlz) binary packages designed
for use with the Slackware Linux distribution onto your system.
.SH OPTIONS
.TP
@@ -73,6 +79,9 @@ package(s) or not. Generally used when installpkg is called from other scripts.
.B \--terse
Install the package displaying only a single description line to stdout.
.TP
+.B \--terselength <length>
+Maximum line length of --terse mode output. Default is the number of terminal columns.
+.TP
.B \--ask
Used with -menu mode. When selected, always ask if a package should be
installed regardless of what the package's priority is.
@@ -87,6 +96,12 @@ the values set in the tagfile for the entire package list.
.B \--tagfile /somedir/tagfile
Specify a different file to use for package priorities (in this example, /somedir/tagfile
will be used). The default is "tagfile" in the package's directory.
+.TP
+.B \--threads <number>
+For xz/plzip compressed packages, set the maximum number of threads to be used for
+decompression. Only has an effect if a multithreaded compressor was used, and then
+only on large packages. The default for plzip is the number of CPU threads available.
+The default for xz is 2.
.SH EXAMPLES
.TP
.B Install a font package for X:
diff --git a/source/a/pkgtools/manpages/makepkg.8 b/source/a/pkgtools/manpages/makepkg.8
index b280ce51..0f239a9b 100644
--- a/source/a/pkgtools/manpages/makepkg.8
+++ b/source/a/pkgtools/manpages/makepkg.8
@@ -18,6 +18,18 @@ makepkg \- make Slackware packages.
[
.B -c, --chown y|n
]
+[
+.B --threads <number>
+]
+[
+.B --compress <option>
+]
+[
+.B --acls
+]
+[
+.B --xattrs
+]
.BI packagename
.SH DESCRIPTION
.B makepkg
@@ -30,9 +42,9 @@ appended to the primary installation script
, or, if that script does not exist it will be created with those contents.
The package will be written out to the file
.BI packagename
-which should be the full name, including the extension. This is usually .tgz,
-but .tbz, .tlz, and .txz are also accepted. The proper compression utility
-(gzip, bzip2, lzma, or xz) needs to be installed on the machine.
+which should be the full name, including the extension. This is usually .txz,
+but .tgz, .tbz, and .tlz are also accepted. The proper compression utility
+(xz, gzip, bzip2, or lzip) needs to be installed on the machine.
.SH OPTIONS
.TP
.B \-l, --linkadd y|n
@@ -51,6 +63,23 @@ If y, makepkg will reset all directory permissions to 755 and ownership to root:
In general, you should have the permissions and ownerships worked out yourself, so
relying on setting this option to y is somewhat sloppy. It is not the default. If an
option is not provided, makepkg will prompt.
+.TP
+.B --threads <number>
+For xz/plzip compressed packages, set the maximum number of threads to be used for
+compression. Only has an effect on large packages. For plzip, the default is the number
+of CPU threads available. For xz, the default is 2 (due to commonly occuring memory
+related failures on 32-bit with too many threads and multithreaded xz compression).
+.TP
+.B --compress <option>
+Supply a custom option to the compressor. This will be used in place of the default, which is: -9
+.TP
+.B --acls
+Support storing POSIX ACLs in the package. The resulting package will not be compatible
+with pkgtools version < 15.0.
+.TP
+.B --xattrs
+Support storing extended attributes in the package. The resulting package will not be
+compatible with pkgtools version < 15.0.
.SH INSTALLATION SCRIPTS
There are 3 types of installation scripts supported in the Slackware package
system.
diff --git a/source/a/pkgtools/manpages/pkgdiff.8 b/source/a/pkgtools/manpages/pkgdiff.8
new file mode 100644
index 00000000..5d91ac21
--- /dev/null
+++ b/source/a/pkgtools/manpages/pkgdiff.8
@@ -0,0 +1,57 @@
+.\" -*- nroff -*-
+.ds g \" empty
+.ds G \" empty
+.\" Like TP, but if specified indent is more than half
+.\" the current line-length - indent, use the default indent.
+.de Tp
+.ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
+.el .TP "\\$1"
+..
+.TH PKGDIFF 8 "11 Apr 2018" "Slackware Version 15.0
+.SH NAME
+pkgdiff \- compare the file contents of two packages.
+.SH SYNOPSIS
+.B pkgdiff
+[
+.B \--help
+]
+[
+.B \-c
+]
+[
+.B \-a
+]
+.BI packagename
+.BI packagename2
+.SH DESCRIPTION
+.B pkgdiff
+Displays the differences in the files contained in two packages. This works with
+plain .tar, Slackware packages (.tgz, .tbz, .tlz, .txz), .rpm, and .deb. By default,
+the results will be displayed in a tree-style unified diff format.
+.SH OPTIONS
+.TP
+.B \--help
+Display help for using the pkgdiff utility.
+.TP
+.B \-c
+Colorize the tree-style output a-la DIR_COLORS. If piping to a pager such as
+less, you'll need to enable displaying raw data. For example:
+.P
+pkgdiff -c package-1.0-i586-1.txz package-2.0-i586-1.txz | less -r
+.TP
+.B \-a
+Instead of a tree-style output format, generate a simple unified diff of the
+package file lists.
+.SH EXAMPLES
+.TP
+.B Compare two packages and pipe the result to less:
+.P
+pkgdiff package-1.0-i586-1.txz package-2.0-i586-1.txz | less
+.SH AUTHOR
+Patrick J. Volkerding <volkerdi@slackware.com>
+.SH "SEE ALSO"
+.BR makepkg(8),
+.BR removepkg(8),
+.BR explodepkg(8),
+.BR pkgtool(8),
+.BR upgradepkg(8)
diff --git a/source/a/pkgtools/manpages/removepkg.8 b/source/a/pkgtools/manpages/removepkg.8
index 3bd8bf7a..d6be202c 100644
--- a/source/a/pkgtools/manpages/removepkg.8
+++ b/source/a/pkgtools/manpages/removepkg.8
@@ -19,16 +19,19 @@ removepkg \- remove Slackware packages.
]
.B removepkg
[
-.B \-copy
+.B \--copy
]
[
-.B \-keep
+.B \--keep
]
[
-.B \-preserve
+.B \--preserve
]
[
-.B \-warn
+.B \--terse
+]
+[
+.B \--warn
]
.BI packagename
.SH DESCRIPTION
@@ -36,14 +39,14 @@ removepkg \- remove Slackware packages.
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
-base package name. For example, the package foo-1.0-i486-1.tgz may be removed
+base package name. For example, the package foo-1.0-i586-1.txz may be removed
with any of the following commands:
-removepkg foo-1.0-i486-1.tgz (also recognized: .tbz, .tlz, .txz)
+removepkg foo-1.0-i586-1.txz (also recognized: .tgz, .tbz, .tlz)
-removepkg foo-1.0-i486-1
+removepkg foo-1.0-i586-1
-removepkg foo.tgz
+removepkg foo.txz
removepkg foo
@@ -72,22 +75,25 @@ When removing a package, it's original file index will be moved from
script will be moved from /var/log/scripts to /var/log/removed_scripts.
.SH OPTIONS
.TP
-.B \-warn packagename
-Generate a report to the standard output about which files and directories
-would be removed, but does not actually remove the package.
-.TP
-.B \-preserve packagename
-If specified, the complete package subtree is reconstructed in
-/var/log/setup/tmp/preserved_packages/packagename.
-.TP
-.B \-copy packagename
+.B \--copy packagename
Construct a copy of the package under /var/log/setup/tmp/preserved_packages/packagename,
but don't remove it. (same effect as \-warn \-preserve)
.TP
-.B \-keep
-Save the intermediate files created by removepkg (delete_list,
-required_files, uniq_list, del_link_list, required_links,
+.B \--keep
+Save the intermediate files created by removepkg (delete_list,
+required_files, uniq_list, del_link_list, required_links,
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.
+.TP
+.B \--terse
+Remove the package displaying only a single description line to stdout.
+.TP
+.B \--warn packagename
+Generate a report to the standard output about which files and directories
+would be removed, but does not actually remove the package.
.SH " "
It's possible to remove a package from a filesystem
other than / by supplying
diff --git a/source/a/pkgtools/manpages/upgradepkg.8 b/source/a/pkgtools/manpages/upgradepkg.8
index 8ca7811b..af526648 100644
--- a/source/a/pkgtools/manpages/upgradepkg.8
+++ b/source/a/pkgtools/manpages/upgradepkg.8
@@ -22,6 +22,12 @@ upgradepkg \- upgrade Slackware packages.
.B --reinstall
]
[
+.B \--terse
+]
+[
+.B \--terselength <length>
+]
+[
.B --verbose
]
.BI newpackagename
@@ -38,6 +44,12 @@ upgradepkg \- upgrade Slackware packages.
.B --reinstall
]
[
+.B \--terse
+]
+[
+.B \--terselength <length>
+]
+[
.B --verbose
]
.BI oldpackagename%newpackagename
@@ -60,7 +72,7 @@ name, it will remove them all.
.TP
To upgrade in a directory other than / (such as /mnt):
.TP
-ROOT=/mnt upgradepkg package.tgz (or .tbz, .tlz, .txz)
+ROOT=/mnt upgradepkg package.txz (or .tbz, .tgz, .tlz)
.SH OPTIONS
.TP
.B \--dry-run
@@ -81,6 +93,12 @@ Upgradepkg usually skips packages if the exact same package
Use the --reinstall option if you want to upgrade all packages even if the same
version is already installed.
.TP
+.B \--terse
+Upgrade the package displaying only a single description line to stdout.
+.TP
+.B \--terselength <length>
+Maximum line length of --terse mode output. Default is the number of terminal columns.
+.TP
.B \--verbose
Show all the gory details of the upgrade.
.SH BUGS
diff --git a/source/a/pkgtools/obsolete-scripts/README b/source/a/pkgtools/obsolete-scripts/README
deleted file mode 100644
index 3e0060de..00000000
--- a/source/a/pkgtools/obsolete-scripts/README
+++ /dev/null
@@ -1,5 +0,0 @@
-This directory contains retired installation scripts.
-
-setup.90.modem-device is obsolete since udev will overwrite any
-existing devices or links in /dev.
-
diff --git a/source/a/pkgtools/obsolete-scripts/setup.90.modem-device b/source/a/pkgtools/obsolete-scripts/setup.90.modem-device
deleted file mode 100644
index a1c5993a..00000000
--- a/source/a/pkgtools/obsolete-scripts/setup.90.modem-device
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-#BLURB="Select modem device"
-TMP=/var/log/setup/tmp
-T_PX="$1"
-if [ ! -d $TMP ]; then
- mkdir -p $TMP
-fi
-
-dialog --title "MODEM CONFIGURATION" --menu "This part of the configuration \
-process will create a /dev/modem link pointing to the callout device (ttyS0, \
-ttyS1, ttyS2, ttyS3) representing your default modem. You \
-can change this link \
-later if you move your modem to a different port. If your modem is a PCI card, \
-it will probably use /dev/ttyS4 or higher. \
-Please select the callout \
-device which you would like to use for your modem:" 22 68 9 \
-"no modem" "do not set a /dev/modem link" \
-"/dev/ttyS0" "(COM1: under DOS)" \
-"/dev/ttyS1" "(COM2: under DOS)" \
-"/dev/ttyS2" "(COM3: under DOS)" \
-"/dev/ttyS3" "(COM4: under DOS)" \
-"/dev/ttyS4" "PCI modem" \
-"/dev/ttyS5" "PCI modem" \
-"/dev/ttyS6" "PCI modem" \
-"/dev/ttyS7" "PCI modem" \
-"/dev/ttyS8" "PCI modem" \
-"/dev/ttyS9" "PCI modem" \
-"/dev/ttyS10" "PCI modem" \
-"/dev/ttyS11" "PCI modem" \
-"/dev/ttyS12" "PCI modem" \
-"/dev/ttyS13" "PCI modem" \
-"/dev/ttyS14" "PCI modem" \
-"/dev/ttyS15" "PCI modem" \
-2> $TMP/callout
-
-if [ $? = 0 ]; then
- MODEM_DEVICE="`cat $TMP/callout`"
- if [ ! "$MODEM_DEVICE" = "no modem" ]; then
- MODEM_DEVICE=`basename $MODEM_DEVICE`
- ( cd $T_PX/dev ; ln -sf $MODEM_DEVICE modem )
- fi
-fi
-rm -f $TMP/callout
-
diff --git a/source/a/pkgtools/pkgtools.SlackBuild b/source/a/pkgtools/pkgtools.SlackBuild
index c33fb062..5ee4d1d2 100755
--- a/source/a/pkgtools/pkgtools.SlackBuild
+++ b/source/a/pkgtools/pkgtools.SlackBuild
@@ -1,5 +1,5 @@
-#!/bin/sh
-# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA
+#!/bin/bash
+# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,16 +20,25 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Set initial variables:
-CWD=`pwd`
+cd $(dirname $0) ; CWD=$(pwd)
if [ "$TMP" = "" ]; then
TMP=/tmp
fi
PKG=$TMP/package-pkgtools
+PKGNAM=pkgtools
# *** UPDATE THESE WITH EACH BUILD:
-VERSION=14.2
+VERSION=15.0
ARCH=${ARCH:-noarch}
-BUILD=10
+BUILD=${BUILD:-13}
+
+# 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
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
+ exit 0
+fi
if [ ! -d $TMP ]; then
mkdir -p $TMP # location to build the source
@@ -40,8 +49,8 @@ mkdir -p $PKG
# Install Slackware script manpages:
( cd $CWD/manpages
mkdir -p $PKG/usr/man/man8
- for page in explodepkg.8 installpkg.8 makepkg.8 upgradepkg.8 pkgtool.8 \
- removepkg.8 ; do
+ for page in explodepkg.8 installpkg.8 makepkg.8 upgradepkg.8 pkgdiff.8 \
+ pkgtool.8 removepkg.8 ; do
cat $page | gzip -9c > $PKG/usr/man/man8/$page.gz
done
)
@@ -65,7 +74,7 @@ mkdir -p $PKG
mkdir -p $PKG/sbin
# Don't include makebootdisk... it's useless since a kernel won't fit on a
# floppy disk, and nobody uses floppies any more anyway.
- for file in explodepkg installpkg makepkg pkgtool removepkg upgradepkg ; do
+ for file in explodepkg installpkg makepkg pkgdiff pkgtool removepkg upgradepkg ; do
cp -a $CWD/scripts/$file $PKG/sbin
done
chown root:root $PKG/sbin/*
diff --git a/source/a/pkgtools/scripts/explodepkg b/source/a/pkgtools/scripts/explodepkg
index 110ebf06..e1f9b128 100644
--- a/source/a/pkgtools/scripts/explodepkg
+++ b/source/a/pkgtools/scripts/explodepkg
@@ -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 Patrick Volkerding, Sebeka, MN, USA
+# Copyright 2007, 2009, 2017, 2018 Patrick Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,32 +21,15 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-TAR=tar-1.13
-$TAR --help 1> /dev/null 2> /dev/null
-if [ ! $? = 0 ]; then
- TAR=tar
-fi
-if [ ! "`LC_MESSAGES=C $TAR --version`" = "tar (GNU tar) 1.13
-
-Copyright (C) 1988, 92,93,94,95,96,97,98, 1999 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-Written by John Gilmore and Jay Fenlason." ]; then
- echo "WARNING: pkgtools are unstable with tar > 1.13."
- echo " You should provide a \"tar-1.13\" in your \$PATH."
- sleep 5
-fi
-
if [ $# = 0 ]; then
cat << EOF
Usage: explodepkg package_name [package_name2, ...]
Explodes a Slackware compatible software package
-(or any tar+{gzip,bzip2,lzma,xz archive) in the current directory.
+(or any tar+{gzip,bzip2,lz,xz archive) in the current directory.
Equivalent to (for each package listed):
- ( umask 000 ; cat package_name | COMPRESSOR -dc | tar xvf package_name )
+ ( 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
@@ -55,6 +38,10 @@ indexes in /var/log/packages and /var/log/scripts.
EOF
fi
+# Set maximum number of threads to use. By default, this will be the number
+# of CPU threads:
+THREADS="$(nproc)"
+
# Main loop:
for PKG in $* ; do
echo "Exploding package $PKG in current directory:"
@@ -69,25 +56,50 @@ for PKG in $* ; do
packagecompression=gzip
;;
'tbz' )
- packagecompression=bzip2
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ packagecompression=lbzip2
+ else
+ packagecompression=bzip2
+ fi
;;
'bz2' )
- packagecompression=bzip2
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ packagecompression=lbzip2
+ else
+ packagecompression=bzip2
+ fi
;;
'tlz' )
- packagecompression=lzma
+ if which plzip 1> /dev/null 2> /dev/null ; then
+ packagecompression="plzip --threads=${THREADS}"
+ elif which lzip 1> /dev/null 2> /dev/null ; then
+ packagecompression=lzip
+ else
+ echo "ERROR: lzip compression utility not found in \$PATH."
+ exit 3
+ fi
+ ;;
+ 'lz' )
+ if which plzip 1> /dev/null 2> /dev/null ; then
+ packagecompression="plzip --threads=${THREADS}"
+ elif which lzip 1> /dev/null 2> /dev/null ; then
+ packagecompression=lzip
+ else
+ echo "ERROR: lzip compression utility not found in \$PATH."
+ exit 3
+ fi
;;
'lzma' )
packagecompression=lzma
;;
'txz' )
- packagecompression=xz
+ packagecompression="xz --threads=${THREADS}"
;;
'xz' )
- packagecompression=xz
+ packagecompression="xz --threads=${THREADS}"
;;
esac
- ( umask 000 ; cat $PKG | $packagecompression -dc | $TAR xvf - 2> /dev/null )
+ ( umask 000 ; cat $PKG | $packagecompression -dc | tar --xattrs --xattrs-include='*' --keep-directory-symlink -xpvf - 2> /dev/null )
if [ -r install/doinst.sh ]; then
echo
echo "An installation script was detected in ./install/doinst.sh, but"
diff --git a/source/a/pkgtools/scripts/installpkg b/source/a/pkgtools/scripts/installpkg
index 96c34fd9..87a7f57a 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 Patrick Volkerding, Sebeka, MN, USA
+# Copyright 2007, 2009, 2011, 2017, 2018 Patrick Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,6 +21,33 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+# 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.
+#
+# Sat May 19 22:42:03 UTC 2018
+# Implement locking to prevent screen output or install script collisions if
+# multiple copies of installpkg are running simultaneously.
+# Use ${MCOOKIE} instead of $$ (might as well, since we already generated it).
+#
+# Tue Apr 17 17:26:44 UTC 2018
+# Quit with the funny business in /install. Note however that /install still
+# isn't a safe directory to use in a package for anything other than package
+# metadata. Other files placed there are going to be left on the system in
+# /installpkg-$(mcookie). That could be worked around, but we'll wait until
+# someone reports there is a need. The main reason to do this is that /install
+# was a collision point if more than one copy of installpkg was running at
+# once. With this change, the pkgtools are (more or less) thread-safe.
+#
+# Tue Feb 13 01:19:46 UTC 2018
+# Use recent tar, and support restoring POSIX ACLs and extended attributes.
+#
+# Tue Dec 12 21:49:48 UTC 2017
+# If possible, use multiple decompression threads.
+#
+# Thu Dec 7 04:09:17 UTC 2017
+# Change meaning of .tlz to tar.lz (lzip)
+#
# Sun Sep 6 21:58:36 BST 2009
# Replaced usage of "cat" with STDIN redirection or file name parameters
# to speed up execution on ARM.
@@ -58,13 +85,6 @@
# Changed $TMP directory to /var/log/setup/tmp, and chmod'ed it 700 to close
# some security holes.
-# A stronger formula is needed to regularize output that will be parsed.
-unset LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
- LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
- LC_IDENTIFICATION LC_ALL
-LANG=C
-export LANG
-
# Return a package name that has been stripped of the dirname portion
# and any of the valid extensions (only):
pkgbase() {
@@ -88,21 +108,27 @@ MD5SUM=0
# So that we know what to expect...
umask 022
-TAR=tar-1.13
-$TAR --help 1> /dev/null 2> /dev/null
-if [ ! $? = 0 ]; then
- TAR=tar
-fi
-if [ ! "$(LC_MESSAGES=C $TAR --version)" = "tar (GNU tar) 1.13
-Copyright (C) 1988, 92,93,94,95,96,97,98, 1999 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# If we have mcookie and a tar that is recent enough to support --transform,
+# then we can stop needlessly erasing files in the /install directory while
+# also making installpkg thread-safe. Don't check for recent tar - we'll
+# already break from --attrs and --xattrs anyway if the wrong tar is used.
+if which mcookie 1> /dev/null 2> /dev/null ; then
+ MCOOKIE=$(mcookie)
+ INSTDIR=installpkg-${MCOOKIE}
+else
+ # Well, we will make due with this:
+ MCOOKIE=$$
+ INSTDIR=installpkg-${MCOOKIE}
+fi
-Written by John Gilmore and Jay Fenlason." ]; then
- echo "WARNING: pkgtools are unstable with tar > 1.13."
- echo " You should provide a \"tar-1.13\" in your \$PATH."
- sleep 5
+# Create a lockfile directory if it doesn't exist. We can use it to prevent
+# screen corruption (from multiple dialogs) and install script collisions
+# (from multiple scripts trying to work on the same files) in the case of
+# parallel instances of installpkg.
+INSTLOCKDIR=${INSTLOCKDIR:-/run/installpkg-lock}
+if [ ! -d $INSTLOCKDIR ]; then
+ mkdir -p $INSTLOCKDIR
fi
usage() {
@@ -116,16 +142,24 @@ options: --warn (warn if files will be overwritten, but do not install)
--root /mnt (install someplace else, like /mnt)
--infobox (use dialog to draw an info box)
--terse (display a one-line short description for install)
+ --terselength <length> (line length in terse mode - default is
+ the number of columns available)
--menu (confirm package installation with a menu, unless
the priority is [required] or ADD)
--ask (used with menu mode: always ask if a package should be
installed regardless of what the package's priority is)
- --priority ADD|REC|OPT|SKP (provide a priority for the entire
+ --priority ADD|REC|OPT|SKP (provide a priority for the entire
package list to use instead of the priority in the
tagfile)
--tagfile /somedir/tagfile (specify a different file to use
- for package priorities. The default is "tagfile" in
+ for package priorities. The default is "tagfile" in
the package's directory)
+ --threads <number> For xz/plzip compressed packages, set the max
+ number of threads to be used for decompression. Only has
+ an effect if a multithreaded compressor was used, and then
+ only on large packages. For plzip, the default is equal to
+ the number of CPU threads available on the machine. For xz,
+ the default is equal to 2.
--md5sum (record the package's md5sum in the metadata file)
EOF
@@ -143,6 +177,17 @@ package_name() {
pkgbase $1 | sed 's?-[^-]*-[^-]*-[^-]*$??'
}
+# Set maximum number of threads to use. By default, this will be the number
+# of CPU threads:
+THREADS="$(nproc)"
+
+# Set default line length for terse mode:
+if which tput 1> /dev/null 2> /dev/null ; then
+ TERSELENGTH=$(tput cols)
+else
+ TERSELENGTH=80
+fi
+
# Parse options:
MODE=install # standard text-mode
while [ 0 ]; do
@@ -158,6 +203,9 @@ while [ 0 ]; do
elif [ "$1" = "-terse" -o "$1" = "--terse" ]; then
MODE=terse
shift 1
+ elif [ "$1" = "-terselength" -o "$1" = "--terselength" ]; then
+ TERSELENGTH=$2
+ shift 2
elif [ "$1" = "-menu" -o "$1" = "--menu" ]; then
MODE=menu
shift 1
@@ -174,6 +222,12 @@ while [ 0 ]; do
exit
fi
shift 2
+ elif [ "$1" = "-threads" -o "$1" = "--threads" ]; then
+ THREADS="$2"
+ shift 2
+ # xz has not yet implemented multi-threaded decompression.
+ # Who knows if or how well it will work...
+ XZ_THREADS_FORCED=yes
elif [ "$1" = "-priority" -o "$1" = "--priority" ]; then
if [ "$2" = "" ]; then
usage
@@ -222,41 +276,56 @@ fi
# If -warn mode was requested, produce the output and then exit:
if [ "$MODE" = "warn" ]; then
while [ -f "$1" ]; do
- mkdir -p $TMP/scan$$
+ mkdir -p $TMP/scan${MCOOKIE}
# Determine extension:
packageext="$( echo $1 | rev | cut -f 1 -d . | rev)"
- # Determine compressor utility:
+ # Determine decompressor utility:
case $packageext in
'tgz' )
packagecompression=gzip
;;
'tbz' )
- packagecompression=bzip2
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ packagecompression=lbzip2
+ else
+ packagecompression=bzip2
+ fi
;;
'tlz' )
- packagecompression=lzma
+ if which plzip 1> /dev/null 2> /dev/null ; then
+ packagecompression="plzip --threads=${THREADS}"
+ elif which lzip 1> /dev/null 2> /dev/null ; then
+ packagecompression=lzip
+ else
+ echo "ERROR: lzip compression utility not found in \$PATH."
+ exit 3
+ fi
;;
'txz' )
- packagecompression=xz
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ packagecompression="xz --threads=${THREADS}"
+ else
+ packagecompression="xz --threads=2"
+ fi
;;
esac
- ( cd $TMP/scan$$ ; $packagecompression -dc | $TAR xf - install ) < $1 2> /dev/null
- if [ -r $TMP/scan$$/install/doinst.sh ]; then
- if grep ' rm -rf ' $TMP/scan$$/install/doinst.sh 1>/dev/null 2>/dev/null ; then
- grep ' rm -rf ' $TMP/scan$$/install/doinst.sh > $TMP/scan$$/install/delete
- for f in `cat $TMP/scan$$/install/delete | cut -f 3,7 -d ' ' | tr ' ' '/'`; do
+ ( cd $TMP/scan${MCOOKIE} ; $packagecompression -dc | tar xf - install ) < $1 2> /dev/null
+ if [ -r $TMP/scan${MCOOKIE}/install/doinst.sh ]; then
+ if grep ' rm -rf ' $TMP/scan${MCOOKIE}/install/doinst.sh 1>/dev/null 2>/dev/null ; then
+ grep ' rm -rf ' $TMP/scan${MCOOKIE}/install/doinst.sh > $TMP/scan${MCOOKIE}/install/delete
+ for f in `cat $TMP/scan${MCOOKIE}/install/delete | cut -f 3,7 -d ' ' | tr ' ' '/'`; do
f="/$f"
if [ -f "$f" -o -L "$f" ]; then
echo "$f"
fi
done
fi
- if [ -d $TMP/scan$$ ]; then
- ( cd $TMP/scan$$ ; rm -rf install ) 2> /dev/null
- ( cd $TMP ; rmdir scan$$ ) 2> /dev/null
+ if [ -d $TMP/scan${MCOOKIE} ]; then
+ ( cd $TMP/scan${MCOOKIE} ; rm -rf install ) 2> /dev/null
+ ( cd $TMP ; rmdir scan${MCOOKIE} ) 2> /dev/null
fi
fi
- for f in `( $packagecompression -dc | $TAR tf - ) < $1 | grep -v 'drwx'`; do
+ for f in `( $packagecompression -dc | tar tf - ) < $1 | grep -v 'drwx'`; do
f="/$f"
if [ -f "$f" -o -L "$f" ]; then
echo "$f"
@@ -304,18 +373,33 @@ for package in $* ; do
packagecompression=gzip
;;
'tbz' )
- packagecompression=bzip2
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ packagecompression=lbzip2
+ else
+ packagecompression=bzip2
+ fi
;;
'tlz' )
- packagecompression=lzma
+ if which plzip 1> /dev/null 2> /dev/null ; then
+ packagecompression="plzip --threads=${THREADS}"
+ elif which lzip 1> /dev/null 2> /dev/null ; then
+ packagecompression=lzip
+ else
+ echo "ERROR: lzip compression utility not found in \$PATH."
+ exit 3
+ fi
;;
'txz' )
- packagecompression=xz
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ packagecompression="xz --threads=${THREADS}"
+ else
+ packagecompression="xz --threads=2"
+ fi
;;
esac
# Test presence of external compression utility:
- if ! $packagecompression --help 1> /dev/null 2> /dev/null ; then
+ if ! $(echo $packagecompression | cut -f 1 -d ' ') --help 1> /dev/null 2> /dev/null ; then
EXITSTATUS=5
if [ "$MODE" = "install" ]; then
echo "Cannot install $package: external compression utility $packagecompression missing"
@@ -375,28 +459,38 @@ for package in $* ; do
if [ "$MODE" = "install" ]; then
echo "Verifying package $(basename $package)."
fi
- cat $package | $packagecompression -dc | dd 2> $TMP/tmpsize$$ | $TAR tf - 1> $TMP/tmplist$$ 2> /dev/null
+ # The stray cat reduces the frequency of the lack of reported size.
+ # If it still fails, we hit it with a bigger hammer down below.
+ cat $package | $packagecompression -dc | LC_ALL=C dd 2> $TMP/tmpsize${MCOOKIE} | cat | tar tf - 2> /dev/null 1> $TMP/tmplist${MCOOKIE}
TARERROR=$?
if [ ! "$TARERROR" = "0" ]; then
EXITSTATUS=1 # tar file corrupt
if [ "$MODE" = "install" ]; then
echo "Unable to install $package: tar archive is corrupt (tar returned error code $TARERROR)"
fi
- rm -f $TMP/tmplist$$ $TMP/tmpsize$$
+ rm -f $TMP/tmplist${MCOOKIE} $TMP/tmpsize${MCOOKIE}
continue
fi
- UNCOMPRESSED="$(cat $TMP/tmpsize$$ | tail -n 1 | cut -f 1 -d ' ' | numfmt --to=iec)"
- rm -f $TMP/tmpsize$$
+ UNCOMPRESSED="$(cat $TMP/tmpsize${MCOOKIE} | tail -n 1 | cut -f 1 -d ' ' | numfmt --to=iec)"
+ # Weird bug "fix". Sometimes we get no uncompressed size (this started when we
+ # moved away from tar-1.13, but I don't see what that could have to do with
+ # it). So, if we have no uncompressed size here, demand it in this loop.
+ # Hopefully the bug is not weird enough to make this an infinite loop. :/
+ while [ "$UNCOMPRESSED" = "" ]; do
+ cat $package | $packagecompression -dc | LC_ALL=C dd 1> /dev/null 2> $TMP/tmpsize${MCOOKIE}
+ UNCOMPRESSED="$(cat $TMP/tmpsize${MCOOKIE} | tail -n 1 | cut -f 1 -d ' ' | numfmt --to=iec)"
+ done
+ rm -f $TMP/tmpsize${MCOOKIE}
# If we still don't have a package description, look inside the package.
# This requires a costly untar.
if [ "$DESCRIPTION" = "" ]; then
- mkdir -p $TMP/scan$$
- ( cd $TMP/scan$$ ; $packagecompression -dc | $TAR xf - install ) < $package 2> /dev/null
- if grep "^$packagebase:" "$TMP/scan$$/install/slack-desc" 1> /dev/null 2> /dev/null ; then
- DESCRIPTION="$TMP/scan$$/install/slack-desc"
- elif grep "^$shortname:" "$TMP/scan$$/install/slack-desc" 1> /dev/null 2> /dev/null ; then
- DESCRIPTION="$TMP/scan$$/install/slack-desc"
+ mkdir -p $TMP/scan${MCOOKIE}
+ ( cd $TMP/scan${MCOOKIE} ; $packagecompression -dc | tar xf - install ) < $package 2> /dev/null
+ if grep "^$packagebase:" "$TMP/scan${MCOOKIE}/install/slack-desc" 1> /dev/null 2> /dev/null ; then
+ DESCRIPTION="$TMP/scan${MCOOKIE}/install/slack-desc"
+ elif grep "^$shortname:" "$TMP/scan${MCOOKIE}/install/slack-desc" 1> /dev/null 2> /dev/null ; then
+ DESCRIPTION="$TMP/scan${MCOOKIE}/install/slack-desc"
fi
fi
@@ -406,20 +500,20 @@ for package in $* ; do
fi
# Gather package infomation into a temporary file:
- grep "^$packagebase:" $DESCRIPTION | cut -f 2- -d : | cut -b2- 1> $TMP/tmpmsg$$ 2> /dev/null
+ grep "^$packagebase:" $DESCRIPTION | cut -f 2- -d : | cut -b2- 1> $TMP/tmpmsg${MCOOKIE} 2> /dev/null
if [ "$shortname" != "$packagebase" ]; then
- grep "^$shortname:" $DESCRIPTION | cut -f 2- -d : | cut -b2- 1>> $TMP/tmpmsg$$ 2> /dev/null
+ grep "^$shortname:" $DESCRIPTION | cut -f 2- -d : | cut -b2- 1>> $TMP/tmpmsg${MCOOKIE} 2> /dev/null
fi
# Adjust the length here. This allows a slack-desc to be any size up to 13 lines instead of fixed at 11.
- LENGTH=$(wc -l < $TMP/tmpmsg$$ )
+ LENGTH=$(wc -l < $TMP/tmpmsg${MCOOKIE} )
while [ $LENGTH -lt 12 ]; do
- echo >> $TMP/tmpmsg$$
+ echo >> $TMP/tmpmsg${MCOOKIE}
LENGTH=$(expr $LENGTH + 1)
done
- echo "Size: Compressed: ${COMPRESSED}, uncompressed: ${UNCOMPRESSED}." >> $TMP/tmpmsg$$
+ echo "Size: Compressed: ${COMPRESSED}, uncompressed: ${UNCOMPRESSED}." >> $TMP/tmpmsg${MCOOKIE}
# For recent versions of dialog it is necessary to add \n to the end of each line
# or it will remove repeating spaces and mess up our careful formatting:
- cat << EOF > $TMP/controlns$$
+ cat << EOF > $TMP/controlns${MCOOKIE}
\n
\n
\n
@@ -434,9 +528,9 @@ for package in $* ; do
\n
\n
EOF
- paste -d "" $TMP/tmpmsg$$ $TMP/controlns$$ > $TMP/pasted$$
- rm -f $TMP/controlns$$
- mv $TMP/pasted$$ $TMP/tmpmsg$$
+ paste -d "" $TMP/tmpmsg${MCOOKIE} $TMP/controlns${MCOOKIE} > $TMP/pasted${MCOOKIE}
+ rm -f $TMP/controlns${MCOOKIE}
+ mv $TMP/pasted${MCOOKIE} $TMP/tmpmsg${MCOOKIE}
# Emit information to the console:
if [ "$MODE" = "install" ]; then
if [ "$PMSG" = "" ]; then
@@ -450,23 +544,33 @@ EOF
grep "^$shortname:" $DESCRIPTION | uniq | sed "s/^$shortname:/#/g"
fi
elif [ "$MODE" = "terse" ]; then # emit a single description line
- printf "%-72s %-6s\n" "$(echo $shortname: $(echo $(cat $DESCRIPTION | grep "^$packagebase:" | sed "s/^$packagebase: //g" | head -n 1 | tr -d '()' | sed "s/^$packagebase //g" ) $(echo " ......................................................................")) | cut -b1-72)" "[${UNCOMPRESSED}]" | cut -b1-80
+ ( flock 9 || exit 11
+ printf "%-$(expr $TERSELENGTH - 7)s %-6s\n" "$(echo $shortname: $(echo $(cat $DESCRIPTION | grep "^$packagebase:" | sed "s/^$packagebase: //g" | head -n 1 | tr -d '()' | sed "s/^$packagebase //g" ) $(echo " $(printf '.%.0s' {1..256})")) | cut -b1-$(expr $TERSELENGTH - 7))" "$(printf "[%4s]" $UNCOMPRESSED)"
+ ) 9> $INSTLOCKDIR/dialog.lock
elif [ "$MODE" = "infobox" ]; then # install infobox package
- dialog --title "Installing package $shortname $PMSG" --infobox "$(cat $TMP/tmpmsg$$)" 0 0
+ ( flock 9 || exit 11
+ dialog --title "Installing package $shortname $PMSG" --infobox "$(cat $TMP/tmpmsg${MCOOKIE})" 0 0
+ ) 9> $INSTLOCKDIR/dialog.lock
elif [ "$MODE" = "menu" -a "$PRIORITY" = "ADD" -a ! "$ALWAYSASK" = "yes" ]; then # ADD overrides menu mode unless -ask was used
- dialog --title "Installing package $shortname $PMSG" --infobox "$(cat $TMP/tmpmsg$$)" 0 0
+ ( flock 9 || exit 11
+ dialog --title "Installing package $shortname $PMSG" --infobox "$(cat $TMP/tmpmsg${MCOOKIE})" 0 0
+ ) 9> $INSTLOCKDIR/dialog.lock
elif [ "$MODE" = "menu" -a "$USERPRIORITY" = "ADD" ]; then # install no matter what $PRIORITY
- dialog --title "Installing package $shortname $PMSG" --infobox "$(cat $TMP/tmpmsg$$)" 0 0
+ ( flock 9 || exit 11
+ dialog --title "Installing package $shortname $PMSG" --infobox "$(cat $TMP/tmpmsg${MCOOKIE})" 0 0
+ ) 9> $INSTLOCKDIR/dialog.lock
else # we must need a full menu:
- dialog --title "Package Name: $shortname $PMSG" --menu "$(cat $TMP/tmpmsg$$)" 0 0 3 \
- "Yes" "Install package $shortname" \
- "No" "Do not install package $shortname" \
- "Quit" "Abort software installation completely" 2> $TMP/reply$$
- if [ ! $? = 0 ]; then
- echo "No" > $TMP/reply$$
- fi
- REPLY="$(cat $TMP/reply$$)"
- rm -f $TMP/reply$$ $TMP/tmpmsg$$
+ ( flock 9 || exit 11
+ dialog --title "Package Name: $shortname $PMSG" --menu "$(cat $TMP/tmpmsg${MCOOKIE})" 0 0 3 \
+ "Yes" "Install package $shortname" \
+ "No" "Do not install package $shortname" \
+ "Quit" "Abort software installation completely" 2> $TMP/reply${MCOOKIE}
+ if [ ! $? = 0 ]; then
+ echo "No" > $TMP/reply${MCOOKIE}
+ fi
+ ) 9> $INSTLOCKDIR/dialog.lock
+ REPLY="$(cat $TMP/reply${MCOOKIE})"
+ rm -f $TMP/reply${MCOOKIE} $TMP/tmpmsg${MCOOKIE}
if [ "$REPLY" = "Quit" ]; then
exit 99 # EXIT STATUS 99 = ABORT!
elif [ "$REPLY" = "No" ]; then
@@ -476,12 +580,12 @@ EOF
# Make sure there are no symbolic links sitting in the way of
# incoming package files:
- grep -v "/$" $TMP/tmplist$$ | while read file ; do
+ grep -v "/$" $TMP/tmplist${MCOOKIE} | while read file ; do
if [ -L "$ROOT/$file" ]; then
rm -f "$ROOT/$file"
fi
done
- rm -f $TMP/tmplist$$
+ rm -f $TMP/tmplist${MCOOKIE}
# Write the package file database entry and install the package:
echo "PACKAGE NAME: $shortname" > $ADM_DIR/packages/$shortname
@@ -498,56 +602,79 @@ EOF
grep "^$shortname:" $DESCRIPTION >> $ADM_DIR/packages/$shortname 2> /dev/null
fi
echo "FILE LIST:" >> $ADM_DIR/packages/$shortname
- ( cd $ROOT/ ; $packagecompression -dc | $TAR -xlUpvf - | sort ) < $package >> $TMP/$shortname 2> /dev/null
+ if [ "$INSTDIR" = "install" ]; then
+ ( cd $ROOT/ ; $packagecompression -dc | tar --acls --xattrs --xattrs-include='*' --keep-directory-symlink -xpvf - | LC_ALL=C sort ) < $package >> $TMP/$shortname 2> /dev/null
+ else
+ ( cd $ROOT/ ; $packagecompression -dc | tar --transform "s,^install$,$INSTDIR," --transform "s,^install/,$INSTDIR/," --acls --xattrs --xattrs-include='*' --keep-directory-symlink -xpvf - | LC_ALL=C sort ) < $package >> $TMP/$shortname 2> /dev/null
+ fi
if [ "$( grep '^\./' $TMP/$shortname | wc -l | tr -d ' ')" = "1" ]; then
# Good. We have a package that meets the Slackware spec.
cat $TMP/$shortname >> $ADM_DIR/packages/$shortname
else
# Some dumb bunny built a package with something other than makepkg. Bad!
# Oh well. Bound to happen. Par for the course. Fix it and move on...
- echo "WARNING: Package has not been created with 'makepkg'"
- echo './' >> $ADM_DIR/packages/$shortname
- cat $TMP/$shortname >> $ADM_DIR/packages/$shortname
+ # We'll assume it's just a recent tar with an unfiltered filelist with all
+ # files prefixed with "./". No guarantees, but this will usually work.
+ cat $TMP/$shortname | sed '2,$s,^\./,,' >> $ADM_DIR/packages/$shortname
fi
rm -f $TMP/$shortname
- # It's a good idea to make sure those newly installed libraries
- # are properly activated for use:
- if [ -x /sbin/ldconfig ]; then
- /sbin/ldconfig
+ # It's a good idea to make sure those newly installed libraries are properly
+ # activated for use, unless ROOT is pointing somewhere else in which case
+ # running ldconfig on the host system won't make any difference:
+ if [ "$ROOT" = "" ] && [ -x /sbin/ldconfig ]; then
+ ( flock 9 || exit 11
+ /sbin/ldconfig 2> /dev/null
+ ) 9> $INSTLOCKDIR/ldconfig.lock
fi
- if [ -f $ROOT/install/doinst.sh ]; then
+ if [ -f $ROOT/$INSTDIR/doinst.sh ]; then
if [ "$MODE" = "install" ]; then
echo "Executing install script for $(basename $package)."
fi
- # If bash is available, use sed to convert the install script to use pushd/popd
- # rather than spawning subshells which is slow on ARM. This will also speed up
- # install script processing on any platform.
- if [ -x /bin/bash ]; then
- ( cd $ROOT/ ; sed -e's?^( cd \([^;]*\);\(.*\) )$?pushd \1 \&\> /dev/null ; \2 ; popd \&\> /dev/null?g ' install/doinst.sh | /bin/bash ; )
- else
- ( cd $ROOT/ ; sh install/doinst.sh ; )
+ # Don't use locking if the script contains "NOLOCK":
+ if grep -q NOLOCK $ROOT/$INSTDIR/doinst.sh ; then
+ # If bash is available, use sed to convert the install script to use pushd/popd
+ # rather than spawning subshells which is slow on ARM. This will also speed up
+ # install script processing on any platform.
+ if [ -x /bin/bash ]; then
+ cd $ROOT/ ; sed -e's?^( cd \([^;]*\);\(.*\) )$?pushd \1 \&\> /dev/null ; \2 ; popd \&\> /dev/null?g ' $INSTDIR/doinst.sh | /bin/bash
+ else
+ cd $ROOT/ ; sh $INSTDIR/doinst.sh
+ fi
+ else # use locking
+ # If bash is available, use sed to convert the install script to use pushd/popd
+ # rather than spawning subshells which is slow on ARM. This will also speed up
+ # install script processing on any platform.
+ if [ -x /bin/bash ]; then
+ ( flock 9 || exit 11
+ cd $ROOT/ ; sed -e's?^( cd \([^;]*\);\(.*\) )$?pushd \1 \&\> /dev/null ; \2 ; popd \&\> /dev/null?g ' $INSTDIR/doinst.sh | /bin/bash
+ ) 9> $INSTLOCKDIR/doinst.sh.lock
+ else
+ ( flock 9 || exit 11
+ cd $ROOT/ ; sh $INSTDIR/doinst.sh
+ ) 9> $INSTLOCKDIR/doinst.sh.lock
+ fi
fi
fi
# Clean up the mess...
- if [ -d $ROOT/install ]; then
- if [ -r $ROOT/install/doinst.sh ]; then
- cp $ROOT/install/doinst.sh $ADM_DIR/scripts/$shortname
+ if [ -d $ROOT/$INSTDIR ]; then
+ if [ -r $ROOT/$INSTDIR/doinst.sh ]; then
+ 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.
- ( cd $ROOT/install ; rm -f doinst.sh slack-* 1> /dev/null 2>&1 )
- rmdir $ROOT/install 1> /dev/null 2>&1
+ # Heh, not any more with a recent tar :-)
+ ( cd $ROOT/$INSTDIR ; rm -f doinst.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:
- if [ -d "$TMP/scan$$" ]; then
- rm -rf "$TMP/scan$$"
+ if [ -d "$TMP/scan${MCOOKIE}" ]; then
+ rm -rf "$TMP/scan${MCOOKIE}"
fi
- rm -f $TMP/tmpmsg$$ $TMP/reply$$
+ rm -f $TMP/tmpmsg${MCOOKIE} $TMP/reply${MCOOKIE}
if [ "$MODE" = "install" ]; then
echo "Package $(basename $package) installed."
- echo
fi
done
diff --git a/source/a/pkgtools/scripts/makebootdisk b/source/a/pkgtools/scripts/makebootdisk
index 86b843a8..93ccc5a9 100644
--- a/source/a/pkgtools/scripts/makebootdisk
+++ b/source/a/pkgtools/scripts/makebootdisk
@@ -10,7 +10,7 @@
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
@@ -206,8 +206,8 @@ format_disk() {
fdformat $FDEV 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
dialog --title "ERROR: FLOPPY FORMAT FAILED" --msgbox "The attempt to format the floppy \
-disk in /dev/fd0 has failed, probably due to bad media. Please try again with a \
-different disk. If that doesn't work, perhaps the drive needs cleaning." 0 0
+disk in /dev/fd0 has failed, probably due to bad media. Please try again with a \
+different disk. If that doesn't work, perhaps the drive needs cleaning." 0 0
return 1
fi
}
@@ -218,8 +218,8 @@ while [ 0 ]; do # menu loop
dialog --title "MAKE BOOT FLOPPY FROM KERNEL" \
--default-item $DEFAULT_ITEM \
--backtitle "$KMSG" --menu "This menu allows you to make a SYSLINUX bootdisk \
-from a compiled kernel. The SYSLINUX bootloader has the advantage of \
-using a FAT filesystem making it easy to replace the kernel later. \
+from a compiled kernel. The SYSLINUX bootloader has the advantage of \
+using a FAT filesystem making it easy to replace the kernel later. \
Which option would you like?" 12 67 2 \
"syslinux" "Make a SYSLINUX bootdisk" \
"exit" "Exit this program" 2> $TMP/return
@@ -238,7 +238,7 @@ cat << EOF > $TMP/tmpmsg
The kernel $KERNEL is $kernel_size K (which is
more than 1023 Kb in size), so it probably won't
-boot standalone on the floppy. Use the 'syslinux'
+boot standalone on the floppy. Use the 'syslinux'
method instead.
EOF
@@ -271,9 +271,9 @@ YES creates the disk, NO aborts.\n" 14 62
choose_kernel
fi
dialog --title "CREATING SYSLINUX BOOTDISK IN /dev/fd0" --backtitle "$KMSG" --yesno "Now put a \
-floppy in your boot drive. This will be made into a SYSLINUX \
-bootdisk that you can use to start your Linux system. Any data on the \
-target disk will be destroyed. YES creates the disk, NO aborts." 8 62
+floppy in your boot drive. This will be made into a SYSLINUX \
+bootdisk that you can use to start your Linux system. Any data on the \
+target disk will be destroyed. YES creates the disk, NO aborts." 8 62
if [ $? = 0 ]; then # make the disk
format_disk
if [ ! $? = 0 ]; then
@@ -292,7 +292,7 @@ $ROOT_DEVICE in /dev/fd0." 3 64
if [ ! "$?" = "0" ]; then
dialog --title "ERROR COPYING KERNEL TO FLOPPY" \
--msgbox "Sorry, but there was an error copying the kernel to the \
-floppy disk. Possibly the kernel is too large to fit the disk. \
+floppy disk. Possibly the kernel is too large to fit the disk. \
This program will now exit." 0 0
umount /dev/fd0
rm -rf $TMP/bootdisk
@@ -303,15 +303,15 @@ This program will now exit." 0 0
Welcome to the 09Slackware07 Linux custom bootdisk!
By default, this disk boots a root Linux partition on $ROOT_DEVICE when you
-hit ENTER. If you'd like to boot some other partition, use a command like
+hit ENTER. If you'd like to boot some other partition, use a command like
this on the prompt below:
mount root=/dev/sda1 ro
Where "/dev/sda1" is the partition you want to boot, and "ro" specifies that
-the partition should be initially mounted as read-only. If you wish to mount
-the partition read-write, use "rw" instead. To set the video console mode,
-use the vga= parameter (press F1 to see a table). You may also add any other
+the partition should be initially mounted as read-only. If you wish to mount
+the partition read-write, use "rw" instead. To set the video console mode,
+use the vga= parameter (press F1 to see a table). You may also add any other
kernel parameters you might need depending on your hardware, and which
drivers are included in your kernel.
@@ -341,7 +341,7 @@ EOF
FRAMEBUFFER MODES:
To get the kernel to start in VESA framebuffer mode, you need to pass it
- a vga= init string on the "boot:" prompt. Here's a table:
+ a vga= init string on the "boot:" prompt. Here's a table:
Colors 640x480 800x600 1024x768 1280x1024 1600x1200
--------+---------------------------------------------
@@ -376,9 +376,9 @@ EOF
choose_kernel
fi
dialog --title "CREATING LILO BOOTDISK IN /dev/fd0" --backtitle "$KMSG" --yesno "Now put a \
-floppy in your boot drive. This will be made into a LILO \
-bootdisk that you can use to start your Linux system. Any data on the \
-target disk will be destroyed. YES creates the disk, NO aborts." 8 62
+floppy in your boot drive. This will be made into a LILO \
+bootdisk that you can use to start your Linux system. Any data on the \
+target disk will be destroyed. YES creates the disk, NO aborts." 8 62
if [ $? = 0 ]; then # make the disk
format_disk
DEV=/dev/fd0u1680
@@ -422,14 +422,14 @@ EOF
Welcome to the Slackware Linux custom LILO bootdisk!
By default, this disk boots a root Linux partition on $ROOT_DEVICE when
-you hit ENTER. If you'd like to boot some other partition, use a command
+you hit ENTER. If you'd like to boot some other partition, use a command
like this on the LILO prompt below:
mount root=/dev/sda1 ro
Where "/dev/sda1" is the partition you want to boot, and "ro" specifies that
-the partition should be initially mounted as read-only. If you which to mount
-the partition read-write, use "rw" instead. You may also add any other kernel
+the partition should be initially mounted as read-only. If you which to mount
+the partition read-write, use "rw" instead. You may also add any other kernel
parameters you might need depending on your hardware, and which drivers are
included in your kernel.
diff --git a/source/a/pkgtools/scripts/makepkg b/source/a/pkgtools/scripts/makepkg
index 25c5f236..f9241cb9 100644
--- a/source/a/pkgtools/scripts/makepkg
+++ b/source/a/pkgtools/scripts/makepkg
@@ -1,7 +1,7 @@
#!/bin/sh
# Copyright 1994, 1998, 2008 Patrick Volkerding, Moorhead, Minnesota USA
# Copyright 2003 Slackware Linux, Inc. Concord, CA USA
-# Copyright 2009, 2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2009, 2015, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,6 +21,16 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+# Mon May 21 18:31:20 UTC 2018
+# Add --compress option, usually used to change the preset compression level
+# or block size.
+#
+# Tue Feb 13 00:46:12 UTC 2018
+# Use recent tar, and support storing POSIX ACLs and extended attributes.
+#
+# Tue Dec 12 21:55:59 UTC 2017
+# If possible, use multiple compression threads.
+#
# Wed Sep 23 18:36:43 UTC 2015
# Support spaces in file/directory names. <alphageek>
#
@@ -36,23 +46,7 @@
CWD=$(pwd)
-TAR=tar-1.13
umask 022
-$TAR --help 1> /dev/null 2> /dev/null
-if [ ! $? = 0 ]; then
- TAR=tar
-fi
-if [ ! "$(LC_MESSAGES=C $TAR --version)" = "tar (GNU tar) 1.13
-
-Copyright (C) 1988, 92,93,94,95,96,97,98, 1999 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-Written by John Gilmore and Jay Fenlason." ]; then
- echo "WARNING: pkgtools are unstable with tar > 1.13."
- echo " You should provide a \"tar-1.13\" in your \$PATH."
- sleep 5
-fi
make_install_script() {
TAB="$(echo -e "\t")"
@@ -80,26 +74,48 @@ Usage: makepkg package_name.tgz
(or: package_name.tbz, package_name.tlz, package_name.txz)
Makes a Slackware compatible package containing the contents of the current
-and all subdirectories. If symbolic links exist, they will be removed and
+and all subdirectories. If symbolic links exist, they will be removed and
an installation script will be made to recreate them later. This script will
be called "install/doinst.sh". You may add any of your own ash-compatible
shell scripts to this file and rebuild the package if you wish.
options: -l, --linkadd y|n (moves symlinks into doinst.sh: recommended)
-p, --prepend (prepend rather than append symlinks to an existing
- doinst.sh. Useful to link libraries needed by
- programs in the doinst.sh script)
- -c, --chown y|n (resets all permissions to root:root 755
- - not generally recommended)
+ doinst.sh. Useful to link libraries needed by programs in
+ the doinst.sh script)
+ -c, --chown y|n (resets all permissions to root:root 755 - not
+ generally recommended)
+ --threads <number> For xz/plzip compressed packages, set the max
+ number of threads to be used for compression. Only has an
+ effect on large packages. For plzip, the default is equal to
+ the number of CPU threads available on the machine. For xz,
+ the default is equal to 2 (due to commonly occuring memory
+ related failures when using many threads with multi-threaded
+ xz compression).
+ --compress <option> Supply a custom option to the compressor.
+ This will be used in place of the default, which is: -9
+ --acls Support storing POSIX ACLs in the package. The resulting
+ package will not be compatible with pkgtools version < 15.0.
+ --xattrs Support storing extended attributes in the package. The
+ resulting package will not be compatible with pkgtools
+ version < 15.0.
-If these options are not set, makepkg will prompt as appropriate.
+If these options are not set, makepkg will prompt if appropriate.
EOF
}
TMP=/tmp # This can be a hole, but I'm going to be careful about file
# creation in there, so don't panic. :^)
+# Set maximum number of threads to use. By default, this will be the number
+# of CPU threads:
+THREADS="$(nproc)"
+
+# Set default compression option.
+COMPRESS_OPTION="-9"
+
# Parse options
+unset ACLS XATTRS
while [ 0 ]; do
if [ "$1" = "--linkadd" -o "$1" = "-l" ]; then
if [ "$2" = "y" ]; then
@@ -124,6 +140,21 @@ while [ 0 ]; do
elif [ "$1" = "-p" -o "$1" = "--prepend" ]; then
PREPEND=y
shift 1
+ elif [ "$1" = "-threads" -o "$1" = "--threads" ]; then
+ THREADS="$2"
+ shift 2
+ # xz has memory issues with threads it seems, so we'll use two threads by
+ # default unless we see that something else was user-selected:
+ XZ_THREADS_FORCED=yes
+ elif [ "$1" = "-compress" -o "$1" = "--compress" ]; then
+ COMPRESS_OPTION="$2"
+ shift 2
+ elif [ "$1" = "--acls" ]; then
+ ACLS="--acls"
+ shift 1
+ elif [ "$1" = "--xattrs" ]; then
+ XATTRS="--xattrs"
+ shift 1
elif [ "$1" = "-h" -o "$1" = "-H" -o "$1" = "--help" -o $# = 0 ]; then
usage
exit 0
@@ -136,26 +167,109 @@ PACKAGE_NAME="$1"
TARGET_NAME="$(dirname $PACKAGE_NAME)"
PACKAGE_NAME="$(basename $PACKAGE_NAME)"
-# Identify package extension:
+# Identify package extension and compression type to use:
if [ ! "$(basename $PACKAGE_NAME .tgz)" = "$PACKAGE_NAME" ]; then
EXTENSION="tgz"
+ COMPEXT="gz"
+ COMPRESSOR="gzip ${COMPRESS_OPTION} -c"
+ if ! which gzip 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: gzip compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tar.gz)" = "$PACKAGE_NAME" ]; then
- # .tar.compression is also supported, although the resulting "packages" will
- # not be installable by installpkg without the correct 3 letter extension
- # instead.
EXTENSION="tar.gz"
+ COMPRESSOR="gzip ${COMPRESS_OPTION} -c"
+ if ! which gzip 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: gzip compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tbz)" = "$PACKAGE_NAME" ]; then
EXTENSION="tbz"
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="lbzip2 ${COMPRESS_OPTION} -c"
+ else
+ if which bzip2 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="bzip2 ${COMPRESS_OPTION} -c"
+ else
+ echo "ERROR: bzip2 compression utility not found in \$PATH."
+ exit 3
+ fi
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tar.bz2)" = "$PACKAGE_NAME" ]; then
EXTENSION="tar.bz2"
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="lbzip2 ${COMPRESS_OPTION} -c"
+ else
+ if which bzip2 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="bzip2 ${COMPRESS_OPTION} -c"
+ else
+ echo "ERROR: bzip2 compression utility not found in \$PATH."
+ exit 3
+ fi
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tlz)" = "$PACKAGE_NAME" ]; then
EXTENSION="tlz"
+ if which plzip 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="plzip ${COMPRESS_OPTION} --threads=${THREADS} -c"
+ else
+ echo "WARNING: plzip compression utility not found in \$PATH."
+ echo "WARNING: package will not support multithreaded decompression."
+ if which lzip 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="lzip ${COMPRESS_OPTION} -c"
+ else
+ echo "ERROR: lzip compression utility not found in \$PATH."
+ exit 3
+ fi
+ fi
+elif [ ! "$(basename $PACKAGE_NAME .tar.lz)" = "$PACKAGE_NAME" ]; then
+ EXTENSION="tar.lz"
+ if which plzip 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="plzip ${COMPRESS_OPTION} --threads=${THREADS} -c"
+ else
+ echo "WARNING: plzip compression utility not found in \$PATH."
+ echo "WARNING: package will not support multithreaded decompression."
+ if which lzip 1> /dev/null 2> /dev/null ; then
+ COMPRESSOR="lzip ${COMPRESS_OPTION} -c"
+ else
+ echo "ERROR: lzip compression utility not found in \$PATH."
+ exit 3
+ fi
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tar.lzma)" = "$PACKAGE_NAME" ]; then
EXTENSION="tar.lzma"
+ COMPRESSOR="lzma ${COMPRESS_OPTION} -c"
+ if ! which lzma 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: lzma compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .txz)" = "$PACKAGE_NAME" ]; then
EXTENSION="txz"
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ # Two threads by default with xz due to memory failures on 32-bit. Not that
+ # it matters much... if upstream ever gets around to implementing multi-
+ # threaded decompression we'll revisit this default. :-D
+ COMPRESSOR="xz ${COMPRESS_OPTION} --threads=2 -c"
+ else
+ COMPRESSOR="xz ${COMPRESS_OPTION} --threads=${THREADS} -c"
+ fi
+ if ! which xz 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: xz compression utility not found in \$PATH."
+ exit 3
+ fi
elif [ ! "$(basename $PACKAGE_NAME .tar.xz)" = "$PACKAGE_NAME" ]; then
EXTENSION="tar.xz"
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ # Two threads by default with xz due to memory failures on 32-bit. Not that
+ # it matters much... if upstream ever gets around to implementing multi-
+ # threaded decompression we'll revisit this default. :-D
+ COMPRESSOR="xz ${COMPRESS_OPTION} --threads=2 -c"
+ else
+ COMPRESSOR="xz ${COMPRESS_OPTION} --threads=${THREADS} -c"
+ fi
+ if ! which xz 1> /dev/null 2> /dev/null ; then
+ echo "ERROR: xz compression utility not found in \$PATH."
+ exit 3
+ fi
else
EXTENSION="$(echo $PACKAGE_NAME | rev | cut -f 1 -d . | rev)"
echo "ERROR: Package extension .$EXTENSION is not supported."
@@ -170,36 +284,8 @@ if [ "$CWD" = "$TARGET_NAME" -o "." = "$TARGET_NAME" ]; then
exit 2
fi
-# Make sure external compression utility is available:
-case $EXTENSION in
-'tgz' | 'tar.gz' )
- if ! which gzip 1> /dev/null 2> /dev/null ; then
- echo "ERROR: gzip compression utility not found in \$PATH."
- exit 3
- fi
- ;;
-'tbz' | 'tar.bz2' )
- if ! which bzip2 1> /dev/null 2> /dev/null ; then
- echo "ERROR: bzip2 compression utility not found in \$PATH."
- exit 3
- fi
- ;;
-'tlz' | 'tar.lzma' )
- if ! which lzma 1> /dev/null 2> /dev/null ; then
- echo "ERROR: lzma compression utility not found in \$PATH."
- exit 3
- fi
- ;;
-'txz' | 'tar.xz' )
- if ! which xz 1> /dev/null 2> /dev/null ; then
- echo "ERROR: xz compression utility not found in \$PATH."
- exit 3
- fi
- ;;
-esac
-
echo
-echo "Slackware package maker, version 3.141593."
+echo "Slackware package maker, version 3.14159265."
echo
echo "Searching for symbolic links:"
# Get rid of possible pre-existing trouble:
@@ -303,36 +389,27 @@ fi
echo "Creating Slackware package: ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}"
echo
rm -f ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
-case $EXTENSION in
-'tgz' | 'tar.gz' )
- $TAR cvf - . | gzip -9c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $? = 0 ]; then
- echo "ERROR: gzip returned error code $? -- makepkg failed."
- fi
- ;;
-'tbz' | 'tar.bz2' )
- $TAR cvf - . | bzip2 -9c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $ERRCODE = 0 ]; then
- echo "ERROR: bzip2 returned error code $ERRCODE -- makepkg failed."
- fi
- ;;
-'tlz' | 'tar.lzma' )
- $TAR cvf - . | lzma -c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $ERRCODE = 0 ]; then
- echo "ERROR: lzma returned error code $ERRCODE -- makepkg failed."
- fi
- ;;
-'txz' | 'tar.xz' )
- $TAR cvf - . | xz -c > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
- ERRCODE=$?
- if [ ! $ERRCODE = 0 ]; then
- echo "ERROR: xz returned error code $ERRCODE -- makepkg failed."
- fi
- ;;
-esac
+
+# HISTORICAL NOTE 2/2018:
+# In the interest of maximizing portability of this script, we'll use find
+# and sed to create a filelist compatible with tar-1.13, and then use a
+# more modern tar version to create the archive.
+#
+# Other (but possibly less portable) ways to achieve the same result:
+#
+# Use the tar --transform and --show-transformed-names options:
+# tar --transform "s,^\./\(.\),\1," --show-transformed-names $ACLS $XATTRS -cvf - . | $COMPRESSOR > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
+#
+# Use cpio:
+# find ./ | sed '2,$s,^\./,,' | cpio --quiet -ovHustar > ${TARGET_NAME}/${TAR_NAME}.tar
+
+# Create the package:
+find ./ | sed '2,$s,^\./,,' | tar --no-recursion $ACLS $XATTRS -T - -cvf - | $COMPRESSOR > ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
+ERRCODE=$?
+if [ ! $ERRCODE = 0 ]; then
+ echo "ERROR: $COMPRESSOR returned error code $ERRCODE -- makepkg failed."
+ exit 1
+fi
# Warn of zero-length files:
find . -type f -size 0c | while read file ; do
diff --git a/source/a/pkgtools/scripts/pkgdiff b/source/a/pkgtools/scripts/pkgdiff
new file mode 100644
index 00000000..ca21ad8f
--- /dev/null
+++ b/source/a/pkgtools/scripts/pkgdiff
@@ -0,0 +1,164 @@
+#!/bin/sh
+# Copyright 2002 Patrick J. Volkerding, Concord, CA, USA
+# Copyright 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+CWD=$(pwd)
+
+# Display usage for basic usage errors:
+usage() {
+ cat << EOF
+pkgdiff: missing file arguments
+Try 'pkgdiff --help' for more information.
+EOF
+}
+
+# Display full --help if requested:
+helpme() {
+ cat << EOF
+Usage: pkgdiff [OPTION] FILE1 FILE2
+Show which files are new and which are removed between two tar archives.
+The tar archives may be uncompressed, or compressed with gzip, bzip2,
+xz, or lzip. Also works with .rpm and .deb.
+
+ --help display this help and exit
+ -c use ANSI color with default tree mode
+ -a show simple text (ASCII) diff of package file lists
+
+By default, the trees are drawn with in crude ASCII with no color. For
+the full-color effect, try something like this:
+
+ pkgdiff -c package1 package2 | less -r
+
+EOF
+ # --help doesn't return
+ exit 22
+}
+
+# How the heck do I open this?
+explode() {
+ tar xf $1 1> /dev/null 2> /dev/null
+ # Check for common extensions and do additional magic:
+ if [ ! "$(basename $1)" = "$(basename $1 .zip)" ]; then
+ unzip $1 1> /dev/null 2> /dev/null
+ fi
+ if [ ! "$(basename $1)" = "$(basename $1 .rpm)" ]; then
+ cp $1 .
+ rpm2tgz $(basename $1) 1> /dev/null 2> /dev/null
+ rm -f $(basename $1)
+ tar xzf $(basename $1 .rpm).tgz 1> /dev/null 2> /dev/null
+ rm -f $(basename $1 .rpm).tgz
+ fi
+ if [ ! "$(basename $1)" = "$(basename $1 .deb)" ]; then
+ cp $1 .
+ ar x $(basename $1) 1> /dev/null 2> /dev/null
+ tar xf data.tar.xz 1> /dev/null 2> /dev/null
+ rm -f * 2> /dev/null
+ fi
+ # Diffs for other archive formats are welcome.
+}
+
+# Parse options.
+# -c turns on colorization ala dircolors:
+unset COLOR
+if [ "$1" = "-c" ]; then
+ COLOR="-C"
+ shift 1
+fi
+if [ "$1" = "-a" ]; then
+ ASCII=true
+ shift 1
+fi
+if [ "$1" = "--help" ]; then
+ helpme
+fi
+
+TMPDIR=$(mktemp -d)
+cd $TMPDIR
+
+if [ ! -r "$1" ]; then
+ if [ -d "$CWD/$1" ]; then
+ usage
+ exit 99
+ else
+ PKG1="$CWD/$1"
+ fi
+else
+ PKG1="$1"
+fi
+
+if [ ! -r "$2" ]; then
+ if [ -d "$CWD/$2" ]; then
+ usage
+ #echo "pkgdiff -- find the difference between two tar archives"
+ #echo "usage: pkgdiff [ -C ] pkg1 pkg2"
+ exit 99
+ else
+ PKG2="$CWD/$2"
+ fi
+else
+ PKG2="$2"
+fi
+
+# We have to account for the possibility that the packages have the
+# same name, but different contents...
+if [ "$(basename $PKG1)" = "$(basename $PKG2)" ]; then
+ PKG1=${PKG1}.orig
+fi
+
+# This will be mighty safe even if we ended up in /tmp.
+PKG=.pkgdiff.$(mcookie)
+
+( mkdir -p $TMPDIR/$PKG/1
+ cd $TMPDIR/$PKG/1
+ if [ -r $PKG1 ]; then
+ explode $PKG1
+ elif [ -r $(dirname $PKG1)/$(basename $PKG1 .orig) ]; then
+ explode $(dirname $PKG1)/$(basename $PKG1 .orig)
+ fi
+ if [ ! "$ASCII" = "true" ]; then
+ tree $COLOR -a --noreport > ../$(basename $PKG1)
+ else
+ find ./ | sed '2,$s,^\./,,' | tar --no-recursion -T - -cf - | tar tf - | sort > ../$(basename $PKG1)
+ fi
+)
+( mkdir -p $TMPDIR/$PKG/2
+ cd $TMPDIR/$PKG/2
+ explode $PKG2
+ if [ ! "$ASCII" = "true" ]; then
+ tree $COLOR -a --noreport > ../$(basename $PKG2)
+ else
+ find ./ | sed '2,$s,^\./,,' | tar --no-recursion -T - -cf - | tar tf - | sort > ../$(basename $PKG2)
+ fi
+)
+
+# Always going that extra mile... ;)
+if [ -r $PKG1 ]; then
+ touch -r $PKG1 $TMPDIR/$PKG/$(basename $PKG1)
+elif [ -r $(dirname $PKG1)/$(basename $PKG1 .orig) ]; then
+ touch -r $(dirname $PKG1)/$(basename $PKG1 .orig) $TMPDIR/$PKG/$(basename $PKG1)
+fi
+touch -r $PKG2 $TMPDIR/$PKG/$(basename $PKG2)
+
+rm -rf $TMPDIR/$PKG/{1,2}
+( cd $TMPDIR/$PKG ; diff -d -u $(basename $PKG1) $(basename $PKG2) )
+
+# cleanup:
+rm -rf $PKG $TMPDIR
diff --git a/source/a/pkgtools/scripts/pkgtool b/source/a/pkgtools/scripts/pkgtool
index fd77f298..000bb002 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 Patrick Volkerding, Sebeka, MN, USA
+# Copyright 2007, 2009, 2010, 2011, 2013, 2015, 2016 Patrick Volkerding, Sebeka, MN, USA
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
@@ -13,7 +13,7 @@
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
@@ -43,15 +43,6 @@
# Wed Jan 26 23:06:22 GMT 2005
# * Fix for non-standard package descriptions by Jim Hawkins
-# Avoid problems if any files in /var/log/packages and /var/log/scripts
-# might contain any broken UTF-8 sequences. This was once known to cause
-# dialog to crash.
-unset LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
- LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
- LC_IDENTIFICATION LC_ALL
-LANG=C
-export LANG
-
# Return a package name that has been stripped of the dirname portion
# and any of the valid extensions (only):
pkgbase() {
@@ -86,7 +77,7 @@ if [ -L /bin/chmod -a -L /bin/chown ]; then # probably on the bootdisk using bus
echo
echo
echo "You can't run pkgtool from the rootdisk until you've mounted your Linux"
- echo "partitions beneath /mnt. Here are some examples:"
+ echo "partitions beneath /mnt. Here are some examples:"
echo
echo "If your root partition is /dev/sda1 you would type:"
echo "mount /dev/sda1 /mnt"
@@ -220,12 +211,11 @@ else # there were no arguments, so we'll get the needed information from the
CMD_START="true"
rm -f $TMP/SeT*
while [ 0 ]; do
- dialog --title "Slackware Package Tool (pkgtool version 14.2)" \
+ dialog --title "Slackware Package Tool (pkgtool version 15.0)" \
--menu "\nWelcome to the Slackware package tool.\n\
-\nWhich option would you like?\n" 17 75 7 \
+\nWhich option would you like?\n" 16 75 6 \
"Current" "Install packages from the current directory" \
"Other" "Install packages from some other directory" \
-"Floppy" "Install packages from floppy disks" \
"Remove" "Remove packages that are currently installed" \
"View" "View the list of files contained in a package" \
"Setup" "Choose Slackware installation scripts to run again" \
@@ -243,7 +233,7 @@ else # there were no arguments, so we'll get the needed information from the
fi
if [ "$REPLY" = "Setup" ]; then
echo 'dialog --title "SELECT SYSTEM SETUP SCRIPTS" --item-help --checklist \
- "Please use the spacebar to select the setup scripts to run. Hit enter when you \
+ "Please use the spacebar to select the setup scripts to run. Hit enter when you \
are done selecting to run the scripts." 17 70 9 \' > $TMP/setupscr
for script in $ADM_DIR/setup/setup.* ; do
BLURB=$(grep '#BLURB' $script | cut -b8-)
@@ -273,10 +263,10 @@ create_list_of_installed_packages
#Pkgtool scans your system to determine which packages you have \
#installed and prepares a list for you." 0 0
(
- echo 'dialog $DEFITEM --item-help --menu "Please select the package you wish to view." 17 68 10 \
- --file $TMP/list_of_installed_packages \'
- echo "2> $TMP/return"
+ echo 'dialog $DEFITEM --item-help --menu "Please select the package you wish to view." 17 68 10 \'
) > $TMP/viewscr
+ cat $TMP/list_of_installed_packages >> $TMP/viewscr
+ echo "2> $TMP/return" >> $TMP/viewscr
while [ 0 ]; do
. $TMP/viewscr
if [ ! "$(cat $TMP/return)" = "" ]; then
@@ -306,11 +296,11 @@ dialog --title "SELECT PACKAGES TO REMOVE" --item-help --checklist \
"Please select the \
packages you wish to Remove. Use the \
spacebar to select packages to delete, and the UP/DOWN arrow keys to \
-scroll up and down through the entire list." 20 75 11 \
---file $TMP/temporary_list \\
+scroll up and down through the entire list." 20 75 11 \\
EOF
- echo "2> $TMP/return"
) > $TMP/rmscript
+ cat $TMP/temporary_list >> $TMP/rmscript
+ echo "2> $TMP/return" >> $TMP/rmscript
if [ -L $LOG -o -r $LOG ]; then
rm -f $LOG
fi
@@ -334,39 +324,6 @@ in $TMP: PKGTOOL.REMOVED." 0 0
chmod 1777 /tmp
# No, return to the main menu:
# exit
- elif [ "$REPLY" = "Floppy" ]; then
- dialog --title "SELECT FLOPPY DRIVE" --menu "Which floppy drive would \
-you like to install from?" \
-11 70 4 \
-"/dev/fd0u1440" "1.44 MB first floppy drive" \
-"/dev/fd1u1440" "1.44 MB second floppy drive" \
-"/dev/fd0h1200" "1.2 MB first floppy drive" \
-"/dev/fd1h1200" "1.2 MB second floppy drive" 2> $TMP/wdrive
- if [ $? = 1 ]; then
- dialog --clear
- exit
- fi
- SOURCE_DEVICE="$(cat $TMP/wdrive)"
- rm -f $TMP/wdrive
- cat << EOF > $TMP/tmpmsg
-
-Enter the names of any disk sets you would like to install.
-Separate the sets with a space, like this: a b oi x
-
-To install packages from one disk, hit [enter] without typing
-anything.
-
-EOF
- dialog --title "SOFTWARE SELECTION" --inputbox "$(cat $TMP/tmpmsg)" 13 70 2> $TMP/sets
- DISK_SETS="$(cat $TMP/sets)"
- rm -f $TMP/sets
- if [ "$DISK_SETS" = "" ]; then
- DISK_SETS="disk"
- else
- DISK_SETS=$(echo $DISK_SETS | sed 's/ /#/g')
- DISK_SETS="#$DISK_SETS"
- fi
- break;
elif [ "$REPLY" = "Other" ]; then
dialog --title "SELECT SOURCE DIRECTORY" --inputbox "Please enter the name of the directory that you wish to \
install packages from:" 10 50 2> $TMP/pkgdir
@@ -562,7 +519,7 @@ install_disk() {
fi # ! "$DISK_SETS" = "disk"
- # It's possible that the tagfile was specified on the command line. If that's
+ # It's possible that the tagfile was specified on the command line. If that's
# the case, then we'll just override whatever we figured out up above.
if [ ! "$USETAG" = "" ]; then
cat $USETAG > $TMP/tagfile
diff --git a/source/a/pkgtools/scripts/removepkg b/source/a/pkgtools/scripts/removepkg
index 2813fc3c..14af10f3 100644
--- a/source/a/pkgtools/scripts/removepkg
+++ b/source/a/pkgtools/scripts/removepkg
@@ -1,6 +1,50 @@
#!/bin/sh
# Slackware remove package script
#
+# 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
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# Sun May 27 18:02:23 UTC 2018
+# Added --terse mode to print one line per removed package.
+#
+# Wed May 23 17:31:23 UTC 2018
+# Use file locking to prevent more than one copy of ldconfig from running at
+# a time.
+#
+# Thu Sep 15 17:46:28 UTC 2016 <volkerdi>
+# If removepkg is called with a short package name (no -$VERSION-$ARCH-$BUILD),
+# remove the most recently installed matching package, not the oldest one.
+#
+# Thu Sep 15 08:09:01 BST 2016 <mozes>
+# - Handle finding >1 match for a package. Thanks to SeB on LQ for the feedback.
+#
+# Wed Sep 14 20:44:00 BST 2016 <mozes>
+# - Modify package_name function to cater for package file names that contain
+# >=4 hyphens.
+# Thanks to coralfang on LQ for the report and to Jim Hawkins for the patch.
+# - Modified to handle packages that contain file names with backslashes
+# Thanks to aaazen on LQ for the report and the patch.
+#
# Thu Sep 24 03:31:58 UTC 2015 <alphageek>
# extract_links() sed adjusted to handle symlinks with spaces.
#
@@ -76,28 +120,8 @@
# Original Version from Slackware 3.0
#
-# Copyright 1994, 1995, 1998 Patrick Volkerding, Moorhead, Minnesota USA
-# Copyright 2001, Slackware Linux, Inc., Concord, CA USA
-# Copyright 2009, 2015 Patrick J. Volkerding, Sebeka, MN, USA
-# All rights reserved.
-#
-# Redistribution and use of this script, with or without modification, is
-# permitted provided that the following conditions are met:
-#
-# 1. Redistributions of this script must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
+# Needed to find package names within the 'remove_packages' function:
+shopt -s extglob
# Return a package name that has been stripped of the dirname portion
# and any of the valid extensions (only):
@@ -120,6 +144,13 @@ fi
ADM_DIR=$ROOT/var/log
PRES_DIR=$TMP/preserved_packages
+# Lock directory for ldconfig... share it with installpkg so that upgradepkg
+# becomes properly ldconfig-locked, too.
+INSTLOCKDIR=${INSTLOCKDIR:-/run/installpkg-lock}
+if [ ! -d $INSTLOCKDIR ]; then
+ mkdir -p $INSTLOCKDIR
+fi
+
# This simple cat_except() should be used on the installer,
# since the busybox "find" can't handle the complex find
# syntax:
@@ -131,8 +162,8 @@ PRES_DIR=$TMP/preserved_packages
# removed when ROOT= is used:
cat_except() {
( cd "$1" && \
- if [ $(find . -type f -maxdepth 1 | wc -l) -ne 1 ]; then
- cat $(find . -type f -maxdepth 1 | grep -v "$2")
+ if [ $(find . -type f -maxdepth 1 2> /dev/null | wc -l) -ne 1 ]; then
+ cat $(find . -type f -maxdepth 1 2> /dev/null | grep -v "$2") 2> /dev/null
fi
)
}
@@ -166,11 +197,11 @@ keep_files() {
while read FILE ; do
if [ ! -d "$ROOT/$FILE" ]; then
if [ -r "$ROOT/$FILE" ]; then
- echo " --> $ROOT/$FILE was found in another package. Skipping."
+ ! [ $TERSE ] && echo " --> $ROOT/$FILE was found in another package. Skipping."
preserve_file "$FILE"
else
if [ "$(echo $FILE | cut -b1-8)" != "install/" ]; then
- echo "WARNING: Nonexistent $ROOT/$FILE was found in another package. Skipping."
+ ! [ $TERSE ] && echo "WARNING: Nonexistent $ROOT/$FILE was found in another package. Skipping."
fi
fi
else
@@ -182,29 +213,31 @@ keep_files() {
keep_links() {
while read LINK ; do
if [ -L "$ROOT/$LINK" ]; then
- echo " --> $ROOT/$LINK (symlink) was found in another package. Skipping."
+ ! [ $TERSE ] && echo " --> $ROOT/$LINK (symlink) was found in another package. Skipping."
else
- echo "WARNING: Nonexistent $ROOT/$LINK (symlink) was found in another package. Skipping."
+ ! [ $TERSE ] && echo "WARNING: Nonexistent $ROOT/$LINK (symlink) was found in another package. Skipping."
fi
done
}
delete_files() {
- while read FILE ; do
+ local unset LC_ALL # Locally (within this delete_files function) allow handling of backslashes
+ while read -r AFILE ; do # do not expand backslashes on read
+ FILE=$(printf "%b" "$AFILE") # unescape octal characters
if [ ! -d "$ROOT/$FILE" ]; then
if [ -r "$ROOT/$FILE" ]; then
if [ "$ROOT/$FILE" -nt "$ADM_DIR/packages/$PKGNAME" ]; then
- echo "WARNING: $ROOT/$FILE changed after package installation."
+ ! [ $TERSE ] && echo "WARNING: $ROOT/$FILE changed after package installation."
fi
if [ ! "$WARN" = "true" ]; then
- echo " --> Deleting $ROOT/$FILE"
+ ! [ $TERSE ] && echo " --> Deleting $ROOT/$FILE"
preserve_file "$FILE" && rm -f "$ROOT/$FILE"
else
- echo " --> $ROOT/$FILE would be deleted"
+ ! [ $TERSE ] && echo " --> $ROOT/$FILE would be deleted"
preserve_file "$FILE"
fi
else
- echo " --> $ROOT/$FILE no longer exists. Skipping."
+ ! [ $TERSE ] && echo " --> $ROOT/$FILE no longer exists. Skipping."
fi
else
preserve_dir "$FILE"
@@ -216,13 +249,13 @@ delete_links() {
while read LINK ; do
if [ -L "$ROOT/$LINK" ]; then
if [ ! "$WARN" = "true" ]; then
- echo " --> Deleting symlink $ROOT/$LINK"
+ ! [ $TERSE ] && echo " --> Deleting symlink $ROOT/$LINK"
rm -f "$ROOT/$LINK"
else
- echo " --> $ROOT/$LINK (symlink) would be deleted"
+ ! [ $TERSE ] && echo " --> $ROOT/$LINK (symlink) would be deleted"
fi
else
- echo " --> $ROOT/$LINK (symlink) no longer exists. Skipping."
+ ! [ $TERSE ] && echo " --> $ROOT/$LINK (symlink) no longer exists. Skipping."
fi
done
}
@@ -233,13 +266,13 @@ delete_dirs() {
if [ -d "$ROOT/$DIR" ]; then
if [ ! "$WARN" = "true" ]; then
if [ $(ls -a "$ROOT/$DIR" | wc -l) -eq 2 ]; then
- echo " --> Deleting empty directory $ROOT/$DIR"
+ ! [ $TERSE ] && echo " --> Deleting empty directory $ROOT/$DIR"
rmdir "$ROOT/$DIR"
else
- echo "WARNING: Unique directory $ROOT/$DIR contains new files"
+ ! [ $TERSE ] && echo "WARNING: Unique directory $ROOT/$DIR contains new files"
fi
else
- echo " --> $ROOT/$DIR (dir) would be deleted if empty"
+ ! [ $TERSE ] && echo " --> $ROOT/$DIR (dir) would be deleted if empty"
fi
fi
done
@@ -250,33 +283,21 @@ delete_cats() {
while read FILE ; do
if [ -f "$ROOT/$FILE" ]; then
if [ ! "$WARN" = "true" ]; then
- echo " --> Deleting $ROOT/$FILE (fmt man page)"
+ ! [ $TERSE ] && echo " --> Deleting $ROOT/$FILE (fmt man page)"
rm -f $ROOT/$FILE
else
- echo " --> $ROOT/$FILE (fmt man page) would be deleted"
+ ! [ $TERSE ] && echo " --> $ROOT/$FILE (fmt man page) would be deleted"
fi
fi
done
}
-package_name() {
- STRING=$(pkgbase $1 | sed 's?-[^-]*-[^-]*-[^-]*$??')
- # If we don't do this, commands run later will take the '-' to be an option
- # and will destroy the package database. Packages should not contain spaces
- # in them. Normally this type of problem results from a command line typo.
- if [ "$(echo $STRING | cut -b 1)" = "-" ]; then
- STRING="malformed-package-name-detected"
- fi
- echo $STRING
-}
-
# Conversion to 'comm' utility by Mark Wisdom.
# is pretty nifty! :^)
remove_packages() {
- for PKGLIST in $*
+ for PKGLIST in $*
do
PKGNAME=$(pkgbase $PKGLIST)
- echo
# If we don't have a package match here, then we will attempt to find
# a package using the long name format (name-version-arch-build) for
# which the base package name was given. On a properly-managed machine,
@@ -285,24 +306,22 @@ remove_packages() {
# be removed. If you want to remove them all, you'll need to run
# removepkg again until it removes all the same-named packages.
if [ ! -e $ADM_DIR/packages/$PKGNAME ]; then
- SHORT="$(package_name $PKGNAME)"
- for long_package in $ADM_DIR/packages/${PKGNAME}* ; do
- if [ "$SHORT" = "$(package_name $long_package)" ]; then
- PKGNAME="$(basename $long_package)"
- fi
- done
- fi
-
- if [ ! -e $ADM_DIR/packages/$PKGNAME ]; then
- long_package=$(ls -1 $ADM_DIR/packages/${PKGNAME}* | grep -m 1 "^${PKGNAME}-[^-]*-[^-]*-[^-]*$")
- if [ -e "$long_package" ]; then
- PKGNAME=$(basename $long_package)
+ # Short name not found - finally try looking for full name - e.g. foo-1.0-arm-1
+ pushd $ADM_DIR/packages > /dev/null
+ # Don't set PKGNAME if there are no matches:
+ if [ ! "$( ls -1 $PKGNAME-+([^-])-+([^-])-+([^-]) 2>/dev/null | wc -l )" = "0" ]; then
+ # If there is more than one package with the same name, set PKGNAME to the
+ # most recently installed version. This does not affect the behavior of
+ # upgradepkg, which always removes all other existing versions of the
+ # same package.
+ PKGNAME=$( ls -1t $PKGNAME-+([^-])-+([^-])-+([^-]) 2> /dev/null | head -n1 )
fi
+ popd > /dev/null
fi
if [ -r $ADM_DIR/packages/$PKGNAME ]; then
if [ ! "$WARN" = true ]; then
- echo "Removing package $ADM_DIR/packages/$PKGNAME..."
+ echo "Removing package: $(basename $ADM_DIR/packages/$PKGNAME)"
fi
if fgrep "./" $ADM_DIR/packages/$PKGNAME 1> /dev/null 2>&1; then
TRIGGER="^\.\/"
@@ -310,7 +329,7 @@ remove_packages() {
TRIGGER="FILE LIST:"
fi
if [ ! "$WARN" = true ]; then
- echo "Removing files:"
+ ! [ $TERSE ] && echo "Removing files:"
fi
sed -n "/$TRIGGER/,/^$/p" < $ADM_DIR/packages/$PKGNAME | \
fgrep -v "FILE LIST:" | sort -u > $TMP/delete_list$$
@@ -325,7 +344,7 @@ remove_packages() {
comm -12 $TMP/del_link_list$$ $TMP/required_list$$ | keep_links
comm -23 $TMP/del_link_list$$ $TMP/required_list$$ | delete_links
else
- cat $ADM_DIR/scripts/* | extract_links | \
+ cat $ADM_DIR/scripts/* 2> /dev/null | extract_links | \
sort -u > $TMP/required_links$$
mv $TMP/required_list$$ $TMP/required_files$$
sort -u $TMP/required_links$$ $TMP/required_files$$ >$TMP/required_list$$
@@ -348,22 +367,27 @@ remove_packages() {
fi
fi
if [ ! "$WARN" = "true" ]; then
- for DIR in $ADM_DIR/removed_packages $ADM_DIR/removed_scripts ; do
- if [ ! -d $DIR ] ; then mkdir -p $DIR ; chmod 755 $DIR ; fi
- done
+ mkdir -p $ADM_DIR/removed_packages $ADM_DIR/removed_scripts
mv $ADM_DIR/packages/$PKGNAME $ADM_DIR/removed_packages
if [ -r $ADM_DIR/scripts/$PKGNAME ]; then
mv $ADM_DIR/scripts/$PKGNAME $ADM_DIR/removed_scripts
fi
fi
else
- echo "No such package: $ADM_DIR/packages/$PKGNAME. Can't remove."
+ 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
}
if [ "$#" = "0" ]; then
- echo "Usage: $(basename $0) [-copy] [-keep] [-preserve] [-warn] packagename ..."; exit 1
+ echo "Usage: $(basename $0) [--copy] [--keep] [--preserve] [--terse] [--warn] packagename ..."; exit 1
fi
while : ; do
@@ -371,6 +395,7 @@ while : ; do
-copy | --copy) WARN=true; PRESERVE=true; shift;;
-keep | --keep) KEEP=true; shift;;
-preserve | --preserve) PRESERVE=true; shift;;
+ -terse | --terse) TERSE=0; shift;;
-warn | --warn) WARN=true; shift;;
-* | --*) echo "Usage: $(basename $0) [-copy] [-keep] [-preserve] [-warn] packagename ..."; exit 1;;
*) break
@@ -378,6 +403,7 @@ while : ; do
done
if [ "$WARN" = "true" ]; then
+ unset TERSE
echo "Only warning... not actually removing any files."
if [ "$PRESERVE" = "true" ]; then
echo "Package contents is copied to $PRES_DIR."
@@ -392,4 +418,3 @@ else
fi
remove_packages $*
-
diff --git a/source/a/pkgtools/scripts/setup.80.make-bootdisk b/source/a/pkgtools/scripts/setup.80.make-bootdisk
index 1f0202a5..c1753bc5 100644
--- a/source/a/pkgtools/scripts/setup.80.make-bootdisk
+++ b/source/a/pkgtools/scripts/setup.80.make-bootdisk
@@ -27,7 +27,7 @@ elif [ -r /usr/share/syslinux/mbr.bin ]; then
MBR_BIN=/usr/share/syslinux/mbr.bin
else
dialog --title "ERROR: USB BOOT STICK NOT CREATED" --msgbox \
- "Master Boot Record file mbr.bin not found. This script requires that the syslinux package is installed." 6 60
+ "Master Boot Record file mbr.bin not found. This script requires that the syslinux package is installed." 6 60
exit
fi
@@ -47,12 +47,12 @@ while [ 0 ]; do # the bootdisk menu loop
fi
dialog --title "MAKE USB FLASH BOOT" --default-item "$DEFAULTITEM" --menu \
"If your computer supports booting from a USB device, it is recommended that you make \
-a USB boot stick for your system at this time. It will boot your computer straight \
+a USB boot stick for your system at this time. It will boot your computer straight \
into the root filesystem on $ROOT_DEVICE. \n\
\n\
-Please insert a USB flash memory stick and then press ENTER to create a boot stick. \n\
+Please insert a USB flash memory stick and then press ENTER to create a boot stick. \n\
\n\
-WARNING! The existing contents of the USB stick will be erased. \n\
+WARNING! The existing contents of the USB stick will be erased. \n\
" 18 70 2 \
"Create" "Make a USB Linux boot stick" \
"Skip" "Skip making a USB boot stick" \
@@ -98,7 +98,7 @@ otherwise select 'No'." 12 70
dialog --title "CREATING USB BOOT STICK" --infobox "Creating SYSLINUX bootdisk for \
$ROOT_DEVICE on /dev/$STICK." 3 64
- # Create a 16M partition with FAT16. This should be large enough for any kernel (for now).
+ # Create a 16M partition with FAT16. This should be large enough for any kernel (for now).
PARTSIZE="+16384K"
# Zero out master boot record and then initialize it with one bootable dos partition
dd if=/dev/zero of=/dev/$STICK bs=512 count=1 1> $RDIR 2> $RDIR
@@ -152,15 +152,15 @@ EOF
Welcome to the 09Slackware07 Linux custom USB boot stick!
By default, this stick boots a root Linux partition on $ROOT_DEVICE when you
-hit ENTER. If you'd like to boot some other partition, use a command like
+hit ENTER. If you'd like to boot some other partition, use a command like
this on the prompt below:
mount root=/dev/sda1 ro
Where "/dev/sda1" is the partition you want to boot, and "ro" specifies that
-the partition should be initially mounted as read-only. If you wish to mount
-the partition read-write, use "rw" instead. To set the video console mode,
-use the vga= parameter (press F1 to see a table). You may also add any other
+the partition should be initially mounted as read-only. If you wish to mount
+the partition read-write, use "rw" instead. To set the video console mode,
+use the vga= parameter (press F1 to see a table). You may also add any other
kernel parameters you might need depending on your hardware, and which
drivers are included in your kernel.
@@ -187,7 +187,7 @@ EOF
FRAMEBUFFER MODES:
To get the kernel to start in VESA framebuffer mode, you need to pass it
- a vga= init string on the "boot:" prompt. Here's a table:
+ a vga= init string on the "boot:" prompt. Here's a table:
Colors 640x480 800x600 1024x768 1280x1024 1600x1200
--------+---------------------------------------------
@@ -210,14 +210,14 @@ EOF
Welcome to the Slackware Linux custom USB boot stick!
By default, this stick boots a root Linux partition on $ROOT_DEVICE when you
-hit ENTER. If you'd like to boot some other partition, use a command like
+hit ENTER. If you'd like to boot some other partition, use a command like
this on the prompt below:
huge.s root=/dev/sda1 ro
Where "/dev/sda1" is the partition you want to boot, and "ro" specifies that
-the partition should be initially mounted as read-only. If you wish to mount
-the partition read-write, use "rw" instead. You may also add any other
+the partition should be initially mounted as read-only. If you wish to mount
+the partition read-write, use "rw" instead. You may also add any other
kernel parameters you might need depending on your hardware, and which
drivers are included in your kernel.
@@ -248,7 +248,7 @@ EOF
exit
fi
dialog --title "USB BOOT STICK CREATED" --ok-label Continue --cancel-label Create --menu \
-"The USB boot stick has been successfully created on device /dev/$STICK. If you would like to \
+"The USB boot stick has been successfully created on device /dev/$STICK. If you would like to \
create an additional boot stick, please select 'Create' and we'll go back and make another \
one, otherwise select 'Continue' to continue configuring your system." 12 71 2 \
"Continue" "Continue the configuration (done making boot sticks)" \
diff --git a/source/a/pkgtools/scripts/setup.htmlview b/source/a/pkgtools/scripts/setup.htmlview
index 2fd9930a..98039100 100644
--- a/source/a/pkgtools/scripts/setup.htmlview
+++ b/source/a/pkgtools/scripts/setup.htmlview
@@ -2,21 +2,21 @@
#BLURB="Set a default browser link."
# Sorry, this is not a full menu, and may not ever be.
# It is trivial to find the htmllink symbolic link and
-# point it at the browser that you like. Besides,
+# point it at the browser that you like. Besides,
# this is not a Linux standard that could be locating
-# in any official document. It seems to have been
+# in any official document. It seems to have been
# started without any consultation with other
# distributions by <take a wild guess>, and now things
# expect it to be there.
#
#
-# Note 1. Listing a browser doesn't mean we ship it.
-# Note 2. Complaints about our preferences or missing
-# browsers in the list will be considered.
-# Yell at Pat about it. ;-)
+# Note 1. Listing a browser doesn't mean we ship it.
+# Note 2. Complaints about our preferences or missing
+# browsers in the list will be considered.
+# Yell at Pat about it. ;-)
# There must be no link, or we assume the admin set it and
-# do nothing. Can you tell this Q+D script was written for
+# do nothing. Can you tell this Q+D script was written for
# the initial installation?
for browser in firefox seamonkey konqueror galeon epiphany links lynx ; do
diff --git a/source/a/pkgtools/scripts/setup.services b/source/a/pkgtools/scripts/setup.services
index f700a8df..b57ad33f 100644
--- a/source/a/pkgtools/scripts/setup.services
+++ b/source/a/pkgtools/scripts/setup.services
@@ -10,12 +10,12 @@ rm -f $TMP/tmpscript
cat << EOF > $TMP/tmpscript
dialog --title "CONFIRM STARTUP SERVICES TO RUN" --item-help --checklist \\
-"The selected services will be started at boot time. If you \\
+"The selected services will be started at boot time. If you \\
don't need them, you may unselect them to turn them off (which may improve \\
-overall system security). You may also choose to start services that are \\
-not run by default, but be aware that more services means less security. \\
-Use the spacebar to select or unselect the services you wish to run. \\
-Recommended choices have been preselected. \\
+overall system security). You may also choose to start services that are \\
+not run by default, but be aware that more services means less security. \\
+Use the spacebar to select or unselect the services you wish to run. \\
+Recommended choices have been preselected. \\
Press the ENTER key when you are finished." \\
20 75 7 \\
EOF
@@ -64,6 +64,17 @@ if [ -r etc/rc.d/rc.dnsmasq ]; then
EOF
fi
+if [ -r etc/rc.d/rc.dovecot ]; then
+ if [ -x etc/rc.d/rc.dovecot ]; then
+ RC_DOVECOT=on
+ else
+ RC_DOVECOT=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.dovecot" "Dovecot IMAP/POP3 server" $RC_DOVECOT "Dovecot provides remote mailbox access for email clients." \\
+EOF
+fi
+
if [ -r etc/rc.d/rc.fuse ]; then
if [ -x etc/rc.d/rc.fuse ]; then
RC_FUSE=on
@@ -185,6 +196,17 @@ if [ -r etc/rc.d/rc.pcmcia ]; then
EOF
fi
+if [ -r etc/rc.d/rc.postfix ]; then
+ if [ -x etc/rc.d/rc.postfix ]; then
+ RC_POSTFIX=on
+ else
+ RC_POSTFIX=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.postfix" "The Postfix mail server" $RC_POSTFIX "The Postfix server allows your machine to send and receive mail." \\
+EOF
+fi
+
if [ -r etc/rc.d/rc.rpc ]; then
if [ -x etc/rc.d/rc.rpc ]; then
RC_RPC=on
@@ -229,6 +251,17 @@ if [ -r etc/rc.d/rc.sendmail ]; then
EOF
fi
+if [ -r etc/rc.d/rc.smartd ]; then
+ if [ -x etc/rc.d/rc.smartd ]; then
+ RC_SMARTD=on
+ else
+ RC_SMARTD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.smartd" "SMART monitoring daemon" $RC_SMARTD "The SMART daemon monitors your hard drives to help predict failures." \\
+EOF
+fi
+
if [ -r etc/rc.d/rc.snmpd ]; then
if [ -x etc/rc.d/rc.snmpd ]; then
RC_SNMPD=on
@@ -273,7 +306,7 @@ if [ ! $? = 0 ]; then
exit
fi
-for service in rc.atalk rc.bind rc.cups rc.dnsmasq rc.fuse rc.hald rc.hplip rc.httpd rc.inetd rc.ip_forward rc.lprng rc.messagebus rc.mysqld rc.ntpd rc.pcmcia rc.rpc rc.samba rc.saslauthd rc.snmpd rc.sendmail rc.syslog rc.sshd ; do
+for service in rc.atalk rc.bind rc.cups rc.dovecot rc.dnsmasq rc.fuse rc.hald rc.hplip rc.httpd rc.inetd rc.ip_forward rc.lprng rc.messagebus rc.mysqld rc.ntpd rc.pcmcia rc.postfix rc.rpc rc.samba rc.saslauthd rc.smartd rc.snmpd rc.sendmail rc.syslog rc.sshd ; do
if [ -f etc/rc.d/$service ]; then
if grep -w $service $TMP/reply 1> /dev/null ; then
chmod 755 etc/rc.d/$service
diff --git a/source/a/pkgtools/scripts/upgradepkg b/source/a/pkgtools/scripts/upgradepkg
index 5e029980..f943f936 100644
--- a/source/a/pkgtools/scripts/upgradepkg
+++ b/source/a/pkgtools/scripts/upgradepkg
@@ -13,7 +13,7 @@
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
@@ -22,24 +22,32 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-# Modified to handle either old 8.3 or new package-version-arch-build.tgz
-# packages, Sat Nov 17 14:25:58 PST 2001 volkerdi
+# 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.
#
-# Rewritten to clean out _all_ old packages of a given basename, not just
-# the first one found, Thu Apr 4 01:01:05 PST 2002 volkerdi
+# Wed May 23 03:35:28 UTC 2018
+# Added --terse, which limits screen output to one line per package.
#
-# Added --install-new and --reinstall, Fri May 31 14:11:14 PDT 2002 volkerdi
-# Added --dry-run, Sat Apr 26 18:13:29 PDT 2003
+# Sat 17 Jan 16:21:32 UTC 2015 mina86
+# Various optimisation mostly resolving around avoiding having to fork
+# and call cut, basename and other helper commands. Slight
+# refactoring of code calling removepkg.
#
# Sat Apr 25 21:18:53 UTC 2009
# Support new compression types and package extensions.
# Converted to use new pkgbase() function to remove pathname and
# valid package extensions.
#
-# Sat 17 Jan 16:21:32 UTC 2015 mina86
-# Various optimisation mostly resolving around avoiding having to fork
-# and call cut, basename and other helper commands. Slight
-# refactoring of code calling removepkg.
+# Added --dry-run, Sat Apr 26 18:13:29 PDT 2003
+#
+# Added --install-new and --reinstall, Fri May 31 14:11:14 PDT 2002 volkerdi
+#
+# Rewritten to clean out _all_ old packages of a given basename, not just
+# the first one found, Thu Apr 4 01:01:05 PST 2002 volkerdi
+#
+# Modified to handle either old 8.3 or new package-version-arch-build.tgz
+# packages, Sat Nov 17 14:25:58 PST 2001 volkerdi
# Return a package name that has been stripped of the dirname portion
# and any of the valid extensions (only):
@@ -58,20 +66,20 @@ Usage: upgradepkg newpackage [newpackage2 ... ]
upgradepkg oldpackage%newpackage [oldpackage2%newpackage2 ... ]
Upgradepkg upgrades a Slackware package (.tgz, .tbz, .tlz, .txz) from an
-older version to a newer one. It does this by INSTALLING the new package
+older version to a newer one. It does this by INSTALLING the new package
onto the system, and then REMOVING any files from the old package that
-aren't in the new package. If the old and new packages have the same
-name, a single argument is all that is required. If the packages have
+aren't in the new package. If the old and new packages have the same
+name, a single argument is all that is required. If the packages have
different names, supply the name of the old package followed by a percent
-symbol (%), then the name of the new package. Do not add any extra
+symbol (%), then the name of the new package. Do not add any extra
whitespace between pairs of old/new package names.
Before upgrading a package, save any configuration files (such as in /etc)
-that you wish to keep. Sometimes these will be preserved, but it depends
-on the package. If you want to force new versions of the config files
+that you wish to keep. Sometimes these will be preserved, but it depends
+on the package. If you want to force new versions of the config files
to be installed, remove the old ones manually prior to running upgradepkg.
-To upgrade in a directory other than / (such as /mnt):
+To upgrade in a directory other than / (such as /mnt):
ROOT=/mnt upgradepkg package.tgz (or .tbz, .tlz, .txz)
@@ -103,41 +111,71 @@ if [ "$1" = "" -o "$1" = "--help" -o "$1" = "-?" ]; then
exit 1;
fi
-# Arg processing loop. These must come before any packages are listed.
+# Create a lockfile directory if it doesn't exist. We can use it to prevent
+# output line collisions in --terse mode.
+INSTLOCKDIR=${INSTLOCKDIR:-/run/upgradepkg-lock}
+if [ ! -d $INSTLOCKDIR ]; then
+ mkdir -p $INSTLOCKDIR
+fi
+
+# Set default line length for terse mode:
+if which tput 1> /dev/null 2> /dev/null ; then
+ TERSELENGTH=$(tput cols)
+else
+ TERSELENGTH=80
+fi
+
+# Arg processing loop. These must come before any packages are listed.
while [ 0 ]; do
- if [ "$1" = "--no-paranoia" ]; then
- # Enable --no-paranoia mode. This is so not-recommended that we're
- # not even going to document it. ;) If a file used to be directly
+ if [ "$1" = "-no-paranoia" -o "$1" = "--no-paranoia" ]; then
+ # Enable --no-paranoia mode. This is so not-recommended that we're
+ # not even going to document it. ;) If a file used to be directly
# managed and now is moved into place, using --no-paranoia will cause
- # it to improperly disappear. It does slightly speed things up, though.
+ # it to improperly disappear. It does slightly speed things up, though.
# Don't use it.
NOT_PARANOID="true"
shift 1
- elif [ "$1" = "--install-new" ]; then
+ elif [ "$1" = "-install-new" -o "$1" = "--install-new" ]; then
# Install packages that do not already have an installed version.
# The usual default is to skip them.
INSTALL_NEW="yes"
shift 1
- elif [ "$1" = "--reinstall" ]; then
+ elif [ "$1" = "-reinstall" -o "$1" = "--reinstall" ]; then
# Reinstall packages even if the installed one is the same version.
REINSTALL="true"
shift 1
- elif [ "$1" = "--verbose" -o "$1" = "-v" ]; then
+ elif [ "$1" = "-verbose" -o "$1" = "--verbose" -o "$1" = "-v" ]; then
# We're adding a --verbose mode that doesn't filter removepkg as much
VERBOSE="verbose"
shift 1
- elif [ "$1" = "--dry-run" ]; then
+ elif [ "$1" = "-dry-run" -o "$1" = "--dry-run" ]; then
# Output a report about which packages would be installed or upgraded
# but don't actually perform the upgrades.
DRY_RUN="true"
shift 1
+ elif [ "$1" = "-terse" -o "$1" = "--terse" ]; then
+ # Output one line per installed/upgraded package by calling installpkg
+ # with --terse. Use TERSE=0 for true, so we can check with test.
+ TERSE=0
+ shift 1
+ elif [ "$1" = "-terselength" -o "$1" = "--terselength" ]; then
+ # Set line length in --terse mode:
+ TERSELENGTH=$2
+ shift 2
else # no more args
break;
fi
done # processing args
+# A couple not-really-documented features to adjust the behavior of --terse
+# mode. These need to be used in addition to --terse, and passed in as
+# environment variables.
+# PLAINTERSE=0 (This outputs the standard terse line from installpkg, rather
+# than prefixing it with "Upgrading:" or "Installing:")
+# INFOBOX=0 (This outputs the installpkg --infobox instead of a terse line)
+
# Here's a function to figure out the package name from one of those
-# new long filenames. We'll need this to double check the name of the
+# new long filenames. We'll need this to double check the name of the
# old package.
package_name() {
@@ -170,7 +208,7 @@ for ARG; do
# Simple package integrity check:
if ! [ -f "$NEW" ]; then
ERRCODE=4
- echo "Cannot install $ARG: file not found"
+ ! [ $TERSE ] && echo "Cannot install $ARG: file not found"
continue;
fi
@@ -186,7 +224,7 @@ for ARG; do
# Make sure the extension is valid:
if [ "$NNAME" = "$NEW" ]; then
# We won't throw an ERRCODE for this, but the package is skipped:
- echo "Cannot install $OLD: invalid package extension"
+ ! [ $TERSE ] && echo "Cannot install $OLD: invalid package extension"
continue;
fi
@@ -204,31 +242,42 @@ for ARG; do
fi
# 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:
+ # to be - skip to the next package (or package pair) if anything's wrong:
if [ ! -r $ROOT/var/log/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
- echo
- echo "Error: there is no installed package named $OLD."
- echo " (looking for $ROOT/var/log/packages/$OLD)"
- echo
+ ! [ $TERSE ] && echo
+ ! [ $TERSE ] && echo "Error: there is no installed package named $OLD."
+ ! [ $TERSE ] && echo " (looking for $ROOT/var/log/packages/$OLD)"
+ ! [ $TERSE ] && echo
fi
ERRCODE=1
else # --install-new was given, so install the new package:
if [ "$DRY_RUN" = "true" ]; then
echo "$NEW would be installed (new package)."
else
- cat << EOF
+ if [ $PLAINTERSE ]; then
+ /sbin/installpkg --terse --terselength $TERSELENGTH $INCOMINGDIR/$NNAME
+ elif [ $INFOBOX ]; then
+ /sbin/installpkg --infobox $INCOMINGDIR/$NNAME
+ elif [ $TERSE ]; then
+ OUTPUTLINE="$(/sbin/installpkg --terse --terselength $(expr $TERSELENGTH - 12) $INCOMINGDIR/$NNAME)"
+ ( flock 9 || exit 11
+ echo "Installing: ${OUTPUTLINE}"
+ ) 9> $INSTLOCKDIR/outputline.lock
+ else
+ cat << EOF
+==============================================================================
| Installing new package $INCOMINGDIR/$NNAME
+==============================================================================
EOF
- /sbin/installpkg $INCOMINGDIR/$NNAME
+ /sbin/installpkg $INCOMINGDIR/$NNAME
+ fi
fi
fi
continue;
@@ -236,9 +285,9 @@ EOF
if [ "$DRY_RUN" = "true" ]; then
echo "$NEW incoming package not found (command line)."
else
- echo
- echo "Error: incoming package $INCOMINGDIR/$NNAME not found."
- echo
+ ! [ $TERSE ] && echo
+ ! [ $TERSE ] && echo "Error: incoming package $INCOMINGDIR/$NNAME not found."
+ ! [ $TERSE ] && echo
fi
ERRCODE=1
continue;
@@ -251,13 +300,15 @@ EOF
if [ "$DRY_RUN" = "true" ]; then
echo "$NEW would be skipped (already installed)."
else
- cat << EOF
+ if ! [ $TERSE ]; then
+ cat << EOF
+==============================================================================
| Skipping package $NEW (already installed)
+==============================================================================
EOF
+ fi
fi
continue;
fi
@@ -292,57 +343,73 @@ EOF
done
# Print a banner for the current upgrade:
- cat << EOF
+ if ! [ $TERSE ]; then
+ cat << EOF
+==============================================================================
| Upgrading $OLD package using $INCOMINGDIR/$NNAME
+==============================================================================
-
EOF
-
+ fi
# Next, the new package is pre-installed:
if [ "$VERBOSE" = "verbose" ]; then
- /sbin/installpkg $INCOMINGDIR/$NNAME
- RETCODE=$?
+ if ! [ $TERSE ]; then
+ /sbin/installpkg $INCOMINGDIR/$NNAME
+ RETCODE=$?
+ else
+ /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null
+ RETCODE=$?
+ fi
else
- echo "Pre-installing package $NEW..."
- /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null
- RETCODE=$?
+ if [ $PLAINTERSE ]; then
+ /sbin/installpkg --terse --terselength $TERSELENGTH $INCOMINGDIR/$NNAME
+ elif [ $INFOBOX ]; then
+ /sbin/installpkg --infobox $INCOMINGDIR/$NNAME
+ elif [ $TERSE ]; then
+ OUTPUTLINE="$(/sbin/installpkg --terse --terselength $(expr $TERSELENGTH - 12) $INCOMINGDIR/$NNAME)"
+ RETCODE=$?
+ ( flock 9 || exit 11
+ echo "Upgrading: ${OUTPUTLINE}"
+ ) 9> $INSTLOCKDIR/outputline.lock
+ else
+ echo "Pre-installing package $NEW..."
+ /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null
+ RETCODE=$?
+ fi
fi
# Make sure that worked:
if [ ! $RETCODE = 0 ]; then
- echo "ERROR: Package $INCOMINGDIR/$NNAME did not install"
- echo "correctly. You may need to reinstall your old package"
- echo "to avoid problems. Make sure the new package is not"
+ echo "ERROR: Package $INCOMINGDIR/$NNAME did not install"
+ echo "correctly. You may need to reinstall your old package"
+ echo "to avoid problems. Make sure the new package is not"
echo "corrupted."
- sleep 30
+ sleep 15
# Skip this package, but still try to proceed. Good luck...
continue;
fi
-
# Now, the leftovers from the old package(s) can go. Pretty simple, huh? :)
- for rempkg in "$ROOT/var/log/packages/"*"-$TIMESTAMP"; do
- if [ "$VERBOSE" = "verbose" ]; then
- /sbin/removepkg "${rempkg##*/}"
- else
- /sbin/removepkg "${rempkg##*/}" | grep -v 'Skipping\.\|Removing files:'
- fi
- done
- echo
-
+ ( flock 9 || exit 11
+ for rempkg in "$ROOT/var/log/packages/"*"-$TIMESTAMP"; do
+ if [ "$VERBOSE" = "verbose" ]; then
+ /sbin/removepkg "${rempkg##*/}"
+ elif ! [ $TERSE ]; then
+ /sbin/removepkg "${rempkg##*/}" | grep -v 'Skipping\.\|Removing files:'
+ else
+ /sbin/removepkg "${rempkg##*/}" > /dev/null
+ fi
+ done
+ ) 9> $INSTLOCKDIR/removepkg.lock
# Again! Again!
# Seriously, the reinstalling of a package can be crucial if any files
# shift location, so we should always reinstall as the final step:
if [ ! "$NOT_PARANOID" = "true" ]; then
- /sbin/installpkg $INCOMINGDIR/$NNAME
+ if ! [ $TERSE ]; then
+ /sbin/installpkg $INCOMINGDIR/$NNAME
+ else
+ /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null
+ fi
fi
-
- echo "Package $OLD upgraded with new package $INCOMINGDIR/$NNAME."
+ ! [ $TERSE ] && echo "Package $OLD upgraded with new package $INCOMINGDIR/$NNAME."
ERRCODE=0
done
-
-if [ ! "$DRY_RUN" = "true" ]; then
- echo
-fi
exit $ERRCODE
-
diff --git a/source/a/pkgtools/slack-desc b/source/a/pkgtools/slack-desc
index ab3fc119..d06b5863 100644
--- a/source/a/pkgtools/slack-desc
+++ b/source/a/pkgtools/slack-desc
@@ -1,8 +1,8 @@
# HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description. Line
+# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
-# the right side marks the last column you can put a character in. You must make
-# exactly 11 lines for the formatting to be correct. It's also customary to
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
@@ -11,9 +11,9 @@ pkgtools:
pkgtools: This package contains utilities for handling Slackware packages.
pkgtools: Included are the command line utilities 'installpkg', 'removepkg',
pkgtools: 'makepkg', 'explodepkg', and 'upgradepkg' that install, remove,
-pkgtools: build, examine, and upgrade software packages. Also included are
+pkgtools: build, examine, and upgrade software packages. Also included are
pkgtools: 'pkgtool', a menu based program for installing packages, removing
pkgtools: packages, or viewing the packages that are installed on the system,
-pkgtools: documentation (man pages), and a few other system admin scripts.
-pkgtools:
+pkgtools: 'pkgdiff', a utility for comparing two packages, documentation (man
+pkgtools: pages), and a few other system admin scripts.
pkgtools: