OSSP CVS Repository

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

Check-in Number: 3781
Date: 2001-Jul-28 18:42:56 (local)
2001-Jul-28 16:42:56 (UTC)
User:rse
Branch:
Comment: *** empty log message ***
Tickets:
Inspections:
Files:
ossp-pkg/act/shtool      1.3->removed

ossp-pkg/act/shtool 1.3 -> 1.4

--- shtool       2001/03/21 16:08:41     1.3
+++ shtool       2001/07/28 16:42:56     1.4
@@ -6,7 +6,7 @@
 ##  See http://www.gnu.org/software/shtool/ for more information.
 ##  See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
 ##
-##  Version:  1.5.2 (27-Feb-2001)
+##  Version:  1.5.4 (14-Jun-2001)
 ##  Contents: all available modules
 ##
 
@@ -26,7 +26,7 @@
 ##  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 ##  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
 ##
-##  Notice: Given that you include this file verbatim into your own
+##  NOTICE: Given that you include this file verbatim into your own
 ##  source tree, you are justified in saying that it remains separate
 ##  from your package, and that this way you are simply just using GNU
 ##  shtool. So, in this situation, there is no requirement that your
@@ -63,11 +63,11 @@
     exit 1
 fi
 if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
-    echo "This is GNU shtool, version 1.5.2 (27-Feb-2001)"
+    echo "This is GNU shtool, version 1.5.4 (14-Jun-2001)"
     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>]]" 
+    echo "Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
     echo ''
     echo 'Available global <options>:'
     echo '  -v, --version   display shtool version information'
@@ -87,8 +87,8 @@
     echo '  mkln     [-t] [-f] [-s] <src-path> [<src-path> ...] <dst-path>'
     echo '  mkshadow [-v] [-t] [-a] <src-dir> <dst-dir>'
     echo '  fixperm  [-v] [-t] <path> [<path> ...]'
-    echo '  tarball  [-t] [-v] [-o <tarball>] [-c <prog>] [-d <dir>] [-u'
-    echo '           <user>] [-g <group>] [-e <pattern>] <path> [<path> ...]'
+    echo '  tarball  [-t] [-v] [-o<tarball>] [-c<prog>] [-d<dir>] [-u<user>]'
+    echo '           [-g<group>] [-e<pattern>] <path> [<path> ...]'
     echo '  guessos  '
     echo '  arx      [-t] [-C<cmd>] <op> <archive> [<file> ...]'
     echo '  slo      [-p<str>] -- -L<dir> -l<lib> [-L<dir> -l<lib> ...]'
@@ -101,7 +101,7 @@
     exit 0
 fi
 if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
-    echo "GNU shtool 1.5.2 (27-Feb-2001)"
+    echo "GNU shtool 1.5.4 (14-Jun-2001)"
     exit 0
 fi
 if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
@@ -233,7 +233,7 @@
         ;;
     tarball )
         str_tool="tarball"
-        str_usage="[-t] [-v] [-o <tarball>] [-c <prog>] [-d <dir>] [-u <user>] [-g <group>] [-e <pattern>] <path> [<path> ...]"
+        str_usage="[-t] [-v] [-o<tarball>] [-c<prog>] [-d<dir>] [-u<user>] [-g<group>] [-e<pattern>] <path> [<path> ...]"
         gen_tmpfile=yes
         arg_spec="1+"
         opt_spec="t.v.o:c:d:u:g:e:"
@@ -491,7 +491,7 @@
     fi
     
     #   determine terminal bold sequence
-    term_bold='' 
+    term_bold=''
     term_norm=''
     if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
         case $TERM in
@@ -542,7 +542,7 @@
     
     #   determine user name
     username=''
-    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uU]'`" != . ]; then
+    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uUgG]'`" != . ]; then
         username="$LOGNAME"
         if [ ".$username" = . ]; then
             username="$USER"
@@ -584,8 +584,38 @@
         fi
     fi
     
-    #   determine host name
+    #   determine (primary) group id
+    groupid=''
+    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[gG]'`" != . ]; then
+        groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
+                 sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+        if [ ".$groupid" = . ]; then
+            groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
+                     sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+            if [ ".$groupid" = . ]; then
+                groupid='?'
+            fi
+        fi
+    fi
+    
+    #   determine (primary) group name
+    groupname=''
+    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%g'`" != . ]; then
+        groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
+                   sed -e 's/:.*$//'`
+        if [ ".$groupname" = . ]; then
+            groupname=`(ypcat group) 2>/dev/null | \
+                       egrep "^[^:]*:[^:]*:${groupid}:" | \
+                       sed -e 's/:.*$//'`
+            if [ ".$groupname" = . ]; then
+                groupname='?'
+            fi
+        fi
+    fi
+    
+    #   determine host and domain name
     hostname=''
+    domainname=''
     if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
         hostname="`(uname -n) 2>/dev/null |\
                    awk '{ printf("%s", $1); }'`"
@@ -603,9 +633,6 @@
                 ;;
         esac
     fi
-    
-    #   determine domain name
-    domainname=''
     if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
         if [ ".$domainname" = . ]; then
             if [ -f /etc/resolv.conf ]; then
@@ -665,6 +692,8 @@
                   -e "s/%b/${term_norm}/g" \
                   -e "s/%u/${username}/g" \
                   -e "s/%U/${userid}/g" \
+                  -e "s/%g/${groupname}/g" \
+                  -e "s/%G/${groupid}/g" \
                   -e "s/%h/${hostname}/g" \
                   -e "s/%d/${domainname}/g" \
                   -e "s/%D/${time_day}/g" \
@@ -1020,7 +1049,7 @@
     ##  Originally written for shtool
     ##
     
-    #   determine source(s) and destination 
+    #   determine source(s) and destination
     argc=$#
     srcs=""
     while [ $# -gt 1 ]; do
@@ -1176,6 +1205,12 @@
                 echo "mkdir $p" 1>&2
             fi
             mkdir $p || errstatus=$?
+            if [ ".$opt_m" != . ]; then
+                if [ ".$opt_t" = .yes ]; then
+                    echo "chmod $opt_m $p" 1>&2
+                fi
+                chmod $opt_m $p || errstatus=$?
+            fi
         else
             #   the smart situation
             set fnord `echo ":$p" |\
@@ -2443,7 +2478,7 @@
             echo dummy | awk '{ printf("new version: "); }'
             read triple
             case $triple in
-                [0-9]*.[0-9]*[sabp.][0-9]* ) 
+                [0-9]*.[0-9]*[sabp.][0-9]* )
                     ;;
                 * ) echo "$msgprefix:Error: invalid version string entered: \`$triple'" 1>&2
                     continue
@@ -2527,7 +2562,7 @@
                 exit 1
                 ;;
         esac
-    else 
+    else
         #   update the version file
     
         #   pre-generate various strings
@@ -2539,7 +2574,7 @@
         vGNU="${name} ${triple} (${tim})"
         vWeb="${name}/${triple}"
         vSCCS="@(#)${name} ${triple} (${tim})"
-        vRCS="\$Id: shtool,v 1.3 2001/03/21 16:08:41 rse Exp ${name} ${triple} (${tim}) \$"
+        vRCS="\$Id: shtool,v 1.4 2001/07/28 16:42:56 rse Exp ${name} ${triple} (${tim}) \$"
     
         #   determine string out of filename
         #   (do NOT try to optimize this in any way because of portability)
@@ -2550,7 +2585,7 @@
         #   generate uppercase prefix
         prefixupper=`echo $prefix |\
                      tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-        
+    
         #   create the version file according the the selected language
         echo "new version: ${vLong}"
     

CVSTrac 2.0.1