summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2006-02-28 16:52:22 +0000
committerOlivier Blin <oblin@mandriva.org>2006-02-28 16:52:22 +0000
commitc05248616106aceac19e71ddfb6955cbd44b27bb (patch)
tree9628693347e055f9b60cd95c0cfcec0787221678
parent66cdc556a27aeeb6dd50d099e7df09cec3562160 (diff)
downloaddrakx-c05248616106aceac19e71ddfb6955cbd44b27bb.tar
drakx-c05248616106aceac19e71ddfb6955cbd44b27bb.tar.gz
drakx-c05248616106aceac19e71ddfb6955cbd44b27bb.tar.bz2
drakx-c05248616106aceac19e71ddfb6955cbd44b27bb.tar.xz
drakx-c05248616106aceac19e71ddfb6955cbd44b27bb.zip
symlink old home directory to new one when renaming user (backport from HEAD, #21384)
-rw-r--r--perl-install/any.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 9dca58edd..f08f02f70 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -69,6 +69,7 @@ sub create_user {
}
require authentication;
+ my $symlink_home_from = $u->{rename_from} && (getpwnam($u->{rename_from}))[7];
run_program::raw({ root => $::prefix, sensitive_arguments => 1 },
($u->{rename_from} ? 'usermod' : 'adduser'),
'-p', authentication::user_crypted_passwd($u, $isMD5),
@@ -77,8 +78,9 @@ sub create_user {
if_($u->{home}, '-d', $u->{home}, if_($u->{rename_from}, '-m')),
if_($u->{shell}, '-s', $u->{shell}),
($u->{rename_from}
- ? ('-l', $u->{name}, , $u->{rename_from})
+ ? ('-l', $u->{name}, $u->{rename_from})
: $u->{name}));
+ symlink($u->{home}, $symlink_home_from) if $symlink_home_from;
}
my (undef, undef, $uid, $gid, undef, undef, undef, $home) = getpwnam($u->{name});