summaryrefslogtreecommitdiff
path: root/autoconf/shtool
diff options
context:
space:
mode:
Diffstat (limited to 'autoconf/shtool')
-rwxr-xr-xautoconf/shtool207
1 files changed, 150 insertions, 57 deletions
diff --git a/autoconf/shtool b/autoconf/shtool
index aa354a0..a1f4e7e 100755
--- a/autoconf/shtool
+++ b/autoconf/shtool
@@ -1,12 +1,12 @@
#!/bin/sh
##
## GNU shtool -- The GNU Portable Shell Tool
-## Copyright (c) 1994-2006 Ralf S. Engelschall <rse@engelschall.com>
+## Copyright (c) 1994-2008 Ralf S. Engelschall <rse@engelschall.com>
##
## See http://www.gnu.org/software/shtool/ for more information.
## See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
##
-## Version: 2.0.6 (19-Apr-2006)
+## Version: 2.0.8 (18-Jul-2008)
## Contents: all available modules
##
@@ -23,7 +23,7 @@
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
## USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
##
## NOTICE: Given that you include this file verbatim into your own
@@ -90,8 +90,8 @@ if [ $# -eq 0 ]; then
exit 1
fi
if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
- echo "This is GNU shtool, version 2.0.6 (19-Apr-2006)"
- echo 'Copyright (c) 1994-2006 Ralf S. Engelschall <rse@engelschall.com>'
+ echo "This is GNU shtool, version 2.0.8 (18-Jul-2008)"
+ echo 'Copyright (c) 1994-2008 Ralf S. Engelschall <rse@engelschall.com>'
echo 'Report bugs to <bug-shtool@gnu.org>'
echo ''
echo 'Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]'
@@ -157,7 +157,7 @@ if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
exit 0
fi
if [ ".$1" = ".-v" ] || [ ".$1" = ".--version" ]; then
- echo "GNU shtool 2.0.6 (19-Apr-2006)"
+ echo "GNU shtool 2.0.8 (18-Jul-2008)"
exit 0
fi
if [ ".$1" = ".-r" ] || [ ".$1" = ".--recreate" ]; then
@@ -647,7 +647,7 @@ case $tool in
echo )
##
## echo -- Print string with optional construct expansion
- ## Copyright (c) 1998-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
##
text="$*"
@@ -768,11 +768,14 @@ echo )
userid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
- userid=`(ypcat passwd) 2>/dev/null |
- grep "^${username}:" | \
- sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
+ userid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \
+ sed -e 'q' | sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
- userid='?'
+ userid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \
+ sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
+ if [ ".$userid" = . ]; then
+ userid='?'
+ fi
fi
fi
fi
@@ -797,10 +800,14 @@ echo )
groupid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
- groupid=`(ypcat passwd) 2>/dev/null | grep "^${username}:" | \
- sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+ groupid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \
+ sed -e 'q' | sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
- groupid='?'
+ groupid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \
+ sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+ if [ ".$groupid" = . ]; then
+ groupid='?'
+ fi
fi
fi
fi
@@ -825,11 +832,16 @@ echo )
groupname=`grep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
- groupname=`(ypcat group) 2>/dev/null | \
- grep "^[^:]*:[^:]*:${groupid}:" | \
+ groupname=`(ypcat group; niscat group) 2>/dev/null | \
+ sed -e 'q' | grep "^[^:]*:[^:]*:${groupid}:" | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
- groupname='?'
+ groupname=`(nidump group .) 2>/dev/null | \
+ grep "^[^:]*:[^:]*:${groupid}:" | \
+ sed -e 's/:.*$//'`
+ if [ ".$groupname" = . ]; then
+ groupname='?'
+ fi
fi
fi
fi
@@ -946,7 +958,7 @@ mdate )
##
## mdate -- Pretty-print modification time of a file or dir
## Copyright (c) 1995-1997 Free Software Foundation, Inc.
- ## Copyright (c) 1998-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
##
fod="$1"
@@ -1074,7 +1086,7 @@ mdate )
table )
##
## table -- Pretty-print a field-separated list as a table
- ## Copyright (c) 1998-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
##
if [ $opt_c -gt 4 ]; then
@@ -1139,7 +1151,7 @@ table )
prop )
##
## prop -- Display progress with a running propeller
- ## Copyright (c) 1998-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
##
perl=''
@@ -1185,7 +1197,7 @@ prop )
move )
##
## move -- Move files with simultaneous substitution
- ## Copyright (c) 1999-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
##
src="$1"
@@ -1277,7 +1289,7 @@ move )
install )
##
## install -- Install a program, script or datafile
- ## Copyright (c) 1997-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1997-2008 Ralf S. Engelschall <rse@engelschall.com>
##
# special case: "shtool install -d <dir> [...]" internally
@@ -1363,12 +1375,12 @@ install )
if [ ".$opt_t" = .yes ]; then
echo "cp $src $dsttmp" 1>&2
fi
- cp $src $dsttmp || shtool_exit $?
+ cp "$src" "$dsttmp" || shtool_exit $?
else
if [ ".$opt_t" = .yes ]; then
echo "mv $src $dsttmp" 1>&2
fi
- mv $src $dsttmp || shtool_exit $?
+ mv "$src" "$dsttmp" || shtool_exit $?
fi
# adjust the target file
@@ -1379,7 +1391,7 @@ install )
do
sed="$sed -e '$e'"
done
- cp $dsttmp $dsttmp.old
+ cp "$dsttmp" "$dsttmp.old"
chmod u+w $dsttmp
eval "$sed <$dsttmp.old >$dsttmp" || shtool_exit $?
rm -f $dsttmp.old
@@ -1414,7 +1426,7 @@ install )
quick=no
if [ ".$opt_C" = .yes ]; then
if [ -r $dst ]; then
- if cmp -s $src $dst; then
+ if cmp -s "$src" "$dst"; then
quick=yes
fi
fi
@@ -1440,7 +1452,7 @@ install )
mkdir )
##
## mkdir -- Make one or more directories
- ## Copyright (c) 1996-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1996-2008 Ralf S. Engelschall <rse@engelschall.com>
##
errstatus=0
@@ -1528,11 +1540,11 @@ mkdir )
mkln )
##
## mkln -- Make link with calculation of relative paths
- ## Copyright (c) 1998-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
##
# determine source(s) and destination
- args=$?
+ args=$#
srcs=""
while [ $# -gt 1 ]; do
srcs="$srcs $1"
@@ -1633,12 +1645,17 @@ mkln )
# determine source prefix which is the reverse directory
# step-up corresponding to the destination directory
srcpre=""
-
- isroot=0
- if [ ".$prefix" = . ] || [ ".$prefix" = ./ ]; then
- isroot=1
+ allow_relative_srcpre=no
+ if [ ".$prefix" != . ] && [ ".$prefix" != ./ ]; then
+ allow_relative_srcpre=yes
+ fi
+ if [ $oneisabs = 0 ]; then
+ allow_relative_srcpre=yes
fi
- if [ $oneisabs = 0 ] || [ $isroot = 0 ]; then
+ if [ ".$opt_s" != .yes ]; then
+ allow_relative_srcpre=no
+ fi
+ if [ ".$allow_relative_srcpre" = .yes ]; then
pl="$dstdir/"
OIFS="$IFS"; IFS='/'
for pe in $pl; do
@@ -1679,7 +1696,7 @@ mkln )
mkshadow )
##
## mkshadow -- Make a shadow tree through symbolic links
- ## Copyright (c) 1998-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
##
# source and destination directory
@@ -1797,7 +1814,7 @@ mkshadow )
fixperm )
##
## fixperm -- Fix file permissions inside a source tree
- ## Copyright (c) 1996-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1996-2008 Ralf S. Engelschall <rse@engelschall.com>
##
paths="$*"
@@ -1854,7 +1871,7 @@ fixperm )
rotate )
##
## rotate -- Logfile rotation
- ## Copyright (c) 2001-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 2001-2008 Ralf S. Engelschall <rse@engelschall.com>
##
# make sure we have at least one file to rotate
@@ -2218,7 +2235,7 @@ rotate )
tarball )
##
## tarball -- Roll distribution tarballs
- ## Copyright (c) 1999-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
##
srcs="$*"
@@ -2382,7 +2399,7 @@ tarball )
subst )
##
## subst -- Apply sed(1) substitution operations
- ## Copyright (c) 2001-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 2001-2008 Ralf S. Engelschall <rse@engelschall.com>
##
# remember optional list of file(s)
@@ -2543,7 +2560,7 @@ subst )
platform )
##
## platform -- Platform Identification Utility
- ## Copyright (c) 2003-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 2003-2008 Ralf S. Engelschall <rse@engelschall.com>
##
# option post-processing
@@ -2691,6 +2708,22 @@ platform )
SC="4.4BSD"
;;
+ # DragonFly BSD
+ *:DragonFly:* )
+ # determine architecture
+ AT="${UNAME_MACHINE}"
+ AP="${AT}"
+ case "${AP}" in
+ i[3-6]86 ) AP="iX86" ;;
+ esac
+ AC="${AP}"
+ # determine system
+ r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'`
+ ST="DragonFly ${r}"
+ SP="${ST}"
+ SC="4.4BSD"
+ ;;
+
# GNU/Linux
*:Linux:* )
# determine architecture
@@ -2738,7 +2771,7 @@ platform )
-e 's/^#.*$//'`
case "`util_lower ${n}`" in
redhat )
- if [ ".`grep 'Red Hat Enterprise Linux' /etc/${tagfile}`" != . ]; then
+ if [ ".`egrep '(Red Hat Enterprise Linux|CentOS)' /etc/${tagfile}`" != . ]; then
n="<R>ed <H>at <E>nterprise <L>inux"
else
n="<R>ed <H>at <L>inux"
@@ -2747,7 +2780,7 @@ platform )
debian ) n="Debian[ GNU/Linux]" ;;
ubuntu ) n="Ubuntu[ GNU/Linux]" ;;
fedora ) n="<Fedora> Core[ GNU/Linux]" ;;
- suse ) n="SuSE[ Linux]" ;;
+ suse ) n="[Novell ]SUSE[ Linux]" ;;
mandrake*|mandriva ) n="Mandriva[ Linux]" ;;
gentoo ) n="Gentoo[ GNU/Linux]" ;;
slackware ) n="Slackware[ Linux]" ;;
@@ -2907,15 +2940,16 @@ platform )
# IBM AIX
*:AIX:* )
- cpu_arch=rs6000
+ # determine architecture
+ cpu_arch=RS6000
if [ -x /usr/sbin/lsdev -a -x /usr/sbin/lsattr ]; then
cpu_id=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if [ ".`/usr/sbin/lsattr -El ${cpu_id} | grep -i powerpc`" != . ]; then
- cpu_arch=powerpc
+ cpu_arch=PPC
fi
elif [ -d /QOpenSys ]; then
# IBM i5/OS (aka OS/400) with PASE (Portable Application Solutions Environment)
- cpu_arch=powerpc
+ cpu_arch=PPC
fi
if [ -x /usr/bin/oslevel ]; then
os_level=`/usr/bin/oslevel`
@@ -2928,6 +2962,7 @@ platform )
AT="${cpu_arch}"
AP="${AT}"
AC="${AP}"
+ # determine system
ST="[IBM ]<AIX >${os_level}"
SP="${ST}"
case "${os_level}" in
@@ -2936,20 +2971,78 @@ platform )
esac
;;
- # Apple MacOS X Darwin
+ # Apple Mac OS X (Darwin)
*:Darwin:* )
- AT=`uname -p`
+ # determine architecture
+ AT="`uname -p`"
case "${AT}" in
powerpc ) AT="PPC" ;;
esac
AP="${AT}"
+ case "${AP}" in
+ i?86 ) AP="iX86" ;;
+ esac
AC="${AP}"
- case "${AC}" in
- i?86 ) AC="iX86" ;;
+ # determine system
+ unset v1; unset v2; unset v3
+ eval `echo "${UNAME_RELEASE}" |\
+ sed -e 's/^/#/' \
+ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
+ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
+ -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
+ -e 's/^#.*$/v1="0"/'`
+ ST="[Apple ]<${UNAME_SYSTEM} ${v1}>${v2+.$v2}${v3+[.$v3]}"
+ SP="$ST"
+ v="`(sw_vers) 2>/dev/null | grep 'ProductVersion:' | sed -e 's/^ProductVersion:[^0-9]*\([0-9][0-9.]*\).*$/\1/'`"
+ if [ ".$v" = . ]; then
+ for name in System Server; do
+ if [ -f /System/Library/CoreServices/${name}Version.plist ]; then
+ v=`(defaults read "/System/Library/CoreServices/${name}Version" "ProductVersion") 2>/dev/null`
+ [ ".$v" != . ] && break
+ fi
+ done
+ fi
+ if [ ".$v" != . ]; then
+ unset v1; unset v2; unset v3
+ eval `echo "${v}" |\
+ sed -e 's/^/#/' \
+ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
+ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
+ -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
+ -e 's/^#.*$/v1="0"/'`
+ SP="[Apple ]Mac OS X ${v1}${v2+.$v2}${v3+[.$v3]}"
+ fi
+ SC="4.4BSD/Mach3.0"
+ ;;
+
+ # Windows/Cygwin
+ *:CYGWIN*:* )
+ # determine architecture
+ AT="`uname -m`"
+ AP="${AT}"
+ case "${AP}" in
+ i?86 ) AP="iX86" ;;
+ esac
+ AC="${AP}"
+ # determine system
+ unset v1; unset v2; unset v3
+ eval `echo "${UNAME_RELEASE}" |\
+ sed -e 's/^/#/' \
+ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
+ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
+ -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
+ -e 's/^#.*$/v1="0"/'`
+ ST="Cygwin ${v1}${v2+.$v2}${v3+[.$v3]}"
+ SP="$ST"
+ SC="Windows"
+ v=`echo "${UNAME_SYSTEM}" | sed -e 's/^CYGWIN_NT-//' |\
+ sed -e 's/^/#/' -e 's/^#\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' -e 's/^#.*$//'`
+ case "$v" in
+ 4.0 ) SC="$SC[ NT]" ;;
+ 5.0 ) SC="$SC[ 2000]" ;;
+ 5.1 ) SC="$SC[ XP]" ;;
+ 6.0 ) SC="$SC[ Vista]" ;;
esac
- ST="[Apple ]${UNAME_SYSTEM} ${UNAME_RELEASE}"
- SP="${ST}"
- SC="4.4BSD/Mach3"
;;
# TODO ...ADD YOUR NEW PLATFORM CHECK HERE... TODO
@@ -3096,7 +3189,7 @@ platform )
arx )
##
## arx -- Extended archive command
- ## Copyright (c) 1999-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
##
ar_prg="$opt_C"
@@ -3175,7 +3268,7 @@ arx )
slo )
##
## slo -- Separate linker options by library class
- ## Copyright (c) 1998-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
##
DIFS="$IFS"
@@ -3334,7 +3427,7 @@ slo )
scpp )
##
## scpp -- Sharing C Pre-Processor
- ## Copyright (c) 1999-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
##
srcs="$*"
@@ -3554,7 +3647,7 @@ scpp )
version )
##
## version -- Maintain a version information file
- ## Copyright (c) 1994-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1994-2008 Ralf S. Engelschall <rse@engelschall.com>
##
file="$1"
@@ -3846,7 +3939,7 @@ version )
path )
##
## path -- Deal with program paths
- ## Copyright (c) 1998-2006 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
##
namelist="$*"