diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2022-11-12 22:01:38 +0000 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2022-11-13 15:01:06 +0000 |
commit | a4c61d3d7979227cc3e9734efd888e0874b6fc5c (patch) | |
tree | 81f8206fbce3bea9cb245670163ac4a5ddb98160 /perl-install/standalone/finish-install | |
parent | 4ed92dabed418bb12f76bb317716614241dc6eee (diff) | |
download | drakx-a4c61d3d7979227cc3e9734efd888e0874b6fc5c.tar drakx-a4c61d3d7979227cc3e9734efd888e0874b6fc5c.tar.gz drakx-a4c61d3d7979227cc3e9734efd888e0874b6fc5c.tar.bz2 drakx-a4c61d3d7979227cc3e9734efd888e0874b6fc5c.tar.xz drakx-a4c61d3d7979227cc3e9734efd888e0874b6fc5c.zip |
finish-install: when renaming user, update name in any network config files
Diffstat (limited to 'perl-install/standalone/finish-install')
-rwxr-xr-x | perl-install/standalone/finish-install | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/perl-install/standalone/finish-install b/perl-install/standalone/finish-install index 72767a9b2..2c44e4f6f 100755 --- a/perl-install/standalone/finish-install +++ b/perl-install/standalone/finish-install @@ -181,6 +181,13 @@ sub ask_users() { #- give console rights for current session my $console_dir = "/var/run/console"; cp_f($console_dir . "/" . $old_user, $console_dir . "/" . $new_user) if -e $console_dir . "/" . $old_user; + #- update user name in network configurations + #- for now, only support the case of a single user name + foreach my $f (glob('/etc/sysconfig/network-scripts/ifcfg-*')) { + if (cat_($f) =~ /\nUSERS=$old_user\n/) { + run_program::run('perl', '-pi', '-e', "s,^USERS=$old_user,USERS=$new_user,", $f); + } + } } } |