summaryrefslogtreecommitdiff
path: root/testing/source/pkgtools/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'testing/source/pkgtools/scripts')
-rw-r--r--testing/source/pkgtools/scripts/explodepkg109
-rw-r--r--testing/source/pkgtools/scripts/installpkg713
-rw-r--r--testing/source/pkgtools/scripts/makebootdisk443
-rw-r--r--testing/source/pkgtools/scripts/makepkg452
-rw-r--r--testing/source/pkgtools/scripts/pkgdiff164
-rw-r--r--testing/source/pkgtools/scripts/pkgtool723
-rw-r--r--testing/source/pkgtools/scripts/removepkg438
-rw-r--r--testing/source/pkgtools/scripts/setup.70.install-kernel5
-rw-r--r--testing/source/pkgtools/scripts/setup.80.make-bootdisk267
-rw-r--r--testing/source/pkgtools/scripts/setup.htmlview33
-rw-r--r--testing/source/pkgtools/scripts/setup.services342
-rw-r--r--testing/source/pkgtools/scripts/upgradepkg417
12 files changed, 4106 insertions, 0 deletions
diff --git a/testing/source/pkgtools/scripts/explodepkg b/testing/source/pkgtools/scripts/explodepkg
new file mode 100644
index 00000000..72c013d4
--- /dev/null
+++ b/testing/source/pkgtools/scripts/explodepkg
@@ -0,0 +1,109 @@
+#!/bin/sh
+# Copyright 1994, 1998, 2000 Patrick Volkerding, Concord, CA, USA
+# Copyright 2001, 2003 Slackware Linux, Inc., Concord, CA, 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
+# 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.
+
+if [ $# = 0 ]; then
+ cat << EOF
+Usage: explodepkg package_name [package_name2, ...]
+
+Explodes a Slackware compatible software package
+(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 xpvf package_name )
+
+Note: This should only be used for debugging or examining packages, not for
+installing them. It doesn't execute installation scripts or update the package
+indexes in /var/lib/pkgtools/packages and /var/lib/pkgtools/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:"
+ # Determine extension:
+ packageext="$( echo $PKG | rev | cut -f 1 -d . | rev)"
+ # Determine compression utility:
+ case $packageext in
+ 'tgz' )
+ packagecompression=gzip
+ ;;
+ 'gz' )
+ packagecompression=gzip
+ ;;
+ 'tbz' )
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ packagecompression=lbzip2
+ else
+ packagecompression=bzip2
+ fi
+ ;;
+ 'bz2' )
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ packagecompression=lbzip2
+ else
+ packagecompression=bzip2
+ fi
+ ;;
+ 'tlz' )
+ 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 --threads=${THREADS}"
+ ;;
+ 'xz' )
+ packagecompression="xz --threads=${THREADS}"
+ ;;
+ esac
+ ( 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"
+ echo "was not executed."
+ fi
+done
+
diff --git a/testing/source/pkgtools/scripts/installpkg b/testing/source/pkgtools/scripts/installpkg
new file mode 100644
index 00000000..0d82f89c
--- /dev/null
+++ b/testing/source/pkgtools/scripts/installpkg
@@ -0,0 +1,713 @@
+#!/bin/sh
+# Copyright 1994, 1998, 2000 Patrick Volkerding, Concord, CA, USA
+# Copyright 2001, 2003 Slackware Linux, Inc., Concord, CA, USA
+# Copyright 2007, 2009, 2011, 2017, 2018 Patrick 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.
+#
+# Mon Jun 4 21:17:58 UTC 2018
+# Migrate the package database and directories from /var/log to
+# /var/lib/pkgtools. /var/log was never a good place for this data, as it is
+# considered by many to be a directory that could be wiped to free up some
+# space. Originally the package database was in /var/adm, but the FSSTND
+# (later FHS) group decided that directory should be a symlink to /var/log,
+# and I went along with that since it was years ago and I was a n00b and didn't
+# know any better. /var/lib/pkgtools will be a better and safer location.
+#
+# Thu May 24 20:23:55 UTC 2018
+# Added --terselength option to set the line length in --terse mode.
+# Allow adding NOLOCK in an install script to allow it to run without locking.
+#
+# 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.
+# Replaced pkgbase & package_name code with 'sed' script by Jim Hawkins.
+#
+# Sat Apr 25 21:18:53 UTC 2009
+# Converted to use new pkgbase() function to remove pathname and
+# valid package extensions.
+#
+# Sat Apr 4 22:58:06 CDT 2009
+# Support additional compression formats if the supporting utilities exist:
+# .tbz - bzip2
+# .tlz - lzma
+# .txz - xz (also LZMA)
+# And of course, .tgz (gzip) is not going anywhere. :-) <volkerdi>
+# Add command switches to determine the uncompressed package size even if
+# that will slow things down, and to add the package's md5sum to the
+# metadata stored in /var/log/packages/.
+#
+# Fri Dec 21 17:21:35 CST 2007
+# Added a patch from Johnny Morano to work around package removal issues
+# caused by packages that do not comply with FHS combined with a grep
+# regex error in installpkg. Any package with a single-letter top-
+# level directory could not be removed.
+#
+# Shortened some of the top-line dialog output to avoid overflowing the
+# textbox (needed as some of the packages, especially in X, have very
+# long base package names now). <pjv>
+#
+# Sun Nov 26 12:38:25 CST 1995
+# Added patch from Glenn Moloney <glenn@physics.unimelb.edu.au> to allow
+# packages to be installed to directories other than /.
+#
+# Wed Mar 18 15:15:51 CST 1998
+# Changed $TMP directory to /var/log/setup/tmp, and chmod'ed it 700 to close
+# some security holes.
+
+# Return a package name that has been stripped of the dirname portion
+# and any of the valid extensions (only):
+pkgbase() {
+ # basename + strip extensions .tbz, .tgz, .tlz and .txz
+ echo "$1" | sed 's?.*/??;s/\.t[bglx]z$//'
+}
+
+# If installpkg encounters a problem, it will return a non-zero error code.
+# If it finds more than one problem (i.e. with a list of packages) you'll only
+# hear about the most recent one. :)
+# 1 = tar returned error code
+# 2 = corrupt compression envelope
+# 3 = does not end in .tgz
+# 4 = no such file
+# 5 = external compression utility missing
+# 99 = user abort from menu mode
+EXITSTATUS=0
+
+# Do not store md5sums by default:
+MD5SUM=0
+
+# So that we know what to expect...
+umask 022
+
+# 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
+
+# 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/lock/pkgtools}
+if [ ! -d $INSTLOCKDIR ]; then
+ mkdir -p $INSTLOCKDIR
+fi
+
+usage() {
+ cat << EOF
+Usage: installpkg [options] <package_filename>
+
+Installpkg is used to install a .t{gz,bz,lz,xz} package like this:
+ installpkg slackware-package-1.0.0-i486-1.tgz (or .tbz, .tlz, .txz)
+
+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
+ 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
+ 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
+}
+
+# Eliminate whitespace function:
+crunch() {
+ while read FOO ; do
+ echo $FOO
+ done
+}
+
+# Strip version, architecture and build from the end of the name
+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 tty -s && which tput 1> /dev/null 2> /dev/null ; then
+ TERSELENGTH=$(tput cols)
+else
+ TERSELENGTH=80
+fi
+
+# Default install mode is standard text mode:
+MODE=install
+# If $TERSE is set to 0 in the environment, then use terse mode:
+if [ "$TERSE" = "0" ]; then
+ MODE=terse
+fi
+
+# Parse options:
+while [ 0 ]; do
+ if [ "$1" = "-warn" -o "$1" = "--warn" ]; then
+ MODE=warn
+ shift 1
+ elif [ "$1" = "-md5sum" -o "$1" = "--md5sum" ]; then
+ MD5SUM=1
+ shift 1
+ elif [ "$1" = "-infobox" -o "$1" = "--infobox" ]; then
+ MODE=infobox
+ shift 1
+ 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
+ elif [ "$1" = "-ask" -o "$1" = "--ask" ]; then
+ ALWAYSASK="yes"
+ shift 1
+ elif [ "$1" = "-tagfile" -o "$1" = "--tagfile" ]; then
+ if [ -r "$2" ]; then
+ USERTAGFILE="$2"
+ elif [ -r "$(pwd)/$2" ]; then
+ USERTAGFILE="$(pwd)/$2"
+ else
+ usage
+ 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
+ exit
+ fi
+ USERPRIORITY="$2"
+ shift 2
+ elif [ "$1" = "-root" -o "$1" = "--root" ]; then
+ if [ "$2" = "" ]; then
+ usage
+ exit
+ fi
+ ROOT="$2"
+ shift 2
+ else
+ break
+ fi
+done
+
+# Set the prefix for the package database directories (packages, scripts).
+ADM_DIR="$ROOT/var/lib/pkgtools"
+
+# Set the prefix for the removed packages/scripts log files:
+LOG_DIR="$ROOT/var/log/pkgtools"
+
+# If the directories don't exist, "initialize" the package database:
+for PKGDBDIR in packages scripts setup ; do
+ if [ ! -d $ADM_DIR/$PKGDBDIR ]; then
+ mkdir -p $ADM_DIR/$PKGDBDIR
+ chmod 755 $ADM_DIR/$PKGDBDIR
+ fi
+done
+for PKGLOGDIR in removed_packages removed_scripts ; do
+ if [ ! -d $LOG_DIR/$PKGLOGDIR ]; then
+ rm -rf $LOG_DIR/$PKGLOGDIR # make sure it's not a symlink or something stupid
+ mkdir -p $LOG_DIR/$PKGLOGDIR
+ chmod 755 $LOG_DIR/$PKGLOGDIR
+ fi
+done
+# Likewise, make sure that the symlinks in /var/log exist. We no longer
+# trust anything to remain in /var/log. Let the admin wipe it if that's
+# what they like.
+for symlink in packages scripts setup ; do
+ if [ ! -L $LOG_DIR/../$symlink -a ! -d $LOG_DIR/../$symlink ]; then
+ ( cd $LOG_DIR/.. ; ln -sf ../lib/pkgtools/$symlink . )
+ fi
+done
+
+# Make sure there's a proper temp directory:
+TMP=$ADM_DIR/setup/tmp
+# If the $TMP directory doesn't exist, create it:
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+ chmod 700 $TMP # no need to leave it open
+fi
+
+# usage(), exit if called with no arguments:
+if [ $# = 0 ]; then
+ usage;
+ exit
+fi
+
+# If -warn mode was requested, produce the output and then exit:
+if [ "$MODE" = "warn" ]; then
+ while [ -f "$1" ]; do
+ mkdir -p $TMP/scan${MCOOKIE}
+ # Determine extension:
+ packageext="$( echo $1 | rev | cut -f 1 -d . | rev)"
+ # Determine decompressor utility:
+ case $packageext in
+ 'tgz' )
+ packagecompression=gzip
+ ;;
+ 'tbz' )
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ packagecompression=lbzip2
+ else
+ packagecompression=bzip2
+ fi
+ ;;
+ 'tlz' )
+ 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' )
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ packagecompression="xz --threads=${THREADS}"
+ else
+ packagecompression="xz --threads=2"
+ fi
+ ;;
+ esac
+ ( 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${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
+ f="/$f"
+ if [ -f "$f" -o -L "$f" ]; then
+ echo "$f"
+ fi
+ done
+ shift 1
+ done
+ exit
+fi
+
+# Main loop:
+for package in $* ; do
+
+ # Simple package integrity check:
+ if [ ! -f $package ]; then
+ EXITSTATUS=4
+ if [ "$MODE" = "install" ]; then
+ echo "Cannot install $package: file not found"
+ fi
+ continue;
+ fi
+
+ # "shortname" isn't really THAT short...
+ # it's just the full name without ".t{gz,bz,lz,xz}"
+ shortname="$(pkgbase $package)"
+ packagedir="$(dirname $package)"
+ # This is the base package name, used for grepping tagfiles and descriptions:
+ packagebase="$(package_name $shortname)"
+
+ # Reject package if it does not end in '.t{gz,bz,lz,xz}':
+ if [ "$shortname" = "$(basename $package)" ]; then
+ EXITSTATUS=3
+ if [ "$MODE" = "install" ]; then
+ echo "Cannot install $package: file does not end in .tgz, .tbz, .tlz, or .txz"
+ fi
+ continue;
+ fi
+
+ # Determine extension:
+ packageext="$(echo $package | rev | cut -f 1 -d . | rev)"
+
+ # Determine compressor utility:
+ case $packageext in
+ 'tgz' )
+ packagecompression=gzip
+ ;;
+ 'tbz' )
+ if which lbzip2 1> /dev/null 2> /dev/null ; then
+ packagecompression=lbzip2
+ else
+ packagecompression=bzip2
+ fi
+ ;;
+ 'tlz' )
+ 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' )
+ if [ ! "$XZ_THREADS_FORCED" = "yes" ]; then
+ packagecompression="xz --threads=${THREADS}"
+ else
+ packagecompression="xz --threads=2"
+ fi
+ ;;
+ esac
+
+ # Test presence of external compression utility:
+ 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"
+ fi
+ continue;
+ fi
+
+ # Determine package's priority:
+ unset PRIORITY
+ if [ "$USERTAGFILE" = "" ]; then
+ TAGFILE="$packagedir/tagfile"
+ else
+ TAGFILE="$USERTAGFILE"
+ fi
+ if [ ! -r "$TAGFILE" ]; then
+ TAGFILE=/dev/null
+ fi
+ if grep "^$packagebase:" "$TAGFILE" | grep ADD > /dev/null 2> /dev/null ; then
+ PRIORITY="ADD"
+ elif grep "^$packagebase:" "$TAGFILE" | grep REC > /dev/null 2> /dev/null ; then
+ PRIORITY="REC"
+ elif grep "^$packagebase:" "$TAGFILE" | grep OPT > /dev/null 2> /dev/null ; then
+ PRIORITY="OPT"
+ elif grep "^$packagebase:" "$TAGFILE" | grep SKP > /dev/null 2> /dev/null ; then
+ PRIORITY="SKP"
+ fi
+ if [ "$PRIORITY" = "ADD" ]; then
+ PMSG="[ADD]"
+ elif [ "$PRIORITY" = "REC" ]; then
+ PMSG="[REC]"
+ elif [ "$PRIORITY" = "OPT" ]; then
+ PMSG="[OPT]"
+ elif [ "$PRIORITY" = "SKP" ]; then
+ PMSG="[SKP]"
+ else
+ PMSG=""
+ fi
+
+ # If a tagfile wants this package to be skipped, do that now before
+ # wasting any more CPU on it:
+ if [ "$PRIORITY" = "SKP" -a ! "$ALWAYSASK" = "yes" ]; then
+ continue # next package
+ fi
+
+ # Figure out some package information, like the compressed and uncompressed
+ # sizes, and where to find the package description:
+ COMPRESSED="$(/bin/du -sh "$(readlink -f $package)" | cut -f 1)"
+ DESCRIPTION=""
+ # First check for .txt file next to the package, since this is faster:
+ if grep "^$packagebase:" "$packagedir/$shortname.txt" 1> /dev/null 2> /dev/null ; then
+ DESCRIPTION="$packagedir/$shortname.txt"
+ elif grep "^$shortname:" "$packagedir/$shortname.txt" 1> /dev/null 2> /dev/null ; then
+ DESCRIPTION="$packagedir/$shortname.txt"
+ fi
+
+ # Test tarball integrity and get uncompressed package size:
+ if [ "$MODE" = "install" ]; then
+ echo "Verifying package $(basename $package)."
+ fi
+ # 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${MCOOKIE} $TMP/tmpsize${MCOOKIE}
+ continue
+ fi
+ 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${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
+
+ if [ "$DESCRIPTION" = "" ]; then
+ #echo "WARNING NO SLACK-DESC"
+ DESCRIPTION="/dev/null"
+ fi
+
+ # Gather package infomation into a temporary file:
+ 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${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${MCOOKIE} )
+ while [ $LENGTH -lt 12 ]; do
+ echo >> $TMP/tmpmsg${MCOOKIE}
+ LENGTH=$(expr $LENGTH + 1)
+ done
+ 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${MCOOKIE}
+\n
+\n
+\n
+\n
+\n
+\n
+\n
+\n
+\n
+\n
+\n
+\n
+\n
+EOF
+ 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
+ echo "Installing package $(basename $package):"
+ else
+ echo "Installing package $(basename $package) $PMSG:"
+ fi
+ echo "PACKAGE DESCRIPTION:"
+ grep "^$packagebase:" $DESCRIPTION | uniq | sed "s/^$packagebase:/#/g"
+ if [ "$shortname" != "$packagebase" ]; then
+ grep "^$shortname:" $DESCRIPTION | uniq | sed "s/^$shortname:/#/g"
+ fi
+ elif [ "$MODE" = "terse" ]; then # emit a single description line
+ ( 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)" | cut -b 1-${TERSELENGTH}
+ ) 9> $INSTLOCKDIR/dialog.lock
+ elif [ "$MODE" = "infobox" ]; then # install infobox package
+ ( 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
+ ( 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
+ ( 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:
+ ( 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
+ continue # skip the package
+ fi
+ fi
+
+ # Make sure there are no symbolic links sitting in the way of
+ # incoming package files:
+ grep -v "/$" $TMP/tmplist${MCOOKIE} | while read file ; do
+ if [ -L "$ROOT/$file" ]; then
+ rm -f "$ROOT/$file"
+ fi
+ done
+ rm -f $TMP/tmplist${MCOOKIE}
+
+ # Write the package file database entry and install the package:
+ echo "PACKAGE NAME: $shortname" > $ADM_DIR/packages/$shortname
+ echo "COMPRESSED PACKAGE SIZE: $COMPRESSED" >> $ADM_DIR/packages/$shortname
+ echo "UNCOMPRESSED PACKAGE SIZE: $UNCOMPRESSED" >> $ADM_DIR/packages/$shortname
+ echo "PACKAGE LOCATION: $package" >> $ADM_DIR/packages/$shortname
+ # Record the md5sum if that's a selected option:
+ if [ $MD5SUM = 1 ]; then
+ echo "PACKAGE MD5SUM: $(md5sum $package | cut -f 1 -d ' ')" >> $ADM_DIR/packages/$shortname
+ fi
+ echo "PACKAGE DESCRIPTION:" >> $ADM_DIR/packages/$shortname
+ grep "^$packagebase:" $DESCRIPTION >> $ADM_DIR/packages/$shortname 2> /dev/null
+ if [ "$shortname" != "$packagebase" ]; then
+ grep "^$shortname:" $DESCRIPTION >> $ADM_DIR/packages/$shortname 2> /dev/null
+ fi
+ echo "FILE LIST:" >> $ADM_DIR/packages/$shortname
+ 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...
+ # 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, 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/$INSTDIR/doinst.sh ]; then
+ if [ "$MODE" = "install" ]; then
+ echo "Executing install script for $(basename $package)."
+ fi
+ # 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/$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.
+ # 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${MCOOKIE}" ]; then
+ rm -rf "$TMP/scan${MCOOKIE}"
+ fi
+ rm -f $TMP/tmpmsg${MCOOKIE} $TMP/reply${MCOOKIE}
+ if [ "$MODE" = "install" ]; then
+ echo "Package $(basename $package) installed."
+ fi
+done
+
+exit $EXITSTATUS
diff --git a/testing/source/pkgtools/scripts/makebootdisk b/testing/source/pkgtools/scripts/makebootdisk
new file mode 100644
index 00000000..79379618
--- /dev/null
+++ b/testing/source/pkgtools/scripts/makebootdisk
@@ -0,0 +1,443 @@
+#!/bin/sh
+# Copyright 1995, 1998, 2002, 2005 Patrick Volkerding, Moorhead, 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.
+#
+
+if [ ! "$UID" = "0" ]; then
+ echo "You need to be root to run this script."
+ exit 1
+fi
+
+# Was a kernel specified on the command line?
+if [ -r "$1" ]; then
+ KERNEL=$1
+ KMSG="Using kernel $KERNEL"
+else
+ KMSG="No kernel selected yet"
+fi
+
+# Make sure there's a proper temp directory:
+TMP=/var/lib/pkgtools/setup/tmp
+# If the $TMP directory doesn't exist, create it:
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+ chmod 700 $TMP # no need to leave it open
+fi
+
+ROOT_DEVICE="`mount | grep ' on / ' | cut -f 1 -d ' '`"
+
+if mount | grep ' on / ' | grep umsdos 1> /dev/null 2> /dev/null ; then
+ MOUNT="read-write"
+else
+ MOUNT="read-only"
+fi
+
+make_root_device() {
+# Make a device:
+makedev() {
+ if [ ! -b $1 ]; then
+ mknod $1 b $2 $3
+ chown root.disk $1
+ chmod 640 $1
+ fi
+}
+
+# Make ide device
+# make ide major minor hd1 hd2 (2 base devs for major)
+make_ide() {
+ # Handle base devices:
+ if [ "$2" = "0" ]; then
+ makedev $TMP/lilo/dev/$3 $1 $2
+ return 0
+ elif [ "$2" = "64" ]; then
+ makedev $TMP/lilo/dev/$4 $1 $2
+ return 0
+ fi
+ # Must be a partition:
+ if [ "`expr $2 / 64`" = "0" ]; then
+ DEV=$3
+ NUM=$2
+ else
+ DEV=$4
+ NUM=`expr $2 - 64`
+ fi
+ makedev $TMP/lilo/dev/$DEV$NUM $1 $2
+}
+
+# Make SCSI device
+make_scsi() {
+ # find drive # 0 - 15
+ DRV=`expr $1 / 16`
+ NUM=`expr $1 % 16`
+ if [ "$NUM" = "0" ]; then
+ NUM=""
+ fi
+ if [ "$DRV" = "0" ]; then
+ makedev $TMP/lilo/dev/sda$NUM 8 $1
+ elif [ "$DRV" = "1" ]; then
+ makedev $TMP/lilo/dev/sdb$NUM 8 $1
+ elif [ "$DRV" = "2" ]; then
+ makedev $TMP/lilo/dev/sdc$NUM 8 $1
+ elif [ "$DRV" = "3" ]; then
+ makedev $TMP/lilo/dev/sdd$NUM 8 $1
+ elif [ "$DRV" = "4" ]; then
+ makedev $TMP/lilo/dev/sde$NUM 8 $1
+ elif [ "$DRV" = "5" ]; then
+ makedev $TMP/lilo/dev/sdf$NUM 8 $1
+ elif [ "$DRV" = "6" ]; then
+ makedev $TMP/lilo/dev/sdg$NUM 8 $1
+ elif [ "$DRV" = "7" ]; then
+ makedev $TMP/lilo/dev/sdh$NUM 8 $1
+ elif [ "$DRV" = "8" ]; then
+ makedev $TMP/lilo/dev/sdi$NUM 8 $1
+ elif [ "$DRV" = "9" ]; then
+ makedev $TMP/lilo/dev/sdj$NUM 8 $1
+ elif [ "$DRV" = "10" ]; then
+ makedev $TMP/lilo/dev/sdk$NUM 8 $1
+ elif [ "$DRV" = "11" ]; then
+ makedev $TMP/lilo/dev/sdl$NUM 8 $1
+ elif [ "$DRV" = "12" ]; then
+ makedev $TMP/lilo/dev/sdm$NUM 8 $1
+ elif [ "$DRV" = "13" ]; then
+ makedev $TMP/lilo/dev/sdn$NUM 8 $1
+ elif [ "$DRV" = "14" ]; then
+ makedev $TMP/lilo/dev/sdo$NUM 8 $1
+ elif [ "$DRV" = "15" ]; then
+ makedev $TMP/lilo/dev/sdp$NUM 8 $1
+ fi
+}
+
+if cat /proc/partitions | grep / 1> /dev/null 2> /dev/null ; then # new
+ cat /proc/partitions | grep / | while read line ; do
+ SMASHED_LINE=$line
+ MAJOR=`echo $SMASHED_LINE | cut -f 1 -d ' '`
+ MINOR=`echo $SMASHED_LINE | cut -f 2 -d ' '`
+ if [ "$MAJOR" = "3" ]; then
+ make_ide $MAJOR $MINOR hda hdb
+ elif [ "$MAJOR" = "8" ]; then
+ make_scsi $MINOR
+ elif [ "$MAJOR" = "22" ]; then
+ make_ide $MAJOR $MINOR hdc hdd
+ elif [ "$MAJOR" = "33" ]; then
+ make_ide $MAJOR $MINOR hde hdf
+ elif [ "$MAJOR" = "34" ]; then
+ make_ide $MAJOR $MINOR hdg hdh
+ elif [ "$MAJOR" = "56" ]; then
+ make_ide $MAJOR $MINOR hdi hdj
+ fi
+ done
+else # old format
+ cat /proc/partitions | grep d | while read line ; do
+ SMASHED_LINE=$line
+ MAJOR=`echo $SMASHED_LINE | cut -f 1 -d ' '`
+ MINOR=`echo $SMASHED_LINE | cut -f 2 -d ' '`
+ DEVNAME=`echo $SMASHED_LINE | cut -f 4 -d ' '`
+ makedev $TMP/lilo/dev/$DEVNAME $MAJOR $MINOR
+ done
+fi
+}
+
+choose_kernel() {
+while [ 0 ]; do # input loop
+cat << EOF > $TMP/tmpmsg
+
+Some possible paths to kernels are these:
+
+/boot/vmlinuz
+/usr/src/linux/arch/i386/boot/bzImage
+/usr/src/linux/arch/i386/boot/zImage
+/vmlinuz
+
+Put the path to the kernel you want to use in the box below.
+
+EOF
+
+ dialog --title "CHOOSE KERNEL" --inputbox "`cat $TMP/tmpmsg`" \
+ 16 72 "/boot/vmlinuz" 2> $TMP/return
+ if [ ! $? = 0 ]; then
+ exit
+ fi
+
+ KERNEL="`cat $TMP/return`"
+
+ if [ ! -r "$KERNEL" ]; then
+ dialog --title "NOT FOUND!" --msgbox "$KERNEL" 5 60
+ continue
+ fi
+ KMSG="Using kernel $KERNEL"
+break
+done
+}
+
+format_disk() {
+ # If anyone still uses 1.2 MB, you'll have to uncomment this.
+ # It's no longer a default option.
+ #FDEV=/dev/fd0h1200
+ #FDEV=/dev/fd0u1400
+ FDEV=/dev/fd0u1680
+ if [ "$FDEV" = "/dev/fd0u1680" ]; then
+ dialog --title "Formatting /dev/fd0u1680" --infobox \
+ "Formatting /dev/fd0, 1.68 megabytes." 3 42
+ elif [ "$FDEV" = "/dev/fd0u1400" ]; then
+ dialog --title "Formatting /dev/fd0u1440" --infobox \
+ "Formatting /dev/fd0, 1.44 megabytes." 3 42
+ elif [ "$FDEV" = "/dev/fd0h1200" ]; then
+ dialog --title "Formatting /dev/fd0h1200" --infobox \
+ "Formatting /dev/fd0, 1.2 megabytes." 3 42
+ fi
+ 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
+ return 1
+ fi
+}
+
+DEFAULT_ITEM="syslinux"
+
+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. \
+Which option would you like?" 12 67 2 \
+"syslinux" "Make a SYSLINUX bootdisk" \
+"exit" "Exit this program" 2> $TMP/return
+ if [ ! $? = 0 ]; then
+ break;
+ fi
+ REPLY=`cat $TMP/return`
+ rm -f $TMP/return
+ if [ "$REPLY" = "simple" ]; then # make simple bootdisk
+ if [ "$KERNEL" = "" ]; then
+ choose_kernel
+ fi
+ kernel_size=`du -Lk $KERNEL | cut -f1`
+ if [ "$kernel_size" -gt "1023" ]; then
+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'
+method instead.
+
+EOF
+ dialog --title "KERNEL TOO BIG!" --msgbox "`cat $TMP/tmpmsg`" 10 60
+ continue
+ fi
+ dialog --title "BOOT DISK CREATION" --backtitle "$KMSG" --yesno \
+"\n\
+Now put a formatted floppy in your boot drive. \n\
+This will be made into your Linux boot disk. Use this to\n\
+boot Linux until LILO has been configured to boot from\n\
+the hard drive.\n\n\
+Any data on the target disk will be destroyed.\n\n\
+YES creates the disk, NO aborts.\n" 14 62
+ if [ $? = 0 ]; then
+ format_disk
+ dialog --title "CREATING DISK" --infobox "Creating boot disk from $KERNEL..." 5 72
+ dd if=$KERNEL of=/dev/fd0 2> /dev/null
+ rdev /dev/fd0 $ROOT_DEVICE
+ rdev -v /dev/fd0 -1
+ if [ "$MOUNT" = "read-only" ]; then
+ rdev -R /dev/fd0 1
+ else
+ rdev -R /dev/fd0 0
+ fi
+ fi
+ elif [ "$REPLY" = "syslinux" ]; then # make syslinux bootdisk
+ DEFAULT_ITEM="exit"
+ if [ "$KERNEL" = "" ]; then
+ 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
+ if [ $? = 0 ]; then # make the disk
+ format_disk
+ if [ ! $? = 0 ]; then
+ continue
+ fi
+ dialog --title "CREATING BOOT FLOPPY" --infobox "Creating SYSLINUX bootdisk for \
+$ROOT_DEVICE in /dev/fd0." 3 64
+ mkdosfs -F 12 /dev/fd0u1680 1680 1> /dev/null 2> /dev/null
+ if [ ! -d $TMP/bootdisk ]; then
+ mkdir $TMP/bootdisk
+ fi
+ mount -t vfat /dev/fd0 $TMP/bootdisk 1> /dev/null 2> /dev/null
+ cp $KERNEL $TMP/bootdisk/vmlinuz
+ ## This avoids a syslinux-1.72 bug, and doesn't seem to hurt anything:
+ #dd if=/dev/zero bs=1k count=1 >> $TMP/bootdisk/vmlinuz 2> /dev/null
+ 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. \
+This program will now exit." 0 0
+ umount /dev/fd0
+ rm -rf $TMP/bootdisk
+ exit 1
+ fi
+ cat << EOF > $TMP/bootdisk/message.txt
+
+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
+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
+kernel parameters you might need depending on your hardware, and which
+drivers are included in your kernel.
+
+EOF
+ cat << EOF > $TMP/bootdisk/syslinux.cfg
+default vmlinuz ramdisk_size=7000 root=$ROOT_DEVICE vga=normal ro
+prompt 1
+timeout 6000
+display message.txt
+F1 f1.txt
+F2 message.txt
+#F3 f3.txt
+#F4 f4.txt
+#F5 f5.txt
+#F6 f6.txt
+#F7 f7.txt
+label mount
+ kernel vmlinuz
+ append ramdisk_size=7000 root=$ROOT_DEVICE vga=normal ro
+label ramdisk
+ kernel vmlinuz
+ append vmlinuz ramdisk_size=7000 root=/dev/fd0u1440 vga=normal rw
+EOF
+ cat << EOF > $TMP/bootdisk/f1.txt
+ STANDARD MODES:
+ To make the kernel prompt for standard video modes use: vga=ask
+
+ 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:
+
+ Colors 640x480 800x600 1024x768 1280x1024 1600x1200
+ --------+---------------------------------------------
+ 256 | 769 771 773 775 796
+ 32,768 | 784 787 790 793 797
+ 65,536 | 785 788 791 794 798
+ 16.8M | 786 789 792 795 799
+
+ ...such as this for 1024x768x64k:
+ vga=791
+
+ F2 returns to the previous page.
+
+EOF
+ umount /dev/fd0
+ syslinux-nomtools -s /dev/fd0
+ rm -r $TMP/bootdisk
+ fi
+ elif [ "$REPLY" = "lilo" ]; then # make lilo bootdisk
+ DEFAULT_ITEM="exit"
+ if [ ! -x "`type -path lilo`" ]; then
+cat << EOF > $TMP/tmpmsg
+
+You don't have 'lilo' installed on the system.
+I guess you didn't install the lilo package.
+
+EOF
+ dialog --title "LILO NOT FOUND" --msgbox "`cat $TMP/tmpmsg`" 8 60
+ continue
+ fi
+ if [ "$KERNEL" = "" ]; then
+ 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
+ if [ $? = 0 ]; then # make the disk
+ format_disk
+ DEV=/dev/fd0u1680
+ mknod_fd="-m 0640 $TMP/lilo$DEV b 2 44"
+ dialog --infobox "Creating LILO bootdisk from $KERNEL for $ROOT_DEVICE..." 4 60
+ mke2fs -q -m 0 -i 4096 $DEV 1> /dev/null 2> /dev/null || exit 1
+ if [ ! -d $TMP/lilo ]; then
+ mkdir -p $TMP/lilo
+ fi
+ mount -t ext2 $DEV $TMP/lilo 1> /dev/null || exit 1
+ rmdir $TMP/lilo/lost+found
+ cp $KERNEL $TMP/lilo/vmlinuz || exit 1
+ mkdir $TMP/lilo/dev
+ make_root_device
+ mknod -m 0640 $TMP/lilo/dev/fd0 b 2 0
+ mknod -m 0640 $TMP/lilo/dev/fd1 b 2 1
+ mknod $mknod_fd
+ mknod -m 0666 $TMP/lilo/dev/null c 1 3
+ mkdir $TMP/lilo/etc
+ cat << EOF > $TMP/lilo/etc/lilo.conf
+boot = $DEV
+message=/boot/message
+backup=/dev/null
+prompt
+image = /vmlinuz
+ label = mount
+ ramdisk = 0
+ root = $ROOT_DEVICE
+ vga = normal
+ $MOUNT
+EOF
+ mkdir $TMP/lilo/boot
+ cp -a /boot/chain.b $TMP/lilo/boot
+ if [ -f /boot/boot-text.b ]; then
+ cp -a /boot/boot-text.b $TMP/lilo/boot/boot.b
+ else
+ cp -a /boot/boot.b $TMP/lilo/boot
+ fi
+ cat << EOF > $TMP/lilo/boot/message
+
+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
+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
+parameters you might need depending on your hardware, and which drivers are
+included in your kernel.
+
+EOF
+ lilo -r $TMP/lilo > /dev/null
+ umount $TMP/lilo
+ rm -rf $TMP/lilo
+ fi
+ elif [ "$REPLY" = "exit" ]; then
+ break;
+ fi
+done
diff --git a/testing/source/pkgtools/scripts/makepkg b/testing/source/pkgtools/scripts/makepkg
new file mode 100644
index 00000000..f9241cb9
--- /dev/null
+++ b/testing/source/pkgtools/scripts/makepkg
@@ -0,0 +1,452 @@
+#!/bin/sh
+# Copyright 1994, 1998, 2008 Patrick Volkerding, Moorhead, Minnesota USA
+# Copyright 2003 Slackware Linux, Inc. Concord, CA 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
+# 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.
+#
+# 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>
+#
+# Sun Apr 5 21:23:26 CDT 2009
+# Support .tgz, .tbz, .tlz, and .txz packages. <volkerdi>
+#
+# Fri Nov 26 13:53:36 GMT 2004
+# Patched to chmod 755 the package's root directory if needed, then restore
+# previous permissions after the package has been created. <sw>
+#
+# Wed Mar 18 15:32:33 CST 1998
+# Patched to avoid possible symlink attacks in /tmp.
+
+CWD=$(pwd)
+
+umask 022
+
+make_install_script() {
+ TAB="$(echo -e "\t")"
+ COUNT=1
+ while :; do
+ LINE="$(sed -n "$COUNT p" $1)"
+ if [ "$LINE" = "" ]; then
+ break
+ fi
+ LINKGOESIN="$(echo "$LINE" | cut -f 1 -d "$TAB")"
+ LINKGOESIN="$(dirname "$LINKGOESIN")"
+ LINKNAMEIS="$(echo "$LINE" | cut -f 1 -d "$TAB")"
+ LINKNAMEIS="$(basename "$LINKNAMEIS")"
+ LINKPOINTSTO="$(echo "$LINE" | cut -f 2 -d "$TAB")"
+ echo "( cd $LINKGOESIN ; rm -rf $LINKNAMEIS )"
+ echo "( cd $LINKGOESIN ; ln -sf $LINKPOINTSTO $LINKNAMEIS )"
+ COUNT=$(expr $COUNT + 1)
+ done
+}
+
+usage() {
+ cat << EOF
+
+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
+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)
+ --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 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
+ LINKADD=y
+ elif [ "$2" = "n" ]; then
+ LINKADD=n
+ else
+ usage
+ exit 2
+ fi
+ shift 2
+ elif [ "$1" = "--chown" -o "$1" = "-c" ]; then
+ if [ "$2" = "y" ]; then
+ CHOWN=y
+ elif [ "$2" = "n" ]; then
+ CHOWN=n
+ else
+ usage
+ exit 2
+ fi
+ shift 2
+ 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
+ else
+ break
+ fi
+done
+
+PACKAGE_NAME="$1"
+TARGET_NAME="$(dirname $PACKAGE_NAME)"
+PACKAGE_NAME="$(basename $PACKAGE_NAME)"
+
+# 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
+ 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."
+ exit 1
+fi
+
+TAR_NAME="$(basename $PACKAGE_NAME .$EXTENSION)"
+
+# Sanity check -- we can't make the package in the current directory:
+if [ "$CWD" = "$TARGET_NAME" -o "." = "$TARGET_NAME" ]; then
+ echo "ERROR: Can't make output package in current directory."
+ exit 2
+fi
+
+echo
+echo "Slackware package maker, version 3.14159265."
+echo
+echo "Searching for symbolic links:"
+# Get rid of possible pre-existing trouble:
+INST=$(mktemp $TMP/makepkg.XXXXXX)
+find . -type l -printf "%p\t%l\n" | sed 's,^\./,, ; s, ,\\ ,g' | tee $INST
+if [ ! "$(cat $INST)" = "" ]; then
+ echo
+ echo "Making symbolic link creation script:"
+ make_install_script $INST | tee doinst.sh
+fi
+echo
+if [ ! "$(cat $INST)" = "" ]; then
+ if [ -r install/doinst.sh ]; then
+ echo "Unless your existing installation script already contains the code"
+ echo "to create these links, you should append these lines to your existing"
+ echo "install script. Now's your chance. :^)"
+ echo
+ echo "Would you like to add this stuff to the existing install script and"
+ echo -n "remove the symbolic links ([y]es, [n]o)? "
+ else
+ echo "It is recommended that you make these lines your new installation script."
+ echo
+ echo "Would you like to make this stuff the install script for this package"
+ echo -n "and remove the symbolic links ([y]es, [n]o)? "
+ fi
+ if [ ! "$LINKADD" ]; then
+ read LINKADD;
+ echo
+ else
+ echo $LINKADD
+ echo
+ fi
+ if [ "$LINKADD" = "y" ]; then
+ if [ -r install/doinst.sh ]; then
+ UPDATE="t"
+ if [ "$PREPEND" = "y" ]; then
+ touch install/doinst.sh
+ mv install/doinst.sh install/doinst.sh.shipped
+ cat doinst.sh > install/doinst.sh
+ echo "" >> install/doinst.sh
+ cat install/doinst.sh.shipped >> install/doinst.sh
+ rm -f install/doinst.sh.shipped
+ else
+ cat doinst.sh >> install/doinst.sh
+ fi
+ else
+ mkdir -p install
+ cat doinst.sh > install/doinst.sh
+ fi
+ echo
+ echo "Removing symbolic links:"
+ find . -type l -exec rm -v {} \;
+ echo
+ if [ "$UPDATE" = "t" ]; then
+ if [ "$PREPEND" = "y" ]; then
+ echo "Updating your ./install/doinst.sh (prepending symlinks)..."
+ else
+ echo "Updating your ./install/doinst.sh..."
+ fi
+ else
+ echo "Creating your new ./install/doinst.sh..."
+ fi
+ fi
+else
+ echo "No symbolic links were found, so we won't make an installation script."
+ echo "You can make your own later in ./install/doinst.sh and rebuild the"
+ echo "package if you like."
+fi
+rm -f doinst.sh $INST
+echo
+echo "This next step is optional - you can set the directories in your package"
+echo "to some sane permissions. If any of the directories in your package have"
+echo "special permissions, then DO NOT reset them here!"
+echo
+echo "Would you like to reset all directory permissions to 755 (drwxr-xr-x) and"
+echo -n "directory ownerships to root.root ([y]es, [n]o)? "
+if [ ! "$CHOWN" ]; then
+ read CHOWN;
+ echo
+else
+ echo $CHOWN
+ echo
+fi
+if [ "$CHOWN" = "y" ]; then
+ find . -type d -exec chmod -v 755 {} \;
+ find . -type d -exec chown -v root.root {} \;
+fi
+
+# Ensure that the 'root' of the package is chmod 755 because
+# the / of your filesystem will inherit these permissions.
+# If it's anything tighter than 755 then bad things happen such as users
+# not being able to login, users already logged in can no longer run commands
+# and so on.
+OLDROOTPERMS="$(find -name . -printf "%m\n")"
+if [ $OLDROOTPERMS -ne 755 ]; then
+ echo "WARNING: $PWD is chmod $OLDROOTPERMS"
+ echo " temporarily changing to chmod 755"
+ chmod 755 .
+fi
+
+echo "Creating Slackware package: ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}"
+echo
+rm -f ${TARGET_NAME}/${TAR_NAME}.${EXTENSION}
+
+# 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
+ echo "WARNING: zero length file $(echo $file | cut -b3-)"
+done
+
+# Warn of corrupt or empty gzip files:
+find . -type f -name '*.gz' | while read file ; do
+ if ! gzip -t $file 1> /dev/null 2> /dev/null ; then
+ echo "WARNING: gzip test failed on $(echo $file | cut -b3-)"
+ else
+ if [ "$(gzip -l $file | tail -n 1 | tr -s ' ' | cut -f 3 -d ' ')" -eq 0 ]; then
+ echo "WARNING: $(echo $file | cut -b3-) is an empty gzipped file"
+ fi
+ fi
+done
+
+# Some more handy warnings:
+if [ -d usr/share/man ]; then
+ echo "WARNING: /usr/share/man (with possibly not gzipped man pages) detected"
+fi
+
+if [ -d usr/share/info ]; then
+ echo "WARNING: /usr/share/info (with possibly not gzipped info pages) detected"
+fi
+
+if find . | grep site_perl 1> /dev/null ; then
+ echo "WARNING: site_perl directory detected (this is fine for a local package build)"
+fi
+
+# Restore the old permissions if they previously weren't chmod 755
+if [ $OLDROOTPERMS -ne 755 ]; then
+ echo
+ echo "Restoring permissions of $PWD to chmod $OLDROOTPERMS"
+ chmod $OLDROOTPERMS .
+fi
+
+echo
+echo "Slackware package ${TARGET_NAME}/${TAR_NAME}.${EXTENSION} created."
+echo
diff --git a/testing/source/pkgtools/scripts/pkgdiff b/testing/source/pkgtools/scripts/pkgdiff
new file mode 100644
index 00000000..ca21ad8f
--- /dev/null
+++ b/testing/source/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/testing/source/pkgtools/scripts/pkgtool b/testing/source/pkgtools/scripts/pkgtool
new file mode 100644
index 00000000..076402b8
--- /dev/null
+++ b/testing/source/pkgtools/scripts/pkgtool
@@ -0,0 +1,723 @@
+#!/bin/sh
+#
+# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999 Patrick Volkerding, Moorhead, MN USA
+# Copyright 2001, 2004 Slackware Linux, Inc., Concord, CA USA
+# All rights reserved.
+# Copyright 2007, 2009, 2010, 2011, 2013, 2015, 2016, 2018 Patrick Volkerding, Sebeka, MN, USA
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 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.
+#
+
+# Mon Jun 4 21:17:58 UTC 2018
+# Use /var/lib/pkgtools, not /var/log.
+#
+# Sat Apr 25 21:18:53 UTC 2009
+# Converted to use new pkgbase() function to remove pathname and
+# valid package extensions.
+#
+# Wed Oct 31 16:28:46 CDT 2007
+# * Thanks to Gabriele Inghirami for a patch allowing this script to work
+# with much larger numbers of installed packages.
+# Wed, 27 Apr 1994 00:06:50 -0700 (PDT)
+# * Optimization by David Hinds.
+# Sun Oct 24 23:11:40 BST 2004
+# * Further optimisations by Jim Hawkins <jawkins@armedslack.org>
+# - dramatically improved the speed of the "View" option
+# Thu Nov 04 12:19:56 BST 2004
+# * More optimisations by Jim Hawkins
+# - improved "Remove" speed in a similar manner to "View"
+# Wed Jan 12 16:53:48 GMT 2005
+# * Fixed quoting bug thanks to Lasse Collin
+# Wed Jan 26 23:06:22 GMT 2005
+# * Fix for non-standard package descriptions by Jim Hawkins
+
+# Return a package name that has been stripped of the dirname portion
+# and any of the valid extensions (only):
+pkgbase() {
+ PKGEXT=$(echo $1 | rev | cut -f 1 -d . | rev)
+ case $PKGEXT in
+ 'tgz' )
+ PKGRETURN=$(basename $1 .tgz)
+ ;;
+ 'tbz' )
+ PKGRETURN=$(basename $1 .tbz)
+ ;;
+ 'tlz' )
+ PKGRETURN=$(basename $1 .tlz)
+ ;;
+ 'txz' )
+ PKGRETURN=$(basename $1 .txz)
+ ;;
+ *)
+ PKGRETURN=$(basename $1)
+ ;;
+ esac
+ echo $PKGRETURN
+}
+
+SOURCE_DIR=/var/lib/pkgtools/mount
+ASK="tagfiles"
+if [ -L /bin/chmod -a -L /bin/chown ]; then # probably on the bootdisk using busybox
+ TARGET_DIR=/mnt
+ rootdevice="$(mount | grep ' on /mnt ' | tail -n 1 | cut -f 1 -d ' ' 2> /dev/null)"
+ TMP=/mnt/var/lib/pkgtools/setup/tmp
+ if ! mount | grep ' on /mnt ' 1> /dev/null 2> /dev/null ; then
+ 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
+ echo "If your root partition is /dev/sda1 you would type:"
+ echo "mount /dev/sda1 /mnt"
+ echo
+ echo "Now you can find a list of all your partitions in /mnt/etc/fstab."
+ echo
+ echo "Then, supposing your /usr partition is /dev/sda2, you must do this:"
+ echo "mount /dev/sda2 /mnt/usr"
+ echo
+ echo "Please mount your Linux partitions and then run pkgtool again."
+ echo
+ exit
+ fi
+else
+ TARGET_DIR=/
+ rootdevice="$(mount | grep ' on / ' | tail -n 1 | cut -f 1 -d ' ')"
+ TMP=/var/lib/pkgtools/setup/tmp
+fi
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+ chmod 700 $TMP
+ fi
+ADM_DIR=$TARGET_DIR/var/lib/pkgtools
+LOG=$TMP/PKGTOOL.REMOVED
+
+# remove whitespace
+crunch() {
+ while read FOO ; do
+ echo $FOO
+ done
+}
+
+package_name() {
+ STRING=$(pkgbase $1)
+ # Check for old style package name with one segment:
+ if [ "$(echo $STRING | cut -f 1 -d -)" = "$(echo $STRING | cut -f 2 -d -)" ]; then
+ echo $STRING
+ else # has more than one dash delimited segment
+ # Count number of segments:
+ INDEX=1
+ while [ ! "$(echo $STRING | cut -f $INDEX -d -)" = "" ]; do
+ INDEX=$(expr $INDEX + 1)
+ done
+ INDEX=$(expr $INDEX - 1) # don't include the null value
+ # If we don't have four segments, return the old-style (or out of spec) package name:
+ if [ "$INDEX" = "2" -o "$INDEX" = "3" ]; then
+ echo $STRING
+ else # we have four or more segments, so we'll consider this a new-style name:
+ NAME=$(expr $INDEX - 3)
+ NAME="$(echo $STRING | cut -f 1-$NAME -d -)"
+ echo $NAME
+ # cruft for later ;)
+ #VER=$(expr $INDEX - 2)
+ #VER="$(echo $STRING | cut -f $VER -d -)"
+ #ARCH=$(expr $INDEX - 1)
+ #ARCH="$(echo $STRING | cut -f $ARCH -d -)"
+ #BUILD="$(echo $STRING | cut -f $INDEX -d -)"
+ fi
+ fi
+}
+
+remove_packages() {
+ for pkg_name in $(cat $TMP/return | tr -d "\042")
+ do
+ if [ -r $ADM_DIR/packages/$pkg_name ]; then
+ dialog --title "PACKAGE REMOVAL IN PROGRESS" --cr-wrap --infobox \
+"\nRemoving package $pkg_name.\n\
+\n\
+Since each file must be checked \
+against the contents of every other installed package to avoid wiping out \
+areas of overlap, this process can take quite some time. If you'd like to \
+watch the progress, flip over to another virtual console and type:\n\
+\n\
+tail -f $TMP/PKGTOOL.REMOVED\n" 13 60
+ export ROOT=$TARGET_DIR
+ removepkg $pkg_name >> $LOG 2> /dev/null
+ else
+ echo "No such package: $pkg_name. Can't remove." >> $LOG
+ fi
+ done
+}
+
+create_list_of_installed_packages()
+{
+ FILES=$(ls $ADM_DIR/packages)
+ if [ -n "$FILES" ]; then
+ cd $ADM_DIR/packages
+ { grep '^PACKAGE DESCRIPTION:$' -Z -H -m1 -A1 $FILES; echo; } \
+ | sed -n 'h;n;/\x00/{h;n;};x;s/ */ /g;s/ $//;s/[\"`$]/\\&/g
+ s/\(.*\)\x00\([^:]*:\)\? *\(.*\)/ "\1" "\3" "View information about package \1" \\/;p' > $TMP/list_of_installed_packages \
+
+ fi
+}
+
+ create_list_of_files_to_remove ()
+{
+FILES=$(ls $ADM_DIR/packages)
+ if [ -n "$FILES" ]; then
+ cd $ADM_DIR/packages
+ { grep '^PACKAGE DESCRIPTION:$' -Z -H -m1 -A1 $FILES; echo; } \
+ | sed -n 'h;n;/\x00/{h;n;};x;s/ */ /g;s/ $//;s/[\"`$]/\\&/g
+ s/\(.*\)\x00\([^:]*:\)\? *\(.*\)/ "\1" "\3" off "Select\/Unselect removing package \1" \\/;p' > $TMP/temporary_list \
+
+ fi
+}
+
+# Here, we read the list of arguments passed to the pkgtool script.
+if [ $# -gt 0 ]; then # there are arguments to the command
+ while [ $# -gt 0 ]; do
+ case "$1" in
+ -sets | --sets)
+ DISK_SETS=$(echo $2 | tr "[A-Z]" "[a-z]") ; shift 2 ;;
+ -source_mounted | --source-mounted)
+ SOURCE_MOUNTED="always" ; shift 1 ;;
+ -ignore_tagfiles | --ignore-tagfiles)
+ ASK="never" ; shift 1 ;;
+ -tagfile | --tagfile)
+ USETAG=$2 ; shift 2 ;;
+ -source_dir | --source_dir)
+ SOURCE_DIR=$2 ; shift 2 ;;
+ -target_dir | --target_dir)
+ TARGET_DIR=$2
+ ADM_DIR=$TARGET_DIR/var/lib/pkgtools
+ shift 2 ;;
+ -source_device | --source_device)
+ SOURCE_DEVICE=$2 ; shift 2 ;;
+ esac
+ done
+else # there were no arguments, so we'll get the needed information from the
+ # user and then go on.
+ CMD_START="true"
+ rm -f $TMP/SeT*
+ while [ 0 ]; do
+ dialog --title "Slackware Package Tool (pkgtool version 15.0)" \
+--menu "\nWelcome to the Slackware package tool.\n\
+\nWhich option would you like?\n" 16 75 6 \
+"Current" "Install packages from the current directory" \
+"Other" "Install packages from some other directory" \
+"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" \
+"Exit" "Exit Pkgtool" 2> $TMP/reply
+ if [ ! $? = 0 ]; then
+ rm -f $TMP/reply
+ dialog --clear
+ exit
+ fi
+ REPLY="$(cat $TMP/reply)"
+ rm -f $TMP/reply
+ if [ "$REPLY" = "Exit" ]; then
+ dialog --clear
+ exit
+ 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 \
+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-)
+ if [ "$BLURB" = "" ]; then
+ BLURB="\"\""
+ fi
+ echo " \"$(basename $script | cut -f2- -d .)\" $BLURB \"no\" $BLURB \\" >> $TMP/setupscr
+ done
+ echo "2> $TMP/return" >> $TMP/setupscr
+ . $TMP/setupscr
+ if [ ! "$(cat $TMP/return)" = "" ]; then
+ # Run each script:
+ for script in $(cat $TMP/return) ; do
+ scrpath=$ADM_DIR/setup/setup.$(echo $script | tr -d \")
+ ( COLOR=on ; cd $TARGET_DIR ; . $scrpath $TARGET_DIR $rootdevice )
+ done
+ fi
+ rm -f $TMP/return $TMP/setupscr
+ continue
+ fi # end Setup
+
+ if [ "$REPLY" = "View" ]; then
+create_list_of_installed_packages
+ DEFITEM=""
+ export DEFITEM
+ #dialog --title "SCANNING" --infobox "Please wait while \
+#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 \'
+ ) > $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
+ DEFITEM="--default-item $(cat $TMP/return)"
+ dialog --title "CONTENTS OF PACKAGE: $(cat $TMP/return)" --no-shadow --textbox "$ADM_DIR/packages/$(cat $TMP/return)" \
+ 0 0 2> /dev/null
+ else
+ break
+ fi
+ done
+ rm -f $TMP/return $TMP/viewscr $TMP/tmpmsg $TMP/list_of_installed_packages
+ # This will clean up after most defective packages:
+ chmod 755 /
+ chmod 1777 /tmp
+ continue
+ fi
+
+ if [ "$REPLY" = "Remove" ]; then
+ #dialog --title "SCANNING" --infobox "Please wait while Pkgtool scans \
+#your system to determine which packages you have installed and prepares \
+#a list for you." 0 0
+ # end section
+ (
+create_list_of_files_to_remove #call the function to create a list of installed packages
+ cat << EOF
+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 \\
+EOF
+ ) > $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
+ cat /dev/null > $LOG
+ chmod 600 $LOG
+ chmod 700 $TMP/rmscript
+ export ADM_DIR;
+ $TMP/rmscript
+ remove_packages
+ if [ "$(cat $TMP/PKGTOOL.REMOVED)" = "" ]; then
+ rm -f $TMP/PKGTOOL.REMOVED
+ dialog --title "NO PACKAGES REMOVED" --msgbox "Hit OK to return \
+to the main menu." 5 40
+ else
+ dialog --title "PACKAGE REMOVAL COMPLETE" --msgbox "The packages have \
+been removed. A complete log of the files that were removed has been created \
+in $TMP: PKGTOOL.REMOVED." 0 0
+ fi
+ rm -f $TMP/rmscript $TMP/return $TMP/tmpmsg $TMP/SeT* $TMP/temporary_list
+ chmod 755 /
+ chmod 1777 /tmp
+# No, return to the main menu:
+# exit
+ 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
+ if [ $? = 1 ]; then
+ rm -f $TMP/pkgdir $TMP/SeT*
+ dialog --clear
+ exit
+ fi
+ SOURCE_DIR="$(cat $TMP/pkgdir)"
+ SOURCE_MOUNTED="always"
+ DISK_SETS="disk"
+ chmod 755 $TARGET_DIR
+ chmod 1777 $TARGET_DIR/tmp
+ rm -f $TMP/pkgdir
+ if [ ! -d $SOURCE_DIR ]; then
+ dialog --title "DIRECTORY NOT FOUND" --msgbox "The directory you want to \
+install from ($SOURCE_DIR) \
+does not seem to exist. Please check the directory and then try again." \
+10 50
+ dialog --clear
+ exit
+ fi
+ break;
+ else # installing from current directory
+ SOURCE_MOUNTED="always"
+ SOURCE_DIR="$PWD"
+ DISK_SETS="disk"
+ chmod 755 $TARGET_DIR
+ chmod 1777 $TARGET_DIR/tmp
+ break;
+ fi
+ done
+fi
+if [ "$DISK_SETS" = "disk" ]; then
+ ASK="always"
+fi
+
+mount_the_source() {
+ # is the source supposed to be mounted already?
+ if [ "$SOURCE_MOUNTED" = "always" ]; then
+ # The source should already be mounted, so we test it
+ if [ ! -d $SOURCE_DIR ]; then # the directory is missing
+ cat << EOF > $TMP/tmpmsg
+
+Your source device cannot be accessed properly.
+
+Please be sure that it is mounted on $SOURCE_DIR,
+and that the Slackware disks are found in subdirectories
+of $SOURCE_DIR like specified.
+
+EOF
+ dialog --title "MOUNT ERROR" --msgbox "$(cat $TMP/tmpmsg)" 11 67
+ rm -f $TMP/tmpmsg
+ exit 1;
+ fi
+ return 0;
+ fi
+ dialog --title "INSERT DISK" --menu "Please insert disk $1 and \
+press ENTER to continue." \
+11 50 3 \
+"Continue" "Continue with the installation" \
+"Skip" "Skip the current disk series" \
+"Quit" "Abort the installation process" 2> $TMP/reply
+ if [ ! $? = 0 ]; then
+ REPLY="Quit"
+ else
+ REPLY="$(cat $TMP/reply)"
+ fi
+ rm -f $TMP/reply
+ if [ "$REPLY" = "Skip" ]; then
+ return 1;
+ fi
+ if [ "$REPLY" = "Quit" ]; then
+ dialog --title "ABORTING" --msgbox "Aborting software installation." 5 50
+ chmod 755 $TARGET_DIR
+ chmod 1777 $TARGET_DIR/tmp
+ exit 1;
+ fi;
+ # Old line:
+ # mount -r -t msdos $SOURCE_DEVICE $SOURCE_DIR
+ # New ones: (thanks to Andy Schwierskott!)
+ go_on=y
+ not_successfull_mounted=1
+ while [ "$go_on" = y -a "$not_successfull_mounted" = 1 ]; do
+ mount -r -t msdos $SOURCE_DEVICE $SOURCE_DIR
+ not_successfull_mounted=$?
+ if [ "$not_successfull_mounted" = 1 ]; then
+ mount_answer=x
+ while [ "$mount_answer" != "y" -a "$mount_answer" != "q" ] ; do
+ dialog --title "MOUNT PROBLEM" --menu "Media was not successfully \
+mounted! Do you want to \
+retry, or quit?" 10 60 2 \
+"Yes" "Try to mount the disk again" \
+"No" "No, abort." 2> $TMP/mntans
+ mount_answer="$(cat $TMP/mntans)"
+ rm -f $TMP/mntans
+ if [ "$mount_answer" = "Yes" ]; then
+ mount_answer="y"
+ else
+ mount_answer="q"
+ fi
+ done
+ go_on=$mount_answer
+ fi
+ done
+ test $not_successfull_mounted = 0
+}
+
+umount_the_source() {
+ if [ ! "$SOURCE_MOUNTED" = "always" ]; then
+ umount $SOURCE_DEVICE 1> /dev/null 2> /dev/null
+ fi;
+}
+
+install_disk() {
+ mount_the_source $1
+ if [ $? = 1 ]; then
+ umount_the_source;
+ return 1;
+ fi
+ CURRENT_DISK_NAME="$1"
+ PACKAGE_DIR=$SOURCE_DIR
+ if [ "$SOURCE_MOUNTED" = "always" -a ! "$DISK_SETS" = "disk" ]; then
+ PACKAGE_DIR=$PACKAGE_DIR/$1
+ fi
+
+ # If this directory is missing or contains no *.t?z files, bail.
+ if [ ! -d $PACKAGE_DIR ]; then
+ return 1
+ fi
+ if ! ls $PACKAGE_DIR/*.t?z 1> /dev/null 2> /dev/null ; then
+ return 1
+ fi
+
+ #
+ # look for tagfile for this series and copy into $TMP/tagfile
+ #
+ touch $TMP/tagfile
+ if [ ! "$DISK_SETS" = "disk" ]; then
+ if [ -r $TMP/SeTtagext ]; then
+ if [ -r $PACKAGE_DIR/tagfile$(cat $TMP/SeTtagext) ]; then
+ cat $PACKAGE_DIR/tagfile$(cat $TMP/SeTtagext) >> $TMP/tagfile
+ else
+ if [ -r $PACKAGE_DIR/tagfile ]; then
+ cat $PACKAGE_DIR/tagfile >> $TMP/tagfile
+ fi
+ fi
+
+ #
+ # Do we need to follow a custom path to the tagfiles?
+ #
+ elif [ -r $TMP/SeTtagpath ]; then
+ custom_path=$(cat $TMP/SeTtagpath)
+ short_path=$(basename $PACKAGE_DIR)
+
+ # If tagfile exists at the specified custom path, copy it over.
+ if [ -r $custom_path/$short_path/tagfile ]; then
+ cat $custom_path/$short_path/tagfile >> $TMP/tagfile
+
+ else # well, I guess we'll use the default one then.
+ if [ -r $PACKAGE_DIR/tagfile ]; then
+ cat $PACKAGE_DIR/tagfile >> $TMP/tagfile
+ fi
+ fi
+ #
+ # We seem to be testing for this too often... maybe this code should
+ # be optimized a little...
+ #
+ elif [ -r $PACKAGE_DIR/tagfile ]; then
+ cat $PACKAGE_DIR/tagfile >> $TMP/tagfile
+ fi
+
+ #
+ # Execute menus if in QUICK mode:
+ #
+ if [ -r $TMP/SeTQUICK -a -r $PACKAGE_DIR/maketag ]; then
+ if [ ! "$MAKETAG" = "" -a -r $PACKAGE_DIR/$MAKETAG ]; then # use alternate maketag
+ sh $PACKAGE_DIR/$MAKETAG
+ else
+ sh $PACKAGE_DIR/maketag
+ fi
+ if [ -r $TMP/SeTnewtag ]; then
+ mv $TMP/SeTnewtag $TMP/tagfile
+ fi
+ fi
+
+ #
+ # Protect tagfile from hacker attack:
+ #
+ if [ -r $TMP/tagfile ]; then
+ chmod 600 $TMP/tagfile
+ fi
+
+ fi # ! "$DISK_SETS" = "disk"
+
+ # 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
+ fi
+
+ # If there's a catalog file present, use it to check for missing files.
+ # If not, forget about that and install whatever's there.
+ if [ "$1" = "single_disk" -o -r $PACKAGE_DIR/disk$1 -o -r $PACKAGE_DIR/package-list.txt ]; then
+ if [ -r $PACKAGE_DIR/package-list.txt ]; then
+ CATALOG_FILE=$PACKAGE_DIR/package-list.txt
+ else
+ CATALOG_FILE=$(basename $PACKAGE_DIR/disk*);
+ fi
+ if [ -r $PACKAGE_DIR/$CATALOG_FILE -a ! -d $PACKAGE_DIR/$CATALOG_FILE ]; then
+ if grep CONTENTS: $PACKAGE_DIR/$CATALOG_FILE 1> /dev/null 2> /dev/null ; then
+ # First we check for missing packages...
+ for PKGTEST in $(grep "^CONTENTS:" $PACKAGE_DIR/$CATALOG_FILE | cut -f2- -d : 2> /dev/null) ; do
+ # This is not a perfect test. (say emacs is missing but emacs-nox is not)
+ if ls $PACKAGE_DIR/$PKGTEST*.t?z 1> /dev/null 2> /dev/null ; then # found something like it
+ true
+ else
+ cat << EOF > $TMP/tmpmsg
+
+WARNING!!!
+
+While looking through your index file ($CATALOG_FILE),
+I noticed that you might be missing a package:
+
+$PKGTEST-\*-\*-\*.t?z
+
+that is supposed to be on this disk (disk $1). You may go
+on with the installation if you wish, but if this is a
+crucial file I'm making no promises that your machine will
+boot.
+
+EOF
+ dialog --title "FILE MISSING FROM YOUR DISK" --msgbox \
+"$(cat $TMP/tmpmsg)" 17 67
+ fi
+ done # checking for missing packages
+ # Now we test for extra packages:
+ ALLOWED="$(grep CONTENTS: $PACKAGE_DIR/$CATALOG_FILE | cut -b10- 2> /dev/null)"
+ for PACKAGE_FILENAME in $PACKAGE_DIR/*.t?z; do
+ BASE=$(pkgbase $PACKAGE_FILENAME)
+ BASE="$(package_name $BASE)"
+ if echo $ALLOWED | grep $BASE 1> /dev/null 2> /dev/null ; then
+ true
+ else
+ cat << EOF > $TMP/tmpmsg
+
+WARNING!!!
+
+While looking through your index file ($CATALOG_FILE),
+I noticed that you have this extra package:
+
+($BASE.t?z)
+
+that I don't recognize. Please be sure this package is
+really supposed to be here, and is not left over from an
+old version of Slackware. Sometimes this can happen at the
+archive sites.
+
+EOF
+ dialog --title "EXTRA FILE FOUND ON YOUR DISK" \
+--msgbox "$(cat $TMP/tmpmsg)" 17 67
+ rm -f $TMP/tmpmsg
+ fi
+ done
+ fi
+ fi
+ fi # check for missing/extra packages
+
+ # Install the packages:
+ for PACKAGE_FILENAME in $PACKAGE_DIR/*.t?z; do
+ if [ "$PACKAGE_FILENAME" = "$PACKAGE_DIR/*.t?z" ]; then
+ continue;
+ fi
+ if [ "$ASK" = "never" ]; then # install the package
+ installpkg -root $TARGET_DIR -infobox -tagfile $TMP/tagfile $PACKAGE_FILENAME
+ ERROR=$?
+ elif [ "$ASK" = "tagfiles" ]; then
+ installpkg -root $TARGET_DIR -menu -tagfile $TMP/tagfile $PACKAGE_FILENAME
+ ERROR=$?
+ else # ASK should be = always here, and that's how we'll treat it
+ installpkg -root $TARGET_DIR -menu -ask -tagfile $TMP/tagfile $PACKAGE_FILENAME
+ ERROR=$?
+ fi
+ # Check for abort:
+ if [ "$ERROR" = "99" ]; then
+ umount_the_source;
+ chmod 755 $TARGET_DIR
+ chmod 1777 $TARGET_DIR/tmp
+ exit 1;
+ fi
+ done
+ OUTTAHERE="false"
+ if [ -r $PACKAGE_DIR/install.end ]; then
+ OUTTAHERE="true"
+ fi
+ umount_the_source;
+ if [ "$OUTTAHERE" = "true" ]; then
+ return 1;
+ fi
+}
+
+install_disk_set() { # accepts one argument: the series name in lowercase.
+ SERIES_NAME=$1
+ CURRENT_DISK_NUMBER="1";
+ while [ 0 ]; do
+ # Don't start numbering the directories until 2:
+ if [ $CURRENT_DISK_NUMBER = 1 ]; then
+ DISKTOINSTALL=$SERIES_NAME
+ else
+ DISKTOINSTALL=$SERIES_NAME$CURRENT_DISK_NUMBER
+ fi
+ install_disk $DISKTOINSTALL
+ if [ ! $? = 0 ]; then # install.end was found, or the user chose
+ # to quit installing packages.
+ return 0;
+ fi
+ CURRENT_DISK_NUMBER=$(expr $CURRENT_DISK_NUMBER + 1)
+ done;
+}
+
+# /* main() */ ;)
+if [ "$DISK_SETS" = "disk" ]; then
+ install_disk single_disk;
+ ASK="always"
+else
+ touch $TMP/tagfile
+ chmod 600 $TMP/tagfile
+ if echo $DISK_SETS | grep "#a#" 1> /dev/null 2> /dev/null ; then
+ A_IS_NEEDED="true"
+ else
+ A_IS_NEEDED="false"
+ fi
+ while [ 0 ];
+ do
+ while [ 0 ]; # strip leading '#'s
+ do
+ if [ "$(echo $DISK_SETS | cut -b1)" = "#" ]; then
+ DISK_SETS="$(echo $DISK_SETS | cut -b2-)"
+ else
+ break;
+ fi
+ done
+ if [ "$A_IS_NEEDED" = "true" ]; then
+ cat << EOF > $TMP/tmpmsg
+
+--- Installing package series ==>a<==
+
+EOF
+ dialog --infobox "$(cat $TMP/tmpmsg)" 5 45
+ sleep 1
+ rm -f $TMP/tmpmsg
+ install_disk_set a;
+ A_IS_NEEDED="false"
+ fi
+ count="1"
+ if [ "$(echo $DISK_SETS | cut -b$count)" = "" ]; then
+ break; # we be done here :^)
+ else
+ count="2"
+ while [ 0 ]; do
+ if [ "$(echo $DISK_SETS | cut -b$count)" = "" -o "$(echo $DISK_SETS | cut -b$count)" = "#" ]; then
+ count="$(expr $count - 1)"
+ break;
+ else
+ count="$(expr $count + 1)"
+ fi
+ done
+ fi
+ diskset="$(echo $DISK_SETS | cut -b1-$count)"
+ count="$(expr $count + 1)"
+ DISK_SETS="$(echo $DISK_SETS | cut -b$count-)"
+ if [ "$diskset" = "a" ]; then
+ continue; # we expect this to be done elsewhere
+ fi
+ cat << EOF > $TMP/tmpmsg
+
+Installing package series ==>$diskset<==
+
+EOF
+ dialog --infobox "$(cat $TMP/tmpmsg)" 5 45
+ sleep 1
+ rm -f $TMP/tmpmsg
+ install_disk_set $diskset;
+ done
+fi
+
+if [ "$DISK_SETS" = "disk" -o "$CMD_START" = "true" ]; then
+ if [ -r $TMP/tagfile ]; then
+ rm $TMP/tagfile
+ fi
+ dialog --clear
+fi
+chmod 755 $TARGET_DIR $TARGET_DIR/var $TARGET_DIR/usr
+chmod 1777 $TARGET_DIR/tmp
diff --git a/testing/source/pkgtools/scripts/removepkg b/testing/source/pkgtools/scripts/removepkg
new file mode 100644
index 00000000..b033eebf
--- /dev/null
+++ b/testing/source/pkgtools/scripts/removepkg
@@ -0,0 +1,438 @@
+#!/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, 2018 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.
+#
+
+# Tue Jun 5 20:04:45 UTC 2018
+# Use /var/lib/pkgtools for the package database, not /var/log.
+# Logs of the removed packages and scripts will remain in /var/log, but moved
+# into /var/log/pkgtools.
+#
+# Sun May 27 18:02:23 UTC 2018
+# Added --terse mode to print one line per removed package.
+#
+# 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.
+#
+# Sun Sep 6 21:58:36 BST 2009
+# Replaced pkgbase & package_name code with 'sed' script by Jim Hawkins.
+#
+# Sat Apr 25 21:18:53 UTC 2009 (12.34567890b)
+# Converted to use new pkgbase() function to remove pathname and
+# valid package extensions.
+#
+# Revision 12.34567890 Sun Apr 5 20:59:32 CDT 2009 <volkerdi>
+# - Support packages with the extensions: .tgz, .tbz, .tlz, .txz
+#
+# Revision 1.9 Wed Oct 31 14:04:28 CDT 2007 volkerding
+# - Fix problem removing packages with a large number of fields.
+# Thanks to Niki Kovacs for noticing this, and to Piter Punk
+# for the patch.
+# - Use LC_ALL=C locale, which is much faster with "sort".
+# Thanks to Tsomi.
+# - Don't try to remove any package that starts with '-'. This
+# is not a proper package name (usually a typo), and results
+# in the package database being broken. Thanks to Jef Oliver.
+# - Patched cat_except() to allow the last Slackware package on
+# a partition to be removed (using ROOT=, of course)
+# Thanks to Selkfoster for the patch, and to everyone else who
+# proposed solutions before. This issue really wasn't given
+# the highest priority before, but I figured while I'm in here...
+#
+# Revision 1.8 Thu Nov 22 14:00:13 PST 2001 volkerding Rel $
+# - Move $TMP underneath $ROOT
+# - Understand the idea of a base package name, so that packages
+# can be removed with any of these notations:
+# removepkg foo-1.0-i386-1.tgz
+# removepkg foo-1.0-i386-1
+# removepkg foo.tgz
+# removepkg foo
+#
+# Revision 1.7 2001/03/30 12:36:28 volkerding
+# - Strip extra ".tgz" from input names.
+#
+# Revision 1.6 1999/03/25 18:26:41 volkerding
+# - Use external $ROOT variable, like installpkg.
+#
+# Revision 1.5.1 1998/03/18 15:37:28 volkerding
+# - Since removepkg is always run by root, the temp directory has been
+# moved from /tmp to a private directory to avoid symlink attacks from
+# malicious users.
+#
+# Revision 1.5 1997/06/26 12:09:53 franke
+# - Fixed old bug in TRIGGER regex setting
+# - -preserve/-copy options now preserve non-unique files
+# and empty directories also
+#
+# Revision 1.4 1997/06/09 13:21:36 franke
+# - Package file preserve (-preserve, -copy) added.
+# - Don't execute "rm -rf" lines from doinst.sh, removing links explicit.
+# - Warning on no longer existing files added.
+# - Warning on files changed after package installation added.
+# - Intermediate file preserve (-keep) added.
+# - Check for required files/links now done on a combined list.
+# - Write access to /var/log/{packages,scripts} no longer necessary for -warn.
+#
+# Revision 1.3 1997/06/08 13:03:05 franke
+# Merged with revision 1.1.1.1
+#
+# Revision 1.2 1996/06/01 20:04:26 franke
+# Delete empty directories & formated manual pages added
+#
+# Revision 1.1.1.1 1995/12/18 21:20:42 volkerding
+# Original Version from Slackware 3.1
+#
+# Revision 1.1 1995/06/05 22:49:11 volkerding
+# Original Version from Slackware 3.0
+#
+
+# 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):
+pkgbase() {
+ # basename + strip extensions .tbz, .tgz, .tlz and .txz
+ echo "$1" | sed 's?.*/??;s/\.t[bglx]z$//'
+}
+
+# This makes "sort" run much faster:
+export LC_ALL=C
+
+# Set the prefix for the package database directories (packages, scripts).
+ADM_DIR="$ROOT/var/lib/pkgtools"
+
+# Set the prefix for the removed packages/scripts log files:
+LOG_DIR="$ROOT/var/log/pkgtools"
+
+# Make sure there's a proper temp directory:
+TMP=$ADM_DIR/setup/tmp
+# If the $TMP directory doesn't exist, create it:
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+ chmod 700 $TMP # no need to leave it open
+fi
+PRES_DIR=$TMP/preserved_packages
+
+# Lock directory for ldconfig... share it with installpkg so that upgradepkg
+# becomes properly ldconfig-locked, too.
+INSTLOCKDIR=${INSTLOCKDIR:-/run/lock/pkgtools}
+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:
+#cat_except() {
+# ( cd "$1" && cat $(ls * | sed "/^$2\$/d"))
+#}
+
+# This version of cat_except() allows the last package to be
+# removed when ROOT= is used:
+cat_except() {
+ ( cd "$1" && \
+ 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
+ )
+}
+
+extract_links() {
+ sed -n 's,^[ ]*( [ ]*cd[ ]* \(.*\) [ ]*; [ ]*rm [ ]*-rf[ ]* \(.*\) [ ]*)[ ]*$,\1/\2,p'
+}
+
+preserve_file() {
+ if [ "$PRESERVE" = "true" ]; then
+ F="$(basename "$1")"
+ D="$(dirname "$1")"
+ if [ ! -d "$PRES_DIR/$PKGNAME/$D" ]; then
+ mkdir -p "$PRES_DIR/$PKGNAME/$D" || return 1
+ fi
+ cp -p "$ROOT/$D/$F" "$PRES_DIR/$PKGNAME/$D" || return 1
+ fi
+ return 0
+}
+
+preserve_dir() {
+ if [ "$PRESERVE" = "true" ]; then
+ if [ ! -d "$PRES_DIR/$PKGNAME/$1" ]; then
+ mkdir -p "$PRES_DIR/$PKGNAME/$1" || return 1
+ fi
+ fi
+ return 0
+}
+
+keep_files() {
+ while read FILE ; do
+ if [ ! -d "$ROOT/$FILE" ]; then
+ if [ -r "$ROOT/$FILE" ]; then
+ ! [ $TERSE ] && echo " --> $ROOT/$FILE was found in another package. Skipping."
+ preserve_file "$FILE"
+ else
+ if [ "$(echo $FILE | cut -b1-8)" != "install/" ]; then
+ ! [ $TERSE ] && echo "WARNING: Nonexistent $ROOT/$FILE was found in another package. Skipping."
+ fi
+ fi
+ else
+ preserve_dir "$FILE"
+ fi
+ done
+}
+
+keep_links() {
+ while read LINK ; do
+ if [ -L "$ROOT/$LINK" ]; then
+ ! [ $TERSE ] && echo " --> $ROOT/$LINK (symlink) was found in another package. Skipping."
+ else
+ ! [ $TERSE ] && echo "WARNING: Nonexistent $ROOT/$LINK (symlink) was found in another package. Skipping."
+ fi
+ done
+}
+
+delete_files() {
+ 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
+ ! [ $TERSE ] && echo "WARNING: $ROOT/$FILE changed after package installation."
+ fi
+ if [ ! "$WARN" = "true" ]; then
+ ! [ $TERSE ] && echo " --> Deleting $ROOT/$FILE"
+ preserve_file "$FILE" && rm -f "$ROOT/$FILE"
+ else
+ ! [ $TERSE ] && echo " --> $ROOT/$FILE would be deleted"
+ preserve_file "$FILE"
+ fi
+ else
+ ! [ $TERSE ] && echo " --> $ROOT/$FILE no longer exists. Skipping."
+ fi
+ else
+ preserve_dir "$FILE"
+ fi
+ done
+}
+
+delete_links() {
+ while read LINK ; do
+ if [ -L "$ROOT/$LINK" ]; then
+ if [ ! "$WARN" = "true" ]; then
+ ! [ $TERSE ] && echo " --> Deleting symlink $ROOT/$LINK"
+ rm -f "$ROOT/$LINK"
+ else
+ ! [ $TERSE ] && echo " --> $ROOT/$LINK (symlink) would be deleted"
+ fi
+ else
+ ! [ $TERSE ] && echo " --> $ROOT/$LINK (symlink) no longer exists. Skipping."
+ fi
+ done
+}
+
+delete_dirs() {
+ sort -r | \
+ while read DIR ; do
+ if [ -d "$ROOT/$DIR" ]; then
+ if [ ! "$WARN" = "true" ]; then
+ if [ $(ls -a "$ROOT/$DIR" | wc -l) -eq 2 ]; then
+ ! [ $TERSE ] && echo " --> Deleting empty directory $ROOT/$DIR"
+ rmdir "$ROOT/$DIR"
+ else
+ ! [ $TERSE ] && echo "WARNING: Unique directory $ROOT/$DIR contains new files"
+ fi
+ else
+ ! [ $TERSE ] && echo " --> $ROOT/$DIR (dir) would be deleted if empty"
+ fi
+ fi
+ done
+}
+
+delete_cats() {
+ sed -n 's,/man\(./[^/]*$\),/cat\1,p' | \
+ while read FILE ; do
+ if [ -f "$ROOT/$FILE" ]; then
+ if [ ! "$WARN" = "true" ]; then
+ ! [ $TERSE ] && echo " --> Deleting $ROOT/$FILE (fmt man page)"
+ rm -f $ROOT/$FILE
+ else
+ ! [ $TERSE ] && echo " --> $ROOT/$FILE (fmt man page) would be deleted"
+ fi
+ fi
+ done
+}
+
+# Conversion to 'comm' utility by Mark Wisdom.
+# is pretty nifty! :^)
+remove_packages() {
+ for PKGLIST in $*
+ do
+ PKGNAME=$(pkgbase $PKGLIST)
+ # 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,
+ # there should only be one package installed with a given basename, but
+ # we don't enforce this policy. If there's more than one, only one will
+ # 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 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: $(basename $ADM_DIR/packages/$PKGNAME)"
+ fi
+ if fgrep "./" $ADM_DIR/packages/$PKGNAME 1> /dev/null 2>&1; then
+ TRIGGER="^\.\/"
+ else
+ TRIGGER="FILE LIST:"
+ fi
+ if [ ! "$WARN" = true ]; then
+ ! [ $TERSE ] && echo "Removing files:"
+ fi
+ sed -n "/$TRIGGER/,/^$/p" < $ADM_DIR/packages/$PKGNAME | \
+ fgrep -v "FILE LIST:" | sort -u > $TMP/delete_list$$
+ # Pat's new-new && improved pre-removal routine.
+ cat_except $ADM_DIR/packages $PKGNAME | sort -u > $TMP/required_list$$
+ if [ -r $ADM_DIR/scripts/$PKGNAME ]; then
+ extract_links < $ADM_DIR/scripts/$PKGNAME | sort -u > $TMP/del_link_list$$
+ cat_except $ADM_DIR/scripts $PKGNAME | 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$$
+ 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/* 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$$
+ fi
+ comm -12 $TMP/delete_list$$ $TMP/required_list$$ | keep_files
+ comm -23 $TMP/delete_list$$ $TMP/required_list$$ > $TMP/uniq_list$$
+ delete_files < $TMP/uniq_list$$
+ delete_dirs < $TMP/uniq_list$$
+ delete_cats < $TMP/uniq_list$$
+ if [ ! "$KEEP" = "true" ]; then
+ rm -f $TMP/delete_list$$ $TMP/required_files$$ $TMP/uniq_list$$
+ rm -f $TMP/del_link_list$$ $TMP/required_links$$ $TMP/required_list$$
+ fi
+ if [ "$PRESERVE" = "true" ]; then
+ if [ -r $ADM_DIR/scripts/$PKGNAME ]; then
+ if [ ! -d "$PRES_DIR/$PKGNAME/install" ]; then
+ mkdir -p "$PRES_DIR/$PKGNAME/install"
+ fi
+ cp -p $ADM_DIR/scripts/$PKGNAME $PRES_DIR/$PKGNAME/install/doinst.sh
+ fi
+ fi
+ if [ ! "$WARN" = "true" ]; then
+ # We won't assume that anything in /var/log can be trusted to remain there,
+ # so we'll remake the directories and symlinks first:
+ mkdir -p $LOG_DIR/removed_packages $LOG_DIR/removed_scripts
+ for symlink in removed_packages removed_scripts ; do
+ if [ ! -L $LOG_DIR/../$symlink ]; then
+ rm -rf $LOG_DIR/../$symlink
+ ( cd $LOG_DIR/.. ; ln -sf pkgtools/$symlink . )
+ fi
+ done
+ # Now that we know we have log directories, move the files:
+ mv $ADM_DIR/packages/$PKGNAME $LOG_DIR/removed_packages
+ if [ -r $ADM_DIR/scripts/$PKGNAME ]; then
+ mv $ADM_DIR/scripts/$PKGNAME $LOG_DIR/removed_scripts
+ fi
+ fi
+ else
+ 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] [--terse] [--warn] packagename ..."; exit 1
+fi
+
+while : ; do
+ case "$1" in
+ -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
+ esac
+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."
+ fi
+ echo "Here's what would be removed (and left behind) if you"
+ echo "removed the package(s):"
+ echo
+else
+ if [ "$PRESERVE" = "true" ]; then
+ echo "Package contents is copied to $PRES_DIR."
+ fi
+fi
+
+remove_packages $*
diff --git a/testing/source/pkgtools/scripts/setup.70.install-kernel b/testing/source/pkgtools/scripts/setup.70.install-kernel
new file mode 100644
index 00000000..8edf6477
--- /dev/null
+++ b/testing/source/pkgtools/scripts/setup.70.install-kernel
@@ -0,0 +1,5 @@
+# Install the bootdisk or CD-ROM's Linux kernel:
+#BLURB="Install a Linux kernel from a bootdisk"
+if [ -x /usr/lib/setup/SeTkernel ]; then
+ . /usr/lib/setup/SeTkernel
+fi
diff --git a/testing/source/pkgtools/scripts/setup.80.make-bootdisk b/testing/source/pkgtools/scripts/setup.80.make-bootdisk
new file mode 100644
index 00000000..0ed8b9a1
--- /dev/null
+++ b/testing/source/pkgtools/scripts/setup.80.make-bootdisk
@@ -0,0 +1,267 @@
+#!/bin/sh
+#BLURB="Create a USB Linux boot stick"
+if [ -r /usr/lib/setup/setup ]; then
+ RDIR=/dev/tty4
+else
+ RDIR=/dev/null
+fi
+TMP=/var/lib/pkgtools/setup/tmp
+
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+fi
+if [ -z "$1" ]; then
+ T_PX=/
+else
+ T_PX="$1"
+fi
+if [ -z "$2" ]; then
+ ROOT_DEVICE=$(mount | head -n 1 | cut -f 1 -d ' ')
+else
+ ROOT_DEVICE="$2"
+fi
+
+if [ -r $T_PX/usr/share/syslinux/mbr.bin ]; then
+ MBR_BIN=$T_PX/usr/share/syslinux/mbr.bin
+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
+ exit
+fi
+
+while [ 0 ]; do # the bootdisk menu loop
+ # Run "rescan-scsi-bus -l" to get an up to date overview of devices:
+ /sbin/rescan-scsi-bus -l 1>$RDIR 2>$RDIR
+ # Get a list of removable block devices before the USB stick is inserted:
+ echo "" > $TMP/remov_prior
+ for BDEV in $(ls --indicator-style none /sys/block | egrep -v "loop|ram"); do
+ [ -r /sys/block/$BDEV/removable -a "$(cat /sys/block/$BDEV/removable)" == "1" ] \
+ && echo $BDEV >> $TMP/remov_prior
+ done
+ if [ "$T_PX" = "/" ]; then
+ DEFAULTITEM="Create"
+ else
+ DEFAULTITEM="Skip"
+ 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 \
+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\
+\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" \
+ 2> $TMP/return
+ REPLY=`cat $TMP/return`
+ rm -f $TMP/return
+ if [ "$REPLY" = "Create" ]; then
+ # Run "rescan-scsi-bus -l" to discover our USB stick if needed:
+ /sbin/rescan-scsi-bus -l 1>$RDIR 2>$RDIR
+ # Get a list of removable block devices after the USB stick is inserted:
+ echo "" > $TMP/remov_after
+ for BDEV in $(ls --indicator-style none /sys/block | egrep -v "loop|ram"); do
+ [ -r /sys/block/$BDEV/removable -a "$(cat /sys/block/$BDEV/removable)" == "1" ] \
+ && echo $BDEV >> $TMP/remov_after
+ done
+ ADDED=$(diff -u $TMP/remov_prior $TMP/remov_after | sed -n 's/^\+//p' | grep -v '^+')
+ REMVD=$(diff -u $TMP/remov_prior $TMP/remov_after | sed -n 's/^\+//p' | grep -v '^+')
+ if [ -n "$ADDED" ] ; then STICK=$ADDED ; else STICK="" ; fi
+ rm $TMP/remov_prior $TMP/remov_after
+ if [ ! -n "$STICK" ]; then
+ dialog --title "NO NEW DEVICE DETECTED" --ok-label Restart --msgbox \
+"No new USB device was detected.
+If you had already inserted your USB stick, please remove it now. \
+Then select 'Restart'." 7 70
+ continue
+ else
+ VENDOR="Vendor : $(cat /sys/block/$STICK/device/vendor)"
+ MODEL="Model : $(cat /sys/block/$STICK/device/model)"
+ SIZE="Size : $(( $(cat /sys/block/$STICK/size) / 2048)) MB"
+ dialog --title "NEW DEVICE DETECTED" --yesno \
+"A new USB device '/dev/$STICK' was detected with specifications:
+
+-- $VENDOR
+-- $MODEL
+-- $SIZE
+
+If this is the USB stick to use, select 'Yes',
+otherwise select 'No'." 12 70
+ if [ $? -eq 1 ]; then
+ continue
+ fi
+ fi
+
+ 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).
+ 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
+ echo "PARTSIZE=$PARTSIZE" 1> $RDIR
+ fdisk /dev/$STICK << EOF 1> $RDIR 2> $RDIR
+n
+p
+1
+2048
+$PARTSIZE
+t 1
+6
+a
+w
+EOF
+ if [ -x /sbin/mkdosfs ]; then
+ /sbin/mkdosfs -I -n USBSLACK -F 16 /dev/${STICK}1 1> $RDIR 2> $RDIR
+ else
+ chroot $T_PX /sbin/mkdosfs -I -n USBSLACK -F 16 /dev/${STICK}1 1> $RDIR 2> $RDIR
+ fi
+ sync
+ # install syslinux
+ if which syslinux-nomtools 1> $RDIR 2> $RDIR ; then
+ syslinux-nomtools -i -s /dev/${STICK}1 1> $RDIR 2> $RDIR
+ elif which strace 1> $RDIR 2> $RDIR ; then
+ # There is a race condition between udev >= 214 and mtools which causes
+ # the regular version of syslinux to fail when installing to USB, but
+ # strace changes the timing just enough that it usually works:
+ strace syslinux -i -s /dev/${STICK}1 1> $RDIR 2> $RDIR
+ else
+ # This might work when the issues with mtools and udev are addressed,
+ # or if syslinux is eventually able to work around them.
+ syslinux -i -s /dev/${STICK}1 1> $RDIR 2> $RDIR
+ fi
+ # make the device bootable:
+ echo "dd if=$MBR_BIN of=/dev/$STICK" 1> $RDIR 2> $RDIR
+ dd if=$MBR_BIN of=/dev/$STICK 1> $RDIR 2> $RDIR
+ sync
+ # mount the device and write some configuration files
+ if [ ! -d $TMP/bootdisk ]; then
+ mkdir $TMP/bootdisk 2> $RDIR
+ fi
+ mount -t vfat /dev/${STICK}1 $TMP/bootdisk 1> $RDIR 2> $RDIR
+ if [ -r $T_PX/boot/vmlinuz ]; then
+ cp $T_PX/boot/vmlinuz $TMP/bootdisk/vmlinuz 1> $RDIR 2> $RDIR
+ elif [ -r $T_PX/vmlinuz ]; then
+ cp $T_PX/vmlinuz $TMP/bootdisk/vmlinuz 1> $RDIR 2> $RDIR
+ fi
+ cat << EOF > $TMP/bootdisk/message.txt 2> $RDIR
+
+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
+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
+kernel parameters you might need depending on your hardware, and which
+drivers are included in your kernel.
+
+EOF
+ cat << EOF > $TMP/bootdisk/syslinux.cfg 2> $RDIR
+default vmlinuz root=$ROOT_DEVICE vga=normal ro
+prompt 1
+timeout 6000
+display message.txt
+F1 f1.txt
+F2 message.txt
+#F3 f3.txt
+#F4 f4.txt
+#F5 f5.txt
+#F6 f6.txt
+#F7 f7.txt
+label mount
+ kernel vmlinuz
+ append root=$ROOT_DEVICE vga=normal ro
+EOF
+ cat << EOF > $TMP/bootdisk/f1.txt 2> $RDIR
+ STANDARD MODES:
+ To make the kernel prompt for standard video modes use: vga=ask
+
+ 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:
+
+ Colors 640x480 800x600 1024x768 1280x1024 1600x1200
+ --------+---------------------------------------------
+ 256 | 769 771 773 775 796
+ 32,768 | 784 787 790 793 797
+ 65,536 | 785 788 791 794 798
+ 16.8M | 786 789 792 795 799
+
+ ...such as this for 1024x768x64k:
+ vga=791
+
+ F2 returns to the previous page.
+
+EOF
+ if [ "$(uname -m)" == "x86_64" ]; then # also install an EFI bootloader
+ mkdir -p $TMP/bootdisk/EFI/BOOT 1> $RDIR 2> $RDIR
+ cp $T_PX/boot/elilo-x86_64.efi $TMP/bootdisk/EFI/BOOT/BOOTX64.EFI 1> $RDIR 2> $RDIR
+ cat << EOF > $TMP/bootdisk/EFI/BOOT/message.txt 2> $RDIR
+
+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
+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
+kernel parameters you might need depending on your hardware, and which
+drivers are included in your kernel.
+
+Hit ENTER to boot:
+
+EOF
+ cat << EOF > $TMP/bootdisk/EFI/BOOT/elilo.conf 2> $RDIR
+chooser=simple
+message=message.txt
+delay=300
+timeout=300
+#
+image=/vmlinuz
+ label=huge.s
+ read-only
+ append="root=$ROOT_DEVICE vga=normal ro"
+EOF
+ fi # end EFI installation
+ sync
+ umount /dev/${STICK}1
+ rm -r $TMP/bootdisk
+ # Sometimes the nomtools version of syslinux will leave the volume mounted,
+ # so umount again:
+ umount /dev/${STICK}1 2> $RDIR
+ if [ "$T_PX" = "/" ]; then
+ dialog --title "USB BOOT STICK CREATED" --msgbox \
+ "The USB boot stick has been successfully created on device /dev/$STICK." 6 60
+ 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 \
+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)" \
+ "Create" "Make a spare Linux boot stick in /dev/$STICK" \
+ 2> $TMP/return
+ REPLY=`cat $TMP/return`
+ rm -f $TMP/return
+ if [ "$REPLY" = "Create" ]; then
+ continue
+ else
+ break
+ fi
+ else # ! Create
+ break
+ fi
+done
diff --git a/testing/source/pkgtools/scripts/setup.htmlview b/testing/source/pkgtools/scripts/setup.htmlview
new file mode 100644
index 00000000..98039100
--- /dev/null
+++ b/testing/source/pkgtools/scripts/setup.htmlview
@@ -0,0 +1,33 @@
+#!/bin/sh
+#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,
+# this is not a Linux standard that could be locating
+# 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. ;-)
+
+# 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
+# the initial installation?
+
+for browser in firefox seamonkey konqueror galeon epiphany links lynx ; do
+ if [ ! -e usr/bin/htmlview -a -x usr/bin/$browser ]; then
+ cat << EOF > usr/bin/htmlview
+#!/bin/sh
+exec $browser "\$@"
+EOF
+ fi
+done
+if [ -e usr/bin/htmlview ]; then
+ chmod 755 usr/bin/htmlview
+fi
+
diff --git a/testing/source/pkgtools/scripts/setup.services b/testing/source/pkgtools/scripts/setup.services
new file mode 100644
index 00000000..2e83cb93
--- /dev/null
+++ b/testing/source/pkgtools/scripts/setup.services
@@ -0,0 +1,342 @@
+#!/bin/sh
+#BLURB="Select/deselect system daemons (services)"
+TMP=/var/lib/pkgtools/setup/tmp
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+fi
+T_PX="$1"
+cd $T_PX
+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 \\
+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. \\
+Press the ENTER key when you are finished." \\
+20 75 7 \\
+EOF
+
+if [ -r etc/rc.d/rc.atalk ]; then
+ if [ -x etc/rc.d/rc.atalk ]; then
+ RC_ATALK=on
+ else
+ RC_ATALK=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.atalk" "Netatalk Appletalk file/print server" $RC_ATALK "The Netatalk server is a file and print server for Macintosh networks." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.atd ]; then
+ if [ -x etc/rc.d/rc.atd ]; then
+ RC_ATD=on
+ else
+ RC_ATD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.atd" "Schedules jobs for later" $RC_ATD "The at daemon schedules jobs to be run at a specified time." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.bind ]; then
+ if [ -x etc/rc.d/rc.bind ]; then
+ RC_BIND=on
+ else
+ RC_BIND=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.bind" "BIND (Domain Name System) server" $RC_BIND "BIND (Berkeley Internet Name Domain) is a Domain Name System (DNS) server." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.crond ]; then
+ if [ -x etc/rc.d/rc.crond ]; then
+ RC_CROND=on
+ else
+ RC_CROND=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.crond" "Time based job scheduler" $RC_CROND "The cron daemon schedules jobs to run at fixed times, dates, or intervals." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.cups ]; then
+ if [ -x etc/rc.d/rc.cups ]; then
+ RC_CUPS=on
+ else
+ RC_CUPS=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.cups" "CUPS print server" $RC_CUPS "The Common UNIX Printing system (print spooler choice #1)." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.dnsmasq ]; then
+ if [ -x etc/rc.d/rc.dnsmasq ]; then
+ RC_DNSMASQ=on
+ else
+ RC_DNSMASQ=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.dnsmasq" "dnsmasq DHCP/DNS server" $RC_DNSMASQ "dnsmasq provides DNS and DHCP service to a LAN." \\
+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
+ else
+ RC_FUSE=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.fuse" "Filesystem in Userspace library" $RC_FUSE "FUSE is an interface to allow userspace programs to use filesystems." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.hald ]; then
+ if [ -x etc/rc.d/rc.hald ]; then
+ RC_HALD=on
+ else
+ RC_HALD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.hald" "Hardware Abstraction Layer" $RC_HALD "HAL makes access to CD/DVD drives and USB devices easier." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.hplip ]; then
+ if [ -x etc/rc.d/rc.hplip ]; then
+ RC_HPLIP=on
+ else
+ RC_HPLIP=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.hplip" "HP printer/scanner daemons" $RC_HPLIP "Programs used to run printers and scanners from Hewlett Packard." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.httpd ]; then
+ if [ -x etc/rc.d/rc.httpd ]; then
+ RC_HTTPD=on
+ else
+ RC_HTTPD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.httpd" "The Apache web server" $RC_HTTPD "Apache, the most widely used web server on the net." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.inetd ]; then
+ if [ -x etc/rc.d/rc.inetd ]; then
+ RC_INETD=on
+ else
+ RC_INETD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.inetd" "The BSD Inetd daemon" $RC_INETD "Inetd daemon (this allows: time, ftp, comsat, talk, finger, and auth)." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.ip_forward ]; then
+ if [ -x etc/rc.d/rc.ip_forward ]; then
+ RC_IP_FORWARD=on
+ else
+ RC_IP_FORWARD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.ip_forward" "Activate IP packet forwarding" $RC_IP_FORWARD "Packet forwarding allows your Linux machine to act as a router." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.lprng ]; then
+ if [ -x etc/rc.d/rc.lprng ]; then
+ RC_LPRNG=on
+ else
+ RC_LPRNG=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.lprng" "LPRng print server" $RC_LPRNG "The LPRng printing system (print spooler choice #2)." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.messagebus ]; then
+ if [ -x etc/rc.d/rc.messagebus ]; then
+ RC_MESSAGEBUS=on
+ else
+ RC_MESSAGEBUS=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.messagebus" "D-Bus system message bus" $RC_MESSAGEBUS "Used for interprocess communication and coordination." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.mysqld ]; then
+ if [ -x etc/rc.d/rc.mysqld ]; then
+ RC_MYSQLD=on
+ else
+ RC_MYSQLD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.mysqld" "The MySQL database server" $RC_MYSQLD "MySQL, an SQL-based relational database daemon." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.ntpd ]; then
+ if [ -x etc/rc.d/rc.ntpd ]; then
+ RC_NTPD=on
+ else
+ RC_NTPD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.ntpd" "The network time server" $RC_NTPD "NTP synchronizes your time to/from other NTP servers." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.pcmcia ]; then
+ if [ -x etc/rc.d/rc.pcmcia ]; then
+ RC_PCMCIA=on
+ else
+ RC_PCMCIA=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.pcmcia" "PCMCIA/Cardbus card services" $RC_PCMCIA "This supports PCMCIA or Cardbus cards used with laptops." \\
+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
+ else
+ RC_RPC=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.rpc" "RPC (NFS) daemons" $RC_RPC "Needed to serve or mount NFS (Network File System) partitions." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.samba ]; then
+ if [ -x etc/rc.d/rc.samba ]; then
+ RC_SAMBA=on
+ else
+ RC_SAMBA=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.samba" "The Samba file/print server" $RC_SAMBA "Samba is a file and print server for Windows networks." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.saslauthd ]; then
+ if [ -x etc/rc.d/rc.saslauthd ]; then
+ RC_SASLAUTHD=on
+ else
+ RC_SASLAUTHD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.saslauthd" "The SASL authentication server" $RC_SASLAUTHD "SASL is an authentication method often used by mail servers." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.sendmail ]; then
+ if [ -x etc/rc.d/rc.sendmail ]; then
+ RC_SENDMAIL=on
+ else
+ RC_SENDMAIL=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.sendmail" "The Sendmail mail server" $RC_SENDMAIL "The Sendmail server allows your machine to send and receive mail." \\
+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
+ else
+ RC_SNMPD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.snmpd" "Net-SNMP daemon" $RC_SNMPD "SNMP daemon that receives and logs SNMP TRAP and INFORM messages." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.syslog ]; then
+ if [ -x etc/rc.d/rc.syslog ]; then
+ RC_SYSLOGD=on
+ else
+ RC_SYSLOGD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.syslog" "The Linux system logging utilities" $RC_SYSLOGD "The syslogd and klogd daemons log important messages under /var/log." \\
+EOF
+fi
+
+if [ -r etc/rc.d/rc.sshd ]; then
+ if [ -x etc/rc.d/rc.sshd ]; then
+ RC_SSHD=on
+ else
+ RC_SSHD=off
+ fi
+ cat << EOF >> $TMP/tmpscript
+ "rc.sshd" "The SSHD (secure shell) daemon" $RC_SSHD "SSHD allows secure encrypted logins to your machine." \\
+EOF
+fi
+
+cat << EOF >> $TMP/tmpscript
+ 2> $TMP/reply
+EOF
+
+. $TMP/tmpscript
+
+if [ ! $? = 0 ]; then
+ rm -f $TMP/reply $TMP/tmpscript
+ exit
+fi
+
+for service in rc.atalk rc.atd rc.bind rc.crond 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
+ else
+ chmod 644 etc/rc.d/$service
+ fi
+ fi
+done
+
+rm -f $TMP/reply $TMP/tmpscript
+
diff --git a/testing/source/pkgtools/scripts/upgradepkg b/testing/source/pkgtools/scripts/upgradepkg
new file mode 100644
index 00000000..f53d21d9
--- /dev/null
+++ b/testing/source/pkgtools/scripts/upgradepkg
@@ -0,0 +1,417 @@
+#!/bin/bash
+# Copyright 1999 Patrick Volkerding, Moorhead, Minnesota, USA
+# Copyright 2001, 2002, 2003 Slackware Linux, Inc., Concord, California, USA
+# Copyright 2009, 2015 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2015 Michal Nazarewicz <mina86@mina86.com>
+# 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.
+#
+# Mon Jun 4 21:17:58 UTC 2018
+# Use /var/lib/pkgtools, not /var/log.
+#
+# Thu May 24 20:23:55 UTC 2018
+# Added --terselength option to set the line length in --terse mode.
+# Use a lockfile to prevent output collisions in --terse mode.
+#
+# Wed May 23 03:35:28 UTC 2018
+# Added --terse, which limits screen output to one line per package.
+#
+# 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.
+#
+# 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):
+pkgbase() {
+ PKGRETURN=${1##*/}
+ case "$PKGRETURN" in *.t[gblx]z)
+ PKGRETURN=${PKGRETURN%.*}
+ esac
+ echo "$PKGRETURN"
+}
+
+usage() {
+ cat << EOF
+
+Usage: upgradepkg [options] <newpackage> ...
+ upgradepkg [options] <oldpackage%newpackage> ...
+
+Upgrade, install, or reinstall Slackware packages (.tgz, .tbz, .tlz, .txz).
+
+To operate on an alternate directory, such as /mnt:
+ ROOT=/mnt upgradepkg package.txz
+
+Options:
+ --dry-run only display what would be done
+ --install-new install new packages also
+ --reinstall upgrade packages of the same version
+ --terse display a single line for each package operation
+ --terselength <length> maximum line length of terse output
+ --verbose display all the gory details of the upgrade
+ --help display this help
+
+For more details see upgradepkg(8).
+EOF
+}
+
+# Set the prefix for the package database directories (packages, scripts).
+ADM_DIR="$ROOT/var/lib/pkgtools"
+
+# Make sure there's a proper temp directory:
+TMP=$ADM_DIR/setup/tmp
+# If the $TMP directory doesn't exist, create it:
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+ chmod 700 $TMP # no need to leave it open
+fi
+
+# This script expects an 022 umask:
+umask 022
+
+# $ROOT defined?
+if [ -d "$ROOT" ]; then
+ export ROOT
+else
+ unset ROOT
+fi
+
+# --help or no args?
+if [ "$1" = "" -o "$1" = "-help" -o "$1" = "--help" -o "$1" = "-?" ]; then
+ usage;
+ exit 1;
+fi
+
+# Create a lockfile directory if it doesn't exist. We can use it to prevent
+# output line collisions in --terse mode.
+INSTLOCKDIR=${INSTLOCKDIR:-/run/lock/pkgtools}
+if [ ! -d $INSTLOCKDIR ]; then
+ mkdir -p $INSTLOCKDIR
+fi
+
+# Set default line length for terse mode:
+if tty -s && 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" -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.
+ # Don't use it.
+ NOT_PARANOID="true"
+ shift 1
+ 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" -o "$1" = "--reinstall" ]; then
+ # Reinstall packages even if the installed one is the same version.
+ REINSTALL="true"
+ shift 1
+ 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" -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
+# old package.
+
+package_name() {
+ STRING=$(pkgbase "$1")
+ case "$STRING" in
+ *-*-*-*)
+ # At least four segments, strip version arch and build and return name:
+ echo "${STRING%-*-*-*}"
+ # cruft for later ;)
+ # BUILD=${STRING##*-}
+ # STRING=${STRING%*-}
+ # ARCH=${STRING##*-}
+ # STRING=${STRING%*-}
+ # VER=${STRING%*-}
+ ;;
+ *)
+ # Old style package name with one segment or we don't have four
+ # segments: return the old-style (or out of spec) package name.
+ echo $STRING
+ esac
+}
+
+ERRCODE=0
+
+# Main processing loop:
+for ARG; do
+ OLD=${ARG%'%'*} # first segment, = $ARG if no %
+ NEW=${ARG#*'%'} # second segment, = $ARG if no %
+
+ # Simple package integrity check:
+ if ! [ -f "$NEW" ]; then
+ ERRCODE=4
+ echo "Cannot install $NEW: file not found"
+ continue;
+ fi
+
+ # Figure out the names of the old and new packages:
+ INCOMINGDIR=$(dirname $NEW)
+ # These are the package names with the extension:
+ NNAME=${NEW##*/}
+ ONAME=${OLD##*/}
+ # These are the package names without the extension:
+ OLD=$(pkgbase $OLD)
+ NEW=$(pkgbase $NEW)
+
+ # 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"
+ continue;
+ fi
+
+ # Check and fix the old package name:
+ SHORT="$(package_name $OLD)"
+ if [ ! -r $ADM_DIR/packages/$OLD ]; then
+ if ls $ADM_DIR/packages/$SHORT* 1> /dev/null 2> /dev/null ; then
+ for installed_package in $ADM_DIR/packages/$SHORT* ; do
+ if [ "$(package_name $installed_package)" = "$SHORT" ]; then # found one
+ OLD="${installed_package##*/}"
+ break
+ fi
+ done
+ fi
+ 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:
+
+ if [ ! -r $ADM_DIR/packages/$OLD ]; then
+ if [ ! "$INSTALL_NEW" = "yes" ]; then
+ if [ "$DRY_RUN" = "true" ]; then
+ echo "$OLD would not be upgraded (no installed package named $SHORT)."
+ else
+ ! [ $TERSE ] && echo
+ echo "Error: there is no installed package named $OLD."
+ ! [ $TERSE ] && echo " (looking for $ADM_DIR/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
+ 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
+ fi
+ fi
+ fi
+ continue;
+ elif [ ! -r "$INCOMINGDIR/$NNAME" ]; then
+ if [ "$DRY_RUN" = "true" ]; then
+ echo "$NEW incoming package not found (command line)."
+ else
+ ! [ $TERSE ] && echo
+ echo "Error: incoming package $INCOMINGDIR/$NNAME not found."
+ ! [ $TERSE ] && echo
+ fi
+ ERRCODE=1
+ continue;
+ fi
+
+ # Unless --reinstall was given, compare the package names
+ # and skip any exact matches:
+ if [ ! "$REINSTALL" = "true" ]; then
+ if [ "$OLD" = "$NEW" ]; then
+ if [ "$DRY_RUN" = "true" ]; then
+ echo "$NEW would be skipped (already installed)."
+ else
+ if ! [ $TERSE ]; then
+ cat << EOF
+
++==============================================================================
+| Skipping package $NEW (already installed)
++==============================================================================
+
+EOF
+ fi
+ fi
+ continue;
+ fi
+ fi
+
+ # Showtime. Let's do the upgrade. First, we will rename all the
+ # installed packages with this basename to make them easy to remove later:
+
+ TIMESTAMP=$(date +%Y-%m-%d,%T)
+ SHORT="$(package_name $OLD)"
+ if [ "$DRY_RUN" = "true" ]; then
+ echo -n "$NEW would upgrade: "
+ for installed_package in $ADM_DIR/packages/$SHORT* ; do
+ if [ "$(package_name $installed_package)" = "$SHORT" ]; then
+ echo -n "$(pkgbase $installed_package)"
+ fi
+ done
+ echo
+ continue
+ fi
+ for installed_package in $ADM_DIR/packages/$SHORT* ; do
+ if [ "$(package_name $installed_package)" = "$SHORT" ]; then
+ mv $installed_package ${installed_package}-upgraded-$TIMESTAMP
+ fi
+ done
+ for installed_script in $ADM_DIR/scripts/$SHORT* ; do
+ if [ "$(package_name $installed_script)" = "$SHORT" ]; then
+ if [ -r $installed_script ]; then
+ mv $installed_script ${installed_script}-upgraded-$TIMESTAMP
+ fi
+ fi
+ done
+
+ # Print a banner for the current upgrade:
+ if ! [ $TERSE ]; then
+ cat << EOF
+
++==============================================================================
+| Upgrading $OLD package using $INCOMINGDIR/$NNAME
++==============================================================================
+EOF
+ fi
+ # Next, the new package is pre-installed:
+ if [ "$VERBOSE" = "verbose" ]; then
+ if ! [ $TERSE ]; then
+ /sbin/installpkg $INCOMINGDIR/$NNAME
+ RETCODE=$?
+ else
+ /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null
+ RETCODE=$?
+ fi
+ else
+ 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 "corrupted."
+ 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? :)
+ ( flock 9 || exit 11
+ for rempkg in "$ADM_DIR/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
+ if ! [ $TERSE ]; then
+ /sbin/installpkg $INCOMINGDIR/$NNAME
+ else
+ /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null
+ fi
+ fi
+ ! [ $TERSE ] && echo "Package $OLD upgraded with new package $INCOMINGDIR/$NNAME."
+ ERRCODE=0
+done
+exit $ERRCODE