diff options
Diffstat (limited to 'perl-install/standalone/finish-install')
-rwxr-xr-x | perl-install/standalone/finish-install | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/perl-install/standalone/finish-install b/perl-install/standalone/finish-install index 8682a9a5f..81a2f00e5 100755 --- a/perl-install/standalone/finish-install +++ b/perl-install/standalone/finish-install @@ -75,7 +75,7 @@ sub ask_timezone() { $timezone->{timezone} = timezone::bestTimezone($locale->{country}) if $locale->{country}; any::configure_timezone($in, $timezone, 'ask_gmt', lc(get_conf('TIMEZONE')) eq 'simplified'); - $in->do_pkgs->ensure_is_installed('ntp') if $timezone->{ntp}; + $in->do_pkgs->ensure_is_installed('chrony') if $timezone->{ntp}; timezone::write($timezone); #- reload sys clock from hc once we know the real timezone @@ -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(); @@ -118,7 +126,7 @@ sub ask_network() { } sub ask_urpmi() { - #- configure urpmi media if no media are configured + #- configure urpmi media if no online media are configured my @media_url = map { top(split(' ', $_)) } run_program::get_stdout('urpmq', '--list-url'); my @online_media = grep { !m,^(?:file://)?/, } @media_url; @online_media and return; @@ -173,13 +181,24 @@ sub ask_users() { $_ .= "user $users->[0]{name}\n" if eof; } $finit_conf if -e $finit_conf; if ($old_user) { + my $new_user = $users->[0]{name}; #- replace home path in user config files my $old_home = "/home/$old_user"; - my $new_home = "/home/$users->[0]{name}"; + my $new_home = "/home/$new_user"; run_program::run(qq(grep -D skip -rl $old_home $new_home/.??* | while read f; do perl -pi -e 's,$old_home,$new_home,g' "\$f"; done)); #- give console rights for current session my $console_dir = "/var/run/console"; - cp_f($console_dir . "/" . $old_user, $console_dir . "/" . $users->[0]{name}) if -e $console_dir . "/" . $old_user; + 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; + } + } } } |