Check-in Number:
|
2710 | |
Date: |
2002-Nov-02 13:35:56 (local)
2002-Nov-02 12:35:56 (UTC) |
User: | rse |
Branch: | |
Comment: |
Add -o|--owner and -g|--group options to "shtool mkdir". |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/shtool/ChangeLog 1.173 -> 1.174
--- 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]
|
|
ossp-pkg/shtool/sh.mkdir 1.18 -> 1.19
--- 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 <mode>] <dir> [<dir> ...]"
+str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] <dir> [<dir> ...]"
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
|
|
ossp-pkg/shtool/shtool.pod 1.59 -> 1.60
--- 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<mkdir> [B<-t>|B<--trace>] [B<-f>|B<--force>] [B<-p>|B<--parents>] [B<-m>|B<--mode> I<mode>] I<dir> [I<dir> ...]
+=item B<mkdir> [B<-t>|B<--trace>] [B<-f>|B<--force>] [B<-p>|B<--parents>] [B<-m>|B<--mode> I<mode>] [B<-o>|B<--owner> I<owner>] [B<-g>|B<--group> I<group>] I<dir> [I<dir> ...]
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<dir> 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
|
|