--- shtool 2000/07/01 14:17:42 1.21
+++ shtool 2001/01/29 20:25:49 1.22
@@ -1,12 +1,12 @@
#!/bin/sh
##
## GNU shtool -- The GNU Portable Shell Tool
-## Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>
+## Copyright (c) 1994-2001 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: 1.5.0 (01-Jul-2000)
+## Version: 1.5.2 (05-Oct-2000)
## Contents: 6/17 available modules
##
@@ -65,8 +65,8 @@
exit 1
fi
if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
- echo "This is GNU shtool, version 1.5.0 (01-Jul-2000)"
- echo "Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>"
+ echo "This is GNU shtool, version 1.5.2 (05-Oct-2000)"
+ echo "Copyright (c) 1994-2001 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>]]"
@@ -80,7 +80,7 @@
echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
echo ' echo [-n] [-e] [<str> ...]'
echo ' install [-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>]'
- echo ' [-e<ext>] <file> [<file> ...] <path>'
+ echo ' [-e<sed-cmd>] <file> [<file> ...] <path>'
echo ' mkdir [-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]'
echo ' fixperm [-v] [-t] <path> [<path> ...]'
echo ' tarball [-t] [-v] [-o <tarball>] [-c <prog>] [-d <dir>] [-u'
@@ -105,7 +105,7 @@
exit 0
fi
if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
- echo "GNU shtool 1.5.0 (01-Jul-2000)"
+ echo "GNU shtool 1.5.2 (05-Oct-2000)"
exit 0
fi
if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
@@ -147,15 +147,15 @@
;;
install )
str_tool="install"
- str_usage="[-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>] [-e<ext>] <file> [<file> ...] <path>"
+ str_usage="[-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>] [-e<sed-cmd>] <file> [<file> ...] <path>"
arg_spec="2+"
- opt_spec="v.t.c.C.s.m:o:g:e:"
+ opt_spec="v.t.c.C.s.m:o:g:e+"
opt_v=no
opt_t=no
opt_c=no
opt_C=no
opt_s=no
- opt_m=""
+ opt_m="0755"
opt_o=""
opt_g=""
opt_e=""
@@ -353,6 +353,7 @@
tmpfile="$tmpdir/.shtool.$$"
rm -f $tmpfile >/dev/null 2>&1
touch $tmpfile
+ chmod 600 $tmpfile
fi
##
@@ -364,7 +365,7 @@
echo )
##
## echo -- Print string with optional construct expansion
- ## Copyright (c) 1998-2000 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1998-2001 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for WML as buildinfo
##
@@ -587,7 +588,7 @@
install )
##
## install -- Install a program, script or datafile
- ## Copyright (c) 1997-2000 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1997-2001 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for shtool
##
@@ -617,19 +618,13 @@
for src in $srcs; do
dst=$dstpath
- # If destination is a directory, append the input filename
+ # if destination is a directory, append the input filename
if [ $dstisdir = 1 ]; then
dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
dst="$dst/$dstfile"
fi
- # Add a possible extension to src and dst
- if [ ".$opt_e" != . ]; then
- src="$src$opt_e"
- dst="$dst$opt_e"
- fi
-
- # Check for correct arguments
+ # check for correct arguments
if [ ".$src" = ".$dst" ]; then
echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
continue
@@ -639,18 +634,18 @@
continue
fi
- # Make a temp file name in the destination directory
+ # make a temp file name in the destination directory
dsttmp=`echo $dst |\
sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
-e "s;\$;/#INST@$$#;"`
- # Verbosity
+ # verbosity
if [ ".$opt_v" = .yes ]; then
echo "$src -> $dst" 1>&2
fi
- # Copy or move the file name to the temp name
- # (because we might be not allowed to change the source)
+ # copy or move the file name to the temp name
+ # (because we might be not allowed to change the source)
if [ ".$opt_C" = .yes ]; then
opt_c=yes
fi
@@ -666,8 +661,16 @@
mv $src $dsttmp || exit $?
fi
- # Adjust the target file
- # (we do chmod last to preserve setuid bits)
+ # adjust the target file
+ if [ ".$opt_e" != . ]; then
+ sed='sed'
+ for e in $opt_e; do
+ sed="$sed -e '$e'"
+ done
+ cp $dsttmp $dsttmp.old
+ eval "$sed <$dsttmp.old >$dsttmp" || exit $?
+ rm -f $dsttmp.old
+ fi
if [ ".$opt_s" = .yes ]; then
if [ ".$opt_t" = .yes ]; then
echo "strip $dsttmp" 1>&2
@@ -686,14 +689,14 @@
fi
chgrp $opt_g $dsttmp || exit $?
fi
- if [ ".$opt_m" != . ]; then
+ if [ ".$opt_m" != ".-" ]; then
if [ ".$opt_t" = .yes ]; then
echo "chmod $opt_m $dsttmp" 1>&2
fi
chmod $opt_m $dsttmp || exit $?
fi
- # Determine whether to do a quick install
+ # determine whether to do a quick install
# (has to be done _after_ the strip was already done)
quick=no
if [ ".$opt_C" = .yes ]; then
@@ -704,7 +707,7 @@
fi
fi
- # Finally install the file to the real destination
+ # finally, install the file to the real destination
if [ $quick = yes ]; then
if [ ".$opt_t" = .yes ]; then
echo "rm -f $dsttmp" 1>&2
@@ -722,7 +725,7 @@
mkdir )
##
## mkdir -- Make one or more directories
- ## Copyright (c) 1996-2000 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1996-2001 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>
## Cleaned up and enhanced for shtool
##
@@ -731,7 +734,7 @@
for p in ${1+"$@"}; do
# if the directory already exists...
if [ -d "$p" ]; then
- if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then
+ if [ ".$opt_f" = .no -a ".$opt_p" = .no ]; then
echo "$msgprefix:Error: directory already exists: $p" 1>&2
errstatus=1
break
@@ -781,7 +784,7 @@
fixperm )
##
## fixperm -- Fix file permissions inside a source tree
- ## Copyright (c) 1996-2000 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1996-2001 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for ePerl
##
@@ -837,7 +840,7 @@
tarball )
##
## tarball -- Roll distribution tarballs
- ## Copyright (c) 1999-2000 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1999-2001 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for shtool
##
@@ -863,7 +866,7 @@
for tool in `echo $tools | sed -e 's/,/ /g'`; do
# iterate over paths
for path in $paths; do
- if [ $minusx "$path/$tool" ] && [ ! -d "$path/$tool" ]; then
+ if [ $minusx "$path/$tool" -a ! -d "$path/$tool" ]; then
eval "prg_${prg}=\"$path/$tool\""
break
fi
@@ -889,7 +892,7 @@
if [ ".$opt_t" = .yes ]; then
echo "(cd $src && $prg_find . -type f -depth -print) | sed -e 's:^\\.\$::' -e 's:^\\./::' | cat $exclude >>$tmpfile.lst" 1>&2
fi
- (cd $src && find . -type f -depth -print) |\
+ (cd $src && $prg_find . -type f -depth -print) |\
sed -e 's:^\.$::' -e 's:^\./::' | eval cat $exclude >>$tmpfile.lst
else
if [ ".$opt_t" = .yes ]; then
@@ -1000,7 +1003,7 @@
version )
##
## version -- Maintain a version information file
- ## Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 1994-2001 Ralf S. Engelschall <rse@engelschall.com>
## Originally written for ePerl, rewritten from scratch for shtool
##
@@ -1084,7 +1087,8 @@
s ) typnum=15; levnum=255 ;; # snapshots are special
esac
hex=`echo "$ver:$rev:$typnum:$levnum" |\
- awk -F: '{ printf("0x%X%02X%1X%02X", $1, $2, $3, $4); }'`
+ awk -F: '{ printf("0x%x%02x%1x%02x", $1, $2, $3, $4); }' |\
+ tr 'abcdef' 'ABCDEF'`
ltv=`echo "$ver:$rev:$typnum:$levnum" |\
awk -F: '{ printf("%d:%d", $1*10 + $2, $3*10 + $4); }'`
@@ -1250,6 +1254,23 @@
echo >>$file "1;"
echo >>$file ""
;;
+ python )
+ echo >>$file "##"
+ echo >>$file "## ${file} -- Version Information for ${name} (syntax: Python)"
+ echo >>$file "## [automatically generated and maintained by GNU shtool]"
+ echo >>$file "##"
+ echo >>$file ""
+ echo >>$file "class ${prefix}version:"
+ echo >>$file " v_hex = ${vHex}"
+ echo >>$file " v_short = \"${vShort}\""
+ echo >>$file " v_long = \"${vLong}\""
+ echo >>$file " v_tex = \"${vTeX}\""
+ echo >>$file " v_gnu = \"${vGNU}\""
+ echo >>$file " v_web = \"${vWeb}\""
+ echo >>$file " v_sccs = \"${vSCCS}\""
+ echo >>$file " v_rcs = \"${vRCS}\""
+ echo >>$file ""
+ ;;
* ) echo "$msgprefix:Error: invalid argument to option \`-l': \`$opt_l'" 1>&2
exit 1
;;
|