OSSP CVS Repository

ossp - Check-in [290]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 290
Date: 2001-Jan-17 11:15:02 (local)
2001-Jan-17 10:15:02 (UTC)
User:rse
Branch:
Comment: *** empty log message ***
Tickets:
Inspections:
Files:
ossp-pkg/shtool/ChangeLog      1.142 -> 1.143     10 inserted, 0 deleted
ossp-pkg/shtool/sh.install      1.18 -> 1.19     24 inserted, 20 deleted
ossp-pkg/shtool/shtool.pod      1.47 -> 1.48     10 inserted, 7 deleted

ossp-pkg/shtool/ChangeLog 1.142 -> 1.143

--- 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 <sed-cmd>' 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 <ext>' 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]
 


ossp-pkg/shtool/sh.install 1.18 -> 1.19

--- 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<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
@@ -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


ossp-pkg/shtool/shtool.pod 1.47 -> 1.48

--- 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<install> [B<-v>] [B<-t>] [B<-c>] [B<-C>] [B<-s>] [B<-m> I<mode>] [B<-o> I<owner>] [B<-g> I<group>] [B<-e> I<ext>] I<file> I<path>
+=item B<install> [B<-v>] [B<-t>] [B<-c>] [B<-C>] [B<-s>] [B<-m> I<mode>] [B<-o> I<owner>] [B<-g> I<group>] [B<-e> I<sed-cmd>] I<file> I<path>
 
 This command installs a program, script or datafile (dependent on I<mode>) 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<file> 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<mkdir> [B<-t>] [B<-f>] [B<-p>] [B<-m> I<mode>] I<dir> [I<dir> ...]
 

CVSTrac 2.0.1