OSSP CVS Repository

ossp - Difference in ossp-pkg/shtool/sh.install versions 1.18 and 1.19
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

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

CVSTrac 2.0.1