Index: ossp-pkg/shtool/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v rcsdiff -q -kk '-r1.142' '-r1.143' -u '/v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v' 2>/dev/null --- ChangeLog 2001/01/17 09:55:11 1.142 +++ ChangeLog 2001/01/17 10:15:02 1.143 @@ -11,6 +11,16 @@ Changes between 1.5.1 and 1.5.2 (06-Jul-2000 to 15-Jan-2001): + *) Created a new `-e ' option for `shtool install' which can + be used one or multiple times to apply one or more sed(1) commands + on-the-fly to installed files. + [Ralf S. Engelschall] + + *) Kicked out the `-e ' option of `shtool install', because it + was a left-over from ancient days on non-POSIX systems and no longer + is (or should be) of any use. + [Ralf S. Engelschall] + *) Adjusted copyright messages to cover year 2001, too. [Ralf S. Engelschall] Index: ossp-pkg/shtool/sh.install RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.install,v rcsdiff -q -kk '-r1.18' '-r1.19' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.install,v' 2>/dev/null --- sh.install 2001/01/17 09:55:11 1.18 +++ sh.install 2001/01/17 10:15:02 1.19 @@ -20,9 +20,9 @@ ## str_tool="install" -str_usage="[-v] [-t] [-c] [-C] [-s] [-m] [-o] [-g] [-e] [ ...] " +str_usage="[-v] [-t] [-c] [-C] [-s] [-m] [-o] [-g] [-e] [ ...] " 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 @@ -61,19 +61,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 @@ -83,18 +77,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 @@ -110,7 +104,15 @@ mv $src $dsttmp || exit $? fi - # Adjust the target file + # 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 $? + fi if [ ".$opt_s" = .yes ]; then if [ ".$opt_t" = .yes ]; then echo "strip $dsttmp" 1>&2 @@ -129,12 +131,14 @@ fi chgrp $opt_g $dsttmp || exit $? fi - if [ ".$opt_t" = .yes ]; then - echo "chmod $opt_m $dsttmp" 1>&2 + if [ ".$opt_m" != ".-" ]; then + if [ ".$opt_t" = .yes ]; then + echo "chmod $opt_m $dsttmp" 1>&2 + fi + chmod $opt_m $dsttmp || exit $? fi - chmod $opt_m $dsttmp || exit $? - # 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 @@ -145,7 +149,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 Index: ossp-pkg/shtool/shtool.pod RCS File: /v/ossp/cvs/ossp-pkg/shtool/shtool.pod,v rcsdiff -q -kk '-r1.47' '-r1.48' -u '/v/ossp/cvs/ossp-pkg/shtool/shtool.pod,v' 2>/dev/null --- shtool.pod 2000/07/06 13:29:11 1.47 +++ shtool.pod 2001/01/17 10:15:02 1.48 @@ -403,7 +403,7 @@ lex scanner.l shtool move -t -p lex.yy.c scanner.c -=item B [B<-v>] [B<-t>] [B<-c>] [B<-C>] [B<-s>] [B<-m> I] [B<-o> I] [B<-g> I] [B<-e> I] I I +=item B [B<-v>] [B<-t>] [B<-c>] [B<-C>] [B<-s>] [B<-m> I] [B<-o> I] [B<-g> I] [B<-e> I] I I This command installs a program, script or datafile (dependent on I) in a portable way while providing all important options of the BSD install(1) @@ -412,12 +412,14 @@ to the current active uid/gid, but if this script is called as root (uid 0) the options ``B<-o>'' and ``B<-g>'' can be used to override this. -Additionally program executables is stripped with strip(1) after installation -if option ``B<-s>'' is used. Option ``B<-C>'' is like ``B<-c>'', except if -the destination file already exists and the files are the same, the source is -just removed. Option ``B<-e>'' can be used to set an implicit executable -extension. Option ``B<-v>'' (verbose) can be used to enable the output of -extra processing information. Option ``B<-t>'' (trace) can be used to enable +Additionally program executables is stripped with strip(1) after +installation if option ``B<-s>'' is used. Option ``B<-C>'' is like +``B<-c>'', except if the destination file already exists and the files +are the same, the source is just removed. Option ``B<-e>'' can be used +one or multiple times to apply one or more sed(1) commands on-the-fly +to the contents of the input I before the output file is created. +Option ``B<-v>'' (verbose) can be used to enable the output of extra +processing information. Option ``B<-t>'' (trace) can be used to enable the output of the essential shell commands which are executed. The trick of this command is that it provides the functionality of BSD @@ -430,6 +432,7 @@ : shtool install -c -s -m 4755 foo $(bindir)/ shtool install -c -m 644 foo.man $(mandir)/man1/foo.1 + shtool install -c -m 644 -e "s/@p@/$prefix/g" foo.conf $(etcdir)/ =item B [B<-t>] [B<-f>] [B<-p>] [B<-m> I] I [I ...]