Index: ossp-pkg/shtool/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v rcsdiff -q -kk '-r1.173' '-r1.174' -u '/v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v' 2>/dev/null --- ChangeLog 2002/11/02 12:14:10 1.173 +++ ChangeLog 2002/11/02 12:35:56 1.174 @@ -11,6 +11,9 @@ Changes between 1.6.1 and 1.6.2 (12-Jul-2002 to xx-Oct-2002): + *) Add -o|--owner and -g|--group options to "shtool mkdir". + [Ralf S. Engelschall] + *) Fixed 'shtool scpp -f ...'. The arguments to option -f were not evaluated correctly. [Ralf S. Engelschall] Index: ossp-pkg/shtool/sh.mkdir RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.mkdir,v rcsdiff -q -kk '-r1.18' '-r1.19' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.mkdir,v' 2>/dev/null --- sh.mkdir 2001/12/31 15:06:04 1.18 +++ sh.mkdir 2002/11/02 12:35:56 1.19 @@ -21,14 +21,16 @@ ## str_tool="mkdir" -str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode ] [ ...]" +str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode ] [-o|--owner ] [-g|--group ] [ ...]" arg_spec="1+" -opt_spec="t.f.p.m:" -opt_alias="t:trace,f:force,p:parents,m:mode" +opt_spec="t.f.p.m:o:g:" +opt_alias="t:trace,f:force,p:parents,m:mode,o:owner,g:group" opt_t=no opt_f=no opt_p=no opt_m="" +opt_o="" +opt_g="" . ./sh.common @@ -50,6 +52,18 @@ echo "mkdir $p" 1>&2 fi mkdir $p || errstatus=$? + if [ ".$opt_o" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chown $opt_o $p" 1>&2 + fi + chown $opt_o $p || errstatus=$? + fi + if [ ".$opt_g" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chgrp $opt_g $p" 1>&2 + fi + chgrp $opt_g $p || errstatus=$? + fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m $p" 1>&2 @@ -75,6 +89,18 @@ echo "mkdir $pathcomp" 1>&2 fi mkdir $pathcomp || errstatus=$? + if [ ".$opt_o" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chown $opt_o $pathcomp" 1>&2 + fi + chown $opt_o $pathcomp || errstatus=$? + fi + if [ ".$opt_g" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chgrp $opt_g $pathcomp" 1>&2 + fi + chgrp $opt_g $pathcomp || errstatus=$? + fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m $pathcomp" 1>&2 Index: ossp-pkg/shtool/shtool.pod RCS File: /v/ossp/cvs/ossp-pkg/shtool/shtool.pod,v rcsdiff -q -kk '-r1.59' '-r1.60' -u '/v/ossp/cvs/ossp-pkg/shtool/shtool.pod,v' 2>/dev/null --- shtool.pod 2002/07/11 17:23:25 1.59 +++ shtool.pod 2002/11/02 12:35:56 1.60 @@ -445,7 +445,7 @@ 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<--trace>] [B<-f>|B<--force>] [B<-p>|B<--parents>] [B<-m>|B<--mode> I] I [I ...] +=item B [B<-t>|B<--trace>] [B<-f>|B<--force>] [B<-p>|B<--parents>] [B<-m>|B<--mode> I] [B<-o>|B<--owner> I] [B<-g>|B<--group> I] I [I ...] This is a mkdir(1) style command providing support for automatic parent directory creation (if option ``B<-p>'' is used), directory permission @@ -453,7 +453,10 @@ the formats specified to the chmod(1) command) and smart skipping if I already exists (triggered by the force option ``B<-f>''). Option ``B<-t>'' (trace) can be used to enable the output of the essential -shell commands which are executed. +shell commands which are executed. The target directory is created with +owner/group set 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. The trick of this command is that it provides both a portable ``B<-p>'' functionality and the ability to be smart if the directory already exists