-
-
Save ruario/01aca97c793312ade204779c1da67d4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/installpkg | |
+++ b/installpkg | |
@@ -1,4 +1,4 @@ | |
-#!/bin/sh | |
+#!/bin/bash | |
# 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 | |
@@ -94,6 +94,11 @@ | |
# Changed $TMP directory to /var/log/setup/tmp, and chmod'ed it 700 to close | |
# some security holes. | |
+# Added by ruario to avoid full paths when checking for executables | |
+available () { | |
+ command -v "$1" >/dev/null 2>&1 | |
+} | |
+ | |
# Return a package name that has been stripped of the dirname portion | |
# and any of the valid extensions (only): | |
pkgbase() { | |
@@ -478,7 +483,7 @@ | |
# 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)" | |
+ COMPRESSED="$(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 | |
@@ -644,9 +649,9 @@ | |
# 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 | |
+ if [ "$ROOT" = "" ] && available ldconfig; then | |
( flock 9 || exit 11 | |
- /sbin/ldconfig 2> /dev/null | |
+ ldconfig 2> /dev/null | |
) 9> $INSTLOCKDIR/ldconfig.lock | |
fi | |
@@ -659,8 +664,8 @@ | |
# 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 | |
+ if available bash; then | |
+ cd $ROOT/ ; sed -e's?^( cd \([^;]*\);\(.*\) )$?pushd \1 \&\> /dev/null ; \2 ; popd \&\> /dev/null?g ' $INSTDIR/doinst.sh | bash | |
else | |
cd $ROOT/ ; sh $INSTDIR/doinst.sh | |
fi | |
@@ -668,9 +673,9 @@ | |
# 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 | |
+ if available 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 | |
+ cd $ROOT/ ; sed -e's?^( cd \([^;]*\);\(.*\) )$?pushd \1 \&\> /dev/null ; \2 ; popd \&\> /dev/null?g ' $INSTDIR/doinst.sh | bash | |
) 9> $INSTLOCKDIR/doinst.sh.lock | |
else | |
( flock 9 || exit 11 | |
--- a/makepkg | |
+++ b/makepkg | |
@@ -1,4 +1,4 @@ | |
-#!/bin/sh | |
+#!/bin/bash | |
# 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 | |
@@ -436,14 +436,6 @@ | |
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 | |
--- a/removepkg | |
+++ b/removepkg | |
@@ -1,4 +1,4 @@ | |
-#!/bin/sh | |
+#!/bin/bash | |
# Slackware remove package script | |
# | |
# Copyright 1994, 1995, 1998 Patrick Volkerding, Moorhead, Minnesota USA | |
@@ -125,6 +125,11 @@ | |
# Original Version from Slackware 3.0 | |
# | |
+# Added by ruario to avoid full paths when checking for executables | |
+available () { | |
+ command -v "$1" >/dev/null 2>&1 | |
+} | |
+ | |
# Needed to find package names within the 'remove_packages' function: | |
shopt -s extglob | |
@@ -171,8 +176,8 @@ | |
# 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 | |
+ if [ $(find . -maxdepth 1 -type f 2> /dev/null | wc -l) -ne 1 ]; then | |
+ cat $(find . -maxdepth 1 -type f 2> /dev/null | grep -v "$2") 2> /dev/null | |
fi | |
) | |
} | |
@@ -396,9 +401,9 @@ | |
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 | |
+ if [ "$ROOT" = "" ] && available ldconfig; then | |
( flock 9 || exit 11 | |
- /sbin/ldconfig 2> /dev/null | |
+ ldconfig 2> /dev/null | |
) 9> $INSTLOCKDIR/ldconfig.lock | |
fi | |
done | |
--- a/upgradepkg | |
+++ b/upgradepkg | |
@@ -262,11 +262,11 @@ | |
echo "$NEW would be installed (new package)." | |
else | |
if [ $PLAINTERSE ]; then | |
- /sbin/installpkg --terse --terselength $TERSELENGTH $INCOMINGDIR/$NNAME | |
+ installpkg --terse --terselength $TERSELENGTH $INCOMINGDIR/$NNAME | |
elif [ $INFOBOX ]; then | |
- /sbin/installpkg --infobox $INCOMINGDIR/$NNAME | |
+ installpkg --infobox $INCOMINGDIR/$NNAME | |
elif [ $TERSE ]; then | |
- OUTPUTLINE="$(/sbin/installpkg --terse --terselength $(expr $TERSELENGTH - 12) $INCOMINGDIR/$NNAME)" | |
+ OUTPUTLINE="$(installpkg --terse --terselength $(expr $TERSELENGTH - 12) $INCOMINGDIR/$NNAME)" | |
( flock 9 || exit 11 | |
echo "Installing: ${OUTPUTLINE}" | |
) 9> $INSTLOCKDIR/outputline.lock | |
@@ -278,7 +278,7 @@ | |
+============================================================================== | |
EOF | |
- /sbin/installpkg $INCOMINGDIR/$NNAME | |
+ installpkg $INCOMINGDIR/$NNAME | |
fi | |
fi | |
fi | |
@@ -356,26 +356,26 @@ | |
# Next, the new package is pre-installed: | |
if [ "$VERBOSE" = "verbose" ]; then | |
if ! [ $TERSE ]; then | |
- /sbin/installpkg $INCOMINGDIR/$NNAME | |
+ installpkg $INCOMINGDIR/$NNAME | |
RETCODE=$? | |
else | |
- /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null | |
+ installpkg $INCOMINGDIR/$NNAME 1> /dev/null | |
RETCODE=$? | |
fi | |
else | |
if [ $PLAINTERSE ]; then | |
- /sbin/installpkg --terse --terselength $TERSELENGTH $INCOMINGDIR/$NNAME | |
+ installpkg --terse --terselength $TERSELENGTH $INCOMINGDIR/$NNAME | |
elif [ $INFOBOX ]; then | |
- /sbin/installpkg --infobox $INCOMINGDIR/$NNAME | |
+ installpkg --infobox $INCOMINGDIR/$NNAME | |
elif [ $TERSE ]; then | |
- OUTPUTLINE="$(/sbin/installpkg --terse --terselength $(expr $TERSELENGTH - 12) $INCOMINGDIR/$NNAME)" | |
+ OUTPUTLINE="$(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 | |
+ installpkg $INCOMINGDIR/$NNAME 1> /dev/null | |
RETCODE=$? | |
fi | |
fi | |
@@ -393,11 +393,11 @@ | |
( flock 9 || exit 11 | |
for rempkg in "$ADM_DIR/packages/"*"-$TIMESTAMP"; do | |
if [ "$VERBOSE" = "verbose" ]; then | |
- /sbin/removepkg "${rempkg##*/}" | |
+ removepkg "${rempkg##*/}" | |
elif ! [ $TERSE ]; then | |
- /sbin/removepkg "${rempkg##*/}" | grep -v 'Skipping\.\|Removing files:' | |
+ removepkg "${rempkg##*/}" | grep -v 'Skipping\.\|Removing files:' | |
else | |
- /sbin/removepkg "${rempkg##*/}" > /dev/null | |
+ removepkg "${rempkg##*/}" > /dev/null | |
fi | |
done | |
) 9> $INSTLOCKDIR/removepkg.lock | |
@@ -406,9 +406,9 @@ | |
# shift location, so we should always reinstall as the final step: | |
if [ ! "$NOT_PARANOID" = "true" ]; then | |
if ! [ $TERSE ]; then | |
- /sbin/installpkg $INCOMINGDIR/$NNAME | |
+ installpkg $INCOMINGDIR/$NNAME | |
else | |
- /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null | |
+ installpkg $INCOMINGDIR/$NNAME 1> /dev/null | |
fi | |
fi | |
! [ $TERSE ] && echo "Package $OLD upgraded with new package $INCOMINGDIR/$NNAME." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment