environment.etc: add user/group option

fixes #27546
This commit is contained in:
Volth
2017-07-29 23:56:46 +01:00
committed by Jörg Thalheim
parent 6f2715e47d
commit faac018630
4 changed files with 31 additions and 9 deletions
+2
View File
@@ -108,6 +108,8 @@ sub link {
my $uid = read_file("$_.uid"); chomp $uid;
my $gid = read_file("$_.gid"); chomp $gid;
copy "$static/$fn", "$target.tmp" or warn;
$uid = getpwnam $uid unless $uid =~ /^\+/;
$gid = getgrnam $gid unless $gid =~ /^\+/;
chown int($uid), int($gid), "$target.tmp" or warn;
chmod oct($mode), "$target.tmp" or warn;
rename "$target.tmp", $target or warn;