summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2006-02-28 16:49:42 +0000
committerOlivier Blin <oblin@mandriva.org>2006-02-28 16:49:42 +0000
commit34099be3cf773eac19aa31657cf3d80f8bec7fb9 (patch)
treef456bb5c0e5392e27f9e3a073ca3722ca07dbbc0
parentaf88b9d1e98795d32963a6b1d01fe5649b289097 (diff)
downloaddrakx-34099be3cf773eac19aa31657cf3d80f8bec7fb9.tar
drakx-34099be3cf773eac19aa31657cf3d80f8bec7fb9.tar.gz
drakx-34099be3cf773eac19aa31657cf3d80f8bec7fb9.tar.bz2
drakx-34099be3cf773eac19aa31657cf3d80f8bec7fb9.tar.xz
drakx-34099be3cf773eac19aa31657cf3d80f8bec7fb9.zip
symlink old home directory to new one when renaming user (#21384)
-rw-r--r--perl-install/any.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 11dc9fcf9..722c19828 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),
@@ -79,6 +80,7 @@ sub create_user {
($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});