diff options
author | Pascal Terjan <pterjan@mageia.org> | 2023-11-26 21:38:04 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2023-11-26 21:51:06 +0000 |
commit | 7ff06658a899afdc3a3445b66a88cb67ddc00fed (patch) | |
tree | 53112dc9809995274eadee07733392333d265893 /iurt_root_command | |
parent | 92a5f7b1c1980be0ed210f03d44b1160d1d801de (diff) | |
download | iurt-7ff06658a899afdc3a3445b66a88cb67ddc00fed.tar iurt-7ff06658a899afdc3a3445b66a88cb67ddc00fed.tar.gz iurt-7ff06658a899afdc3a3445b66a88cb67ddc00fed.tar.bz2 iurt-7ff06658a899afdc3a3445b66a88cb67ddc00fed.tar.xz iurt-7ff06658a899afdc3a3445b66a88cb67ddc00fed.zip |
iurt: Fix / of the chroot belonging to the user instead of root
Diffstat (limited to 'iurt_root_command')
-rwxr-xr-x | iurt_root_command | 12 |
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; } |