From a4c61d3d7979227cc3e9734efd888e0874b6fc5c Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 12 Nov 2022 22:01:38 +0000 Subject: finish-install: when renaming user, update name in any network config files --- perl-install/standalone/finish-install | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'perl-install/standalone') 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); + } + } } } -- cgit v1.2.1