summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2022-11-12 22:01:38 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2022-11-13 15:01:06 +0000
commita4c61d3d7979227cc3e9734efd888e0874b6fc5c (patch)
tree81f8206fbce3bea9cb245670163ac4a5ddb98160
parent4ed92dabed418bb12f76bb317716614241dc6eee (diff)
downloaddrakx-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
-rw-r--r--perl-install/NEWS3
-rwxr-xr-xperl-install/standalone/finish-install7
2 files changed, 10 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 6216f8eac..15aef5b7b 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,6 @@
+- finish-install:
+ o when renaming a user, update the name in any network config files
+
Version 18.51 - 29 October 2022
- drakboot: ensure efivars are mounted before installing a UEFI bootloader (mga#31008)
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);
+ }
+ }
}
}