summaryrefslogtreecommitdiffstats
path: root/source/a/pkgtools/scripts/pkgtool
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/pkgtools/scripts/pkgtool')
-rw-r--r--source/a/pkgtools/scripts/pkgtool33
1 files changed, 20 insertions, 13 deletions
diff --git a/source/a/pkgtools/scripts/pkgtool b/source/a/pkgtools/scripts/pkgtool
index dd9d6816f..fd77f2980 100644
--- a/source/a/pkgtools/scripts/pkgtool
+++ b/source/a/pkgtools/scripts/pkgtool
@@ -1,10 +1,9 @@
#!/bin/sh
#
-# Copyright 1993, 1994, 1995, 1996, 1997,
-# 1998, 1999 Patrick Volkerding, Moorhead, MN USA
+# 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 Patrick Volkerding, Sebeka, MN, USA
+# Copyright 2007, 2009, 2010, 2011, 2013, 2015 Patrick Volkerding, Sebeka, MN, USA
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
@@ -44,6 +43,15 @@
# Wed Jan 26 23:06:22 GMT 2005
# * Fix for non-standard package descriptions by Jim Hawkins
+# Avoid problems if any files in /var/log/packages and /var/log/scripts
+# might contain any broken UTF-8 sequences. This was once known to cause
+# dialog to crash.
+unset LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
+ LC_IDENTIFICATION LC_ALL
+LANG=C
+export LANG
+
# Return a package name that has been stripped of the dirname portion
# and any of the valid extensions (only):
pkgbase() {
@@ -72,10 +80,9 @@ SOURCE_DIR=/var/log/mount
ASK="tagfiles"
if [ -L /bin/chmod -a -L /bin/chown ]; then # probably on the bootdisk using busybox
TARGET_DIR=/mnt
+ rootdevice="$(mount | grep ' on /mnt ' | tail -n 1 | cut -f 1 -d ' ' 2> /dev/null)"
TMP=/mnt/var/log/setup/tmp
- if mount | grep "on /mnt" 1> /dev/null 2>&1 ; then # good
- true
- else # bad
+ 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"
@@ -95,6 +102,7 @@ if [ -L /bin/chmod -a -L /bin/chown ]; then # probably on the bootdisk using bus
fi
else
TARGET_DIR=/
+ rootdevice="$(mount | grep ' on / ' | tail -n 1 | cut -f 1 -d ' ')"
TMP=/var/log/setup/tmp
fi
if [ ! -d $TMP ]; then
@@ -212,7 +220,7 @@ else # there were no arguments, so we'll get the needed information from the
CMD_START="true"
rm -f $TMP/SeT*
while [ 0 ]; do
- dialog --title "Slackware Package Tool (pkgtool version 14.1)" \
+ dialog --title "Slackware Package Tool (pkgtool version 14.2)" \
--menu "\nWelcome to the Slackware package tool.\n\
\nWhich option would you like?\n" 17 75 7 \
"Current" "Install packages from the current directory" \
@@ -250,8 +258,7 @@ are done selecting to run the scripts." 17 70 9 \' > $TMP/setupscr
# Run each script:
for script in $(cat $TMP/return) ; do
scrpath=$ADM_DIR/setup/setup.$(echo $script | tr -d \")
- rootdevice="$(mount | head -n 1 | cut -f 1 -d ' ')"
- ( COLOR=on ; cd $TARGET_DIR ; . $scrpath / $rootdevice )
+ ( COLOR=on ; cd $TARGET_DIR ; . $scrpath $TARGET_DIR $rootdevice )
done
fi
rm -f $TMP/return $TMP/setupscr
@@ -470,7 +477,7 @@ retry, or quit?" 10 60 2 \
umount_the_source() {
if [ ! "$SOURCE_MOUNTED" = "always" ]; then
- umount $SOURCE_DEVICE 1> /dev/null 2>&1
+ umount $SOURCE_DEVICE 1> /dev/null 2> /dev/null
fi;
}
@@ -570,7 +577,7 @@ install_disk() {
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>&1 ; 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)
@@ -601,7 +608,7 @@ EOF
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>&1 ; then
+ if echo $ALLOWED | grep $BASE 1> /dev/null 2> /dev/null ; then
true
else
cat << EOF > $TMP/tmpmsg
@@ -687,7 +694,7 @@ if [ "$DISK_SETS" = "disk" ]; then
else
touch $TMP/tagfile
chmod 600 $TMP/tagfile
- if echo $DISK_SETS | grep "#a#" 1> /dev/null 2>&1; then
+ if echo $DISK_SETS | grep "#a#" 1> /dev/null 2> /dev/null ; then
A_IS_NEEDED="true"
else
A_IS_NEEDED="false"