aboutsummaryrefslogtreecommitdiffstats
path: root/iurt_root_command
diff options
context:
space:
mode:
Diffstat (limited to 'iurt_root_command')
-rwxr-xr-xiurt_root_command12
1 files changed, 9 insertions, 3 deletions
diff --git a/iurt_root_command b/iurt_root_command
index 87b5c5e..e64b1f7 100755
--- a/iurt_root_command
+++ b/iurt_root_command
@@ -45,7 +45,7 @@ $run{todo} = [];
#
[ "", $program_name, 0, "[--verbose <level>]
[--modprobe <module>]
- [--mkdir [--parents] <dir1> <dir2> ... <dirn>]",
+ [--mkdir [--parents] [--mode <mode>] <dir1> <dir2> ... <dirn>]",
"$program_name is a perl script to execute commands which need root privilege, it helps probram which needs occasional root privileges for some commands.",
sub { $arg or usage($program_name, \@params) }, String::Escape::elide(join(' ', "Running $program_name", @ARGV), 120) ],
@@ -77,7 +77,7 @@ $run{todo} = [];
\&ln, "Linking files" ],
[ "", "mkdir", [
- ["", "mkdir", -1, "[--parents] <dir1> <dir2> ... <dirn>", "mkdir create the given path",
+ ["", "mkdir", -1, "[--parents] [--mode <mode>] <dir1> <dir2> ... <dirn>", "mkdir create the given path",
sub {
my ($tmp, @arg) = @_;
$tmp->[0] ||= {};
@@ -87,7 +87,10 @@ $run{todo} = [];
["p", "parents", 0, "",
"Also create needed parents directories",
sub { my ($tmp) = @_; $tmp->[0]{parents} = 1; 1 }, "Set the parents flag"],
- ], "[--parents] <dir1> <dir2> ... <dirn>",
+ ["m", "mode", 1, "",
+ "Set the given mode on created directories",
+ sub { my ($tmp, $arg) = @_; $tmp->[0]{mode} = $arg; 1 }, "Set the mode flag"],
+ ], "[--parents] [--mode <mode>] <dir1> <dir2> ... <dirn>",
"mkdir create the given path",
\&mkdir, "Creating the path" ],
@@ -244,6 +247,9 @@ sub mkdir {
} else {
mkdir $path;
}
+ if ($opt->{mode}) {
+ chmod $opt->{mode}, $path;
+ }
}
1;
}