diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2022-11-13 16:52:06 +0000 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2022-11-13 16:52:06 +0000 |
commit | 39111de7fbaa830a225714066b3d9a0ae12b1996 (patch) | |
tree | 880d914bbdc57bec68ffab7b7773fe24f52c402a /perl-install/standalone | |
parent | a4c61d3d7979227cc3e9734efd888e0874b6fc5c (diff) | |
download | drakx-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
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-x | perl-install/standalone/finish-install | 15 |
1 files changed, 13 insertions, 2 deletions
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; } } } |