summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2022-11-13 16:52:06 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2022-11-13 16:52:06 +0000
commit39111de7fbaa830a225714066b3d9a0ae12b1996 (patch)
tree880d914bbdc57bec68ffab7b7773fe24f52c402a
parenta4c61d3d7979227cc3e9734efd888e0874b6fc5c (diff)
downloaddrakx-39111de7fbaa830a225714066b3d9a0ae12b1996.tar
drakx-39111de7fbaa830a225714066b3d9a0ae12b1996.tar.gz
drakx-39111de7fbaa830a225714066b3d9a0ae12b1996.tar.bz2
drakx-39111de7fbaa830a225714066b3d9a0ae12b1996.tar.xz
drakx-39111de7fbaa830a225714066b3d9a0ae12b1996.zip
finish-install: detect and adapt to systems using NetworkManager
-rw-r--r--perl-install/NEWS1
-rwxr-xr-xperl-install/standalone/finish-install15
2 files changed, 14 insertions, 2 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 15aef5b7b..e3b43f391 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,5 +1,6 @@
- finish-install:
o when renaming a user, update the name in any network config files
+ o detect and adapt to systems using NetworkManager
Version 18.51 - 29 October 2022
diff --git a/perl-install/standalone/finish-install b/perl-install/standalone/finish-install
index 2c44e4f6f..81a2f00e5 100755
--- a/perl-install/standalone/finish-install
+++ b/perl-install/standalone/finish-install
@@ -105,9 +105,17 @@ sub ask_network() {
require services;
return if network::tools::has_network_connection();
- #- test again connection after waiting for network-up service
+ #- test again connection after waiting for network up
my $w = $in->wait_message(N("Please wait"), N("Testing your connection..."));
- services::start('network-up');
+ if (services::starts_on_boot('NetworkManager')) {
+ my $time = 0;
+ while ($time < 20 && run_program::get_stdout('systemctl show -p SubState NetworkManager-wait-online') =~ /start/) {
+ $time++;
+ sleep(1);
+ }
+ } else {
+ services::start('network-up');
+ }
undef $w;
return if network::tools::has_network_connection();
@@ -183,9 +191,12 @@ sub ask_users() {
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
+ require services;
+ my $using_networkmanager = services::is_service_running('NetworkManager');
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);
+ run_program::run('nmcli', 'con', 'load', $f) if $using_networkmanager;
}
}
}