use Time::HiRes;
use POSIX ":sys_wait_h";
-use Proxmox::Install::Env;
+use Proxmox::Install::ISOEnv;
use Proxmox::Log;
-use Proxmox::Sys::Block qw(get_cached_disks);
+use Proxmox::Sys::Block qw(get_cached_disks wipe_disk partition_bootable_disk);
use Proxmox::Sys::Command qw(run_command syscmd);
use Proxmox::Sys::File qw(file_read_firstline file_read_all file_write_all);
use Proxmox::Sys::Net qw(parse_ip_address parse_ip_mask);
'test-image|t=s' => \$test_image
) or die "usage error\n";
- Proxmox::Install::Env::set_test_image($test_image) if $test_image;
+ Proxmox::Install::ISOEnv::set_test_image($test_image) if $test_image;
}
$ENV{'LVM_SUPPRESS_FD_WARNINGS'} = '1';
-my $env = Proxmox::Install::Env::setup();
+my $env = Proxmox::Install::ISOEnv::setup();
my $zfstestpool = "test_rpool";
my $zfspoolname = is_test_mode() ? $zfstestpool : 'rpool';
Proxmox::Log::init("/tmp/install.log");
-my $proxmox_libdir = is_test_mode()
- ? Cwd::cwd() . "/testdir/var/lib/proxmox-installer"
- : "/var/lib/proxmox-installer"
- ;
-my $proxmox_cddir = is_test_mode() ? "../pve-cd-builder/tmp/data-gz/" : "/cdrom";
+my $proxmox_libdir = $env->{locations}->{lib};
+my $proxmox_cddir = $env->{locations}->{iso};
my $proxmox_pkgdir = "${proxmox_cddir}/proxmox/packages/";
my $boot_type = -d '/sys/firmware/efi' ? 'efi' : 'bios';
my $keymap = 'en-us';
my $password;
my $mailto = 'mail@example.invalid';
-my $cmap;
my $autoreboot_seconds = 5;
my $config = {
_EOD
-sub detect_country {
+sub app_quit {
+ my ($exit_code) = @_;
+
+ Gtk3->main_quit() if Gtk3->main_level() > 0;
+
+ # reap left over zombie processes
+ while ((my $child = waitpid(-1, POSIX::WNOHANG)) > 0) {
+ print "reaped child $child\n";
+ }
+ exit($exit_code);
+}
+sub detect_country {
print "trying to detect country...\n";
- my $cpid = open2(\*TMP, undef, "traceroute -N 1 -q 1 -n 8.8.8.8");
+ my $cpid = open2(my $TRACEROUTE_FH, undef, "traceroute -N 1 -q 1 -n 8.8.8.8");
return undef if !$cpid;
my $country;
eval {
local $SIG{ALRM} = sub { die "timed out!\n" };
my $line;
- while (defined ($line = <TMP>)) {
+ while (defined ($line = <$TRACEROUTE_FH>)) {
log_debug("DC TRACEROUTE: $line");
if ($line =~ m/\s*\d+\s+(\d+\.\d+\.\d+\.\d+)\s/) {
my $geoip = `geoiplookup $1`;
}
}
};
-
my $err = $@;
-
alarm ($previous_alarm);
- close (TMP);
+ close($TRACEROUTE_FH);
if ($err) {
print "unable to detect country - $err\n";
my $total_memory = get_memtotal();
-sub read_cmap {
- my $countryfn = "${proxmox_libdir}/country.dat";
- open (my $TMP, "<:encoding(utf8)", "$countryfn") || die "unable to open '$countryfn' - $!\n";
- my ($country, $countryhash, $kmap, $kmaphash) = ({}, {}, {}, {});
- while (defined (my $line = <$TMP>)) {
- if ($line =~ m|^map:([^\s:]+):([^:]+):([^:]+):([^:]+):([^:]+):([^:]*):$|) {
- $kmap->{$1} = {
- name => $2,
- kvm => $3,
- console => $4,
- x11 => $5,
- x11var => $6,
- };
- $kmaphash->{$2} = $1;
- } elsif ($line =~ m|^([a-z]{2}):([^:]+):([^:]*):([^:]*):$|) {
- $country->{$1} = {
- name => $2,
- kmap => $3,
- mirror => $4,
- };
- $countryhash->{lc($2)} = $1;
- } else {
- warn "unable to parse 'country.dat' line: $line";
- }
- }
- close ($TMP);
- $TMP = undef;
-
- my $zones = {};
- my $cczones = {};
- my $zonefn = "/usr/share/zoneinfo/zone.tab";
- open ($TMP, '<', "$zonefn") || die "unable to open '$zonefn' - $!\n";
- while (defined (my $line = <$TMP>)) {
- next if $line =~ m/^\#/;
- next if $line =~ m/^\s*$/;
- if ($line =~ m|^([A-Z][A-Z])\s+\S+\s+(([^/]+)/\S+)\s|) {
- my $cc = lc($1);
- $cczones->{$cc}->{$2} = 1;
- $country->{$cc}->{zone} = $2 if !defined ($country->{$cc}->{zone});
- $zones->{$2} = 1;
-
- }
- }
- close ($TMP);
-
- return {
- zones => $zones,
- cczones => $cczones,
- country => $country,
- countryhash => $countryhash,
- kmap => $kmap,
- kmaphash => $kmaphash,
- }
-}
-
sub update_progress {
my ($frac, $start, $end, $text) = @_;
die "could not rename VG from '$vg->{pvs}' ($vg_uuid) to '$new_vgname'!\n";
}
} else {
- set_next("_Reboot", sub { exit (0); } );
+ set_next("_Reboot", sub { app_quit(0); } );
display_html("fail.htm");
die "Cancled installation by user, due to already existing volume group '$vgname'\n";
}
my $bootdevinfo = [];
- my $swapfile;
- my $rootdev;
- my $datadev;
-
- my $use_zfs = 0;
- my $use_btrfs = 0;
+ my ($swapfile, $rootdev, $datadev);
+ my ($use_zfs, $use_btrfs) = (0, 0);
my $filesys = $config_options->{filesys};
if (is_test_mode()) {
- my $test_images = Proxmox::Install::Env::get_test_images();
+ my $test_images = Proxmox::Install::ISOEnv::get_test_images();
$rootdev = abs_path($test_images->[0]); # FIXME: use all selected for test too!
syscmd("umount $rootdev");
update_progress(0, 0.02, $maxper, "create partitions");
- my $logical_bsize = logical_blocksize($target_hd);
+ my $logical_bsize = Proxmox::Sys::Block::logical_blocksize($target_hd);
my ($os_size, $osdev, $efidev) =
partition_bootable_disk($target_hd, $config_options->{hdsize}, '8E00');
file_write_all("$targetdir/etc/fstab", $fstab);
file_write_all("$targetdir/etc/mtab", "");
- syscmd("cp ${proxmox_libdir}/policy-disable-rc.d " .
- "$targetdir/usr/sbin/policy-rc.d") == 0 ||
+ syscmd("cp ${proxmox_libdir}/policy-disable-rc.d $targetdir/usr/sbin/policy-rc.d") == 0 ||
die "unable to copy policy-rc.d\n";
- syscmd("cp ${proxmox_libdir}/fake-start-stop-daemon " .
- "$targetdir/sbin/") == 0 ||
+ syscmd("cp ${proxmox_libdir}/fake-start-stop-daemon $targetdir/sbin/") == 0 ||
die "unable to copy start-stop-daemon\n";
diversion_add($targetdir, "/sbin/start-stop-daemon", "/sbin/fake-start-stop-daemon");
}
# Note: keyboard-configuration/xbkb-keymap is used by console-setup
- my $xkmap = $cmap->{kmap}->{$keymap}->{x11} // 'us';
+ my $xkmap = $env->{locales}->{kmap}->{$keymap}->{x11} // 'us';
debconfig_set ($targetdir, <<_EOD);
locales locales/default_environment_locale select en_US.UTF-8
file_write_all("$targetdir/etc/timezone", "$timezone\n");
# set apt mirror
- if (my $mirror = $cmap->{country}->{$country}->{mirror}) {
+ if (my $mirror = $env->{locales}->{country}->{$country}->{mirror}) {
my $fn = "$targetdir/etc/apt/sources.list";
syscmd("sed -i 's/ftp\\.debian\\.org/$mirror/' '$fn'");
}
push @$bootloader_err_list, $@ if $@;
}
- eval {
if (my $esp = $di->{esp}) {
- prepare_grub_efi_boot_esp($dev, $esp, $targetdir);
- }
+ eval { prepare_grub_efi_boot_esp($dev, $esp, $targetdir) };
+ push @$bootloader_err_list, $@ if $@;
}
- };
- push @$bootloader_err_list, $@ if $@;
+ }
}
syscmd("chroot $targetdir /usr/sbin/update-grub") == 0 ||
mkdir $tmpdir;
# write vnc keymap to datacenter.cfg
- my $vnckmap = $cmap->{kmap}->{$keymap}->{kvm} || 'en-us';
+ my $vnckmap = $env->{locales}->{kmap}->{$keymap}->{kvm} || 'en-us';
file_write_all("$tmpdir/datacenter.cfg", "keyboard: $vnckmap\n");
# save admin email
"extract2-rulesystem.htm",
"extract3-spam.htm",
"extract4-virus.htm",
- ];
+];
sub display_info {
$window = Gtk3::Window->new();
$window->set_default_size(1024, 768);
- $window->set_has_resize_grip(0);
+ $window->signal_connect(map => sub { $window->set_resizable(0); });
$window->fullscreen() if !is_test_mode();
$window->set_decorated(0) if !is_test_mode();
+ $window->signal_connect(destroy => sub { Gtk3->main_quit(); });
- my $vbox = Gtk3::VBox->new(0, 0);
+ my $vbox = Gtk3::Box->new('vertical', 0);
my $logofn = "$env->{product}-banner.png";
my $image = Gtk3::Image->new_from_file("${proxmox_libdir}/$logofn");
$vbox->pack_start($image, 0, 0, 0);
- my $hbox = Gtk3::HBox->new(0, 0);
+ my $hbox = Gtk3::Box->new('horizontal', 0);
$vbox->pack_start($hbox, 1, 1, 0);
# my $f1 = Gtk3::Frame->new ('test');
# $f1->set_shadow_type ('none');
# $hbox->pack_start ($f1, 1, 1, 0);
- my $sep1 = Gtk3::HSeparator->new();
+ my $sep1 = Gtk3::Separator->new('horizontal');
$vbox->pack_start($sep1, 0, 0, 0);
- $cmdbox = Gtk3::HBox->new();
+ $cmdbox = Gtk3::Box->new('horizontal', 0);
$vbox->pack_start($cmdbox, 0, 0, 10);
$next = Gtk3::Button->new('_Next');
my $abort = Gtk3::Button->new('_Abort');
$abort->set_can_focus(0);
$cmdbox->pack_start($abort, 0, 0, 10);
- $abort->signal_connect(clicked => sub { exit (-1); });
+ $abort->signal_connect(clicked => sub { app_quit(-1); });
- my $vbox2 = Gtk3::VBox->new(0, 0);
+ my $vbox2 = Gtk3::Box->new('vertical', 0);
$hbox->add($vbox2);
$htmlview = Gtk3::WebKit2::WebView->new();
+ $htmlview->set_hexpand(1);
my $scrolls = Gtk3::ScrolledWindow->new();
$scrolls->add($htmlview);
- my $hbox2 = Gtk3::HBox->new(0, 0);
+ my $hbox2 = Gtk3::Box->new('horizontal', 0);
$hbox2->pack_start($scrolls, 1, 1, 0);
$vbox2->pack_start($hbox2, 1, 1, 0);
- my $vbox3 = Gtk3::VBox->new(0, 0);
+ my $vbox3 = Gtk3::Box->new('vertical', 0);
$vbox2->pack_start($vbox3, 0, 0, 0);
- my $sep2 = Gtk3::HSeparator->new;
+ my $sep2 = Gtk3::Separator->new('horizontal');
$vbox3->pack_start($sep2, 0, 0, 0);
- $inbox = Gtk3::HBox->new(0, 0);
+ $inbox = Gtk3::Box->new('horizontal', 0);
$vbox3->pack_start($inbox, 0, 0, 0);
$window->add($vbox);
$window->show_all;
- $window->realize();
+ $window->present();
}
sub cleanup_view {
my $label = Gtk3::Label->new($text);
$label->set_size_request(150, -1);
- $label->set_alignment(1, 0.5);
+ $label->set_xalign(1.0);
$hbox->pack_start($label, 0, 0, 10);
my $e1 = Gtk3::Entry->new();
$e1->set_width_chars(35);
my $label = Gtk3::Label->new('IP Address (CIDR)');
$label->set_size_request(150, -1);
- $label->set_alignment(1, 0.5);
+ $label->set_xalign(1.0);
$hbox->pack_start($label, 0, 0, 10);
my $ip_el = Gtk3::Entry->new();
$label = Gtk3::Label->new('/');
$label->set_size_request(10, -1);
- $label->set_alignment(0.5, 0.5);
$hbox->pack_start($label, 0, 0, 2);
my $cidr_el = Gtk3::Entry->new();
$device_cb->set_active(0);
}
- my $devicebox = Gtk3::HBox->new(0, 0);
+ my $devicebox = Gtk3::Box->new('horizontal', 0);
my $label = Gtk3::Label->new("Management Interface:");
$label->set_size_request(150, -1);
- $label->set_alignment(1, 0.5);
+ $label->set_xalign(1.0);
$devicebox->pack_start($label, 0, 0, 10);
$devicebox->pack_start($device_cb, 0, 0, 0);
cleanup_view();
- my $vbox = Gtk3::VBox->new(0, 0);
+ my $vbox = Gtk3::Box->new('vertical', 0);
$inbox->pack_start($vbox, 1, 0, 0);
my $reboot_checkbox = Gtk3::CheckButton->new('Automatically reboot after successful installation');
my %config_values = (
__target_hd__ => join(' | ', @{$config_options->{target_hds}}),
__target_fs__ => $config_options->{filesys},
- __country__ => $cmap->{country}->{$country}->{name},
+ __country__ => $env->{locales}->{country}->{$country}->{name},
__timezone__ => $timezone,
__keymap__ => $keymap,
__mailto__ => $mailto,
my $ind;
my $def;
my $i = 0;
- my $kmaphash = $cmap->{kmaphash};
+ my $kmaphash = $env->{locales}->{kmaphash};
foreach my $layout (sort keys %$kmaphash) {
$def = $i if $kmaphash->{$layout} eq 'en-us';
$ind = $i if $kmap && $kmaphash->{$layout} eq $kmap;
sub update_zonelist {
my ($box, $cc) = @_;
- my $cczones = $cmap->{cczones};
- my $zones = $cmap->{zones};
-
- my $sel;
+ my $sel = $timezone; # initial default
if ($lastzonecb) {
$sel = $lastzonecb->get_active_text();
- $box->remove ($lastzonecb);
- } else {
- $sel = $timezone; # used once to select default
+ $box->remove($lastzonecb);
}
my $cb = $lastzonecb = Gtk3::ComboBoxText->new();
$cb->set_size_request(200, -1);
-
$cb->signal_connect('changed' => sub {
$timezone = $cb->get_active_text();
});
- my @za;
- if ($cc && defined ($cczones->{$cc})) {
- @za = keys %{$cczones->{$cc}};
- } else {
- @za = keys %$zones;
- }
- my $ind;
- my $i = 0;
- foreach my $zone (sort @za) {
- $ind = $i if $sel && $zone eq $sel;
+ my ($cczones, $zones) = $env->{locales}->@{'cczones', 'zones'};
+ my @available_zones = $cc && defined($cczones->{$cc}) ? keys %{$cczones->{$cc}} : keys %$zones;
+
+ my ($i, $selected_index) = (0, undef);
+ for my $zone (sort @available_zones) {
+ $selected_index = $i if $sel && $zone eq $sel;
$cb->append_text($zone);
$i++;
}
# Append UTC here, so it is always the last item and never the default for any country.
$cb->append_text('UTC');
- $cb->set_active($ind || 0);
+ $cb->set_active($selected_index || 0);
$cb->show;
$box->pack_start($cb, 0, 0, 0);
cleanup_view();
- my $vbox2 = Gtk3::VBox->new(0, 0);
+ my $vbox2 = Gtk3::Box->new('vertical', 0);
$inbox->pack_start($vbox2, 1, 0, 0);
- my $vbox = Gtk3::VBox->new(0, 0);
+ my $vbox = Gtk3::Box->new('vertical', 0);
$vbox2->pack_start($vbox, 0, 0, 10);
- my $hbox1 = Gtk3::HBox->new(0, 0);
+ my $hbox1 = Gtk3::Box->new('horizontal', 0);
my $label = Gtk3::Label->new("Password");
$label->set_size_request(150, -1);
- $label->set_alignment(1, 0.5);
+ $label->set_xalign(1.0);
$hbox1->pack_start($label, 0, 0, 10);
my $pwe1 = Gtk3::Entry->new();
$pwe1->set_visibility(0);
$pwe1->set_size_request(200, -1);
$hbox1->pack_start($pwe1, 0, 0, 0);
- my $hbox2 = Gtk3::HBox->new(0, 0);
+ my $hbox2 = Gtk3::Box->new('horizontal', 0);
$label = Gtk3::Label->new("Confirm");
$label->set_size_request(150, -1);
- $label->set_alignment(1, 0.5);
+ $label->set_xalign(1.0);
$hbox2->pack_start($label, 0, 0, 10);
my $pwe2 = Gtk3::Entry->new();
$pwe2->set_visibility(0);
$pwe2->set_size_request(200, -1);
$hbox2->pack_start($pwe2, 0, 0, 0);
- my $hbox3 = Gtk3::HBox->new(0, 0);
+ my $hbox3 = Gtk3::Box->new('horizontal', 0);
$label = Gtk3::Label->new("Email");
$label->set_size_request(150, -1);
- $label->set_alignment(1, 0.5);
+ $label->set_xalign(1.0);
$hbox3->pack_start($label, 0, 0, 10);
my $eme = Gtk3::Entry->new();
$eme->set_size_request(200, -1);
cleanup_view();
- my $countryhash = $cmap->{countryhash};
- my $ctr = $cmap->{country};
+ my $locales = $env->{locales};
- my $vbox2 = Gtk3::VBox->new(0, 0);
+ my $vbox2 = Gtk3::Box->new('vertical', 0);
$inbox->pack_start($vbox2, 1, 0, 0);
- my $vbox = Gtk3::VBox->new(0, 0);
+ my $vbox = Gtk3::Box->new('vertical', 0);
$vbox2->pack_start($vbox, 0, 0, 10);
my $w = Gtk3::Entry->new();
$c->set_popup_set_width(1);
$c->set_inline_completion(1);
- my $hbox2 = Gtk3::HBox->new(0, 0);
+ my $hbox2 = Gtk3::Box->new('horizontal', 0);
my $label = Gtk3::Label->new("Time zone");
$label->set_size_request(150, -1);
- $label->set_alignment(1, 0.5);
+ $label->set_xalign(1.0);
$hbox2->pack_start($label, 0, 0, 10);
update_zonelist ($hbox2);
- my $hbox3 = Gtk3::HBox->new(0, 0);
+ my $hbox3 = Gtk3::Box->new('horizontal', 0);
$label = Gtk3::Label->new("Keyboard Layout");
$label->set_size_request(150, -1);
- $label->set_alignment(1, 0.5);
+ $label->set_xalign(1.0);
$hbox3->pack_start($label, 0, 0, 10);
my $kmapcb = Gtk3::ComboBoxText->new();
$kmapcb->set_size_request (200, -1);
- foreach my $layout (sort keys %{$cmap->{kmaphash}}) {
- $kmapcb->append_text ($layout);
+ for my $layout (sort keys %{$locales->{kmaphash}}) {
+ $kmapcb->append_text($layout);
}
update_layout($kmapcb);
$kmapcb->signal_connect ('changed' => sub {
my $sel = $kmapcb->get_active_text();
$last_layout = $kmapcb->get_active();
- if (my $kmap = $cmap->{kmaphash}->{$sel}) {
- my $xkmap = $cmap->{kmap}->{$kmap}->{x11};
- my $xvar = $cmap->{kmap}->{$kmap}->{x11var};
+ if (my $kmap = $locales->{kmaphash}->{$sel}) {
+ my $xkmap = $locales->{kmap}->{$kmap}->{x11};
+ my $xvar = $locales->{kmap}->{$kmap}->{x11var};
$keymap = $kmap;
return if (defined($installer_kmap) && $installer_kmap eq $kmap);
my ($entry, $event) = @_;
my $text = $entry->get_text;
- if (my $cc = $countryhash->{lc($text)}) {
+ if (my $cc = $locales->{countryhash}->{lc($text)}) {
update_zonelist($hbox2, $cc);
- my $kmap = $ctr->{$cc}->{kmap} || 'en-us';
+ my $kmap = $locales->{country}->{$cc}->{kmap} || 'en-us';
update_layout($kmapcb, $kmap);
}
});
my $val = $event->get_keyval;
if ($val == Gtk3::Gdk::KEY_Tab) {
- my $cc = $countryhash->{lc($text)};
+ my $cc = $locales->{countryhash}->{lc($text)};
my $found = 0;
my $compl;
if ($cc) {
$found = 1;
- $compl = $ctr->{$cc}->{name};
+ $compl = $locales->{country}->{$cc}->{name};
} else {
- foreach my $cc (keys %$ctr) {
- my $ct = $ctr->{$cc}->{name};
- if ($ct =~ m/^\Q$text\E.*$/i) {
+ for my $country (values $locales->{country}->%*) {
+ if ($country->{name} =~ m/^\Q$text\E.*$/i) {
$found++;
- $compl = $ct;
+ $compl = $country->{name};
}
last if $found > 1;
}
return undef;
});
- my $ls = Gtk3::ListStore->new('Glib::String');
- foreach my $cc (sort {$ctr->{$a}->{name} cmp $ctr->{$b}->{name} } keys %$ctr) {
- my $iter = $ls->append();
- $ls->set ($iter, 0, $ctr->{$cc}->{name});
+ my $country_store = Gtk3::ListStore->new('Glib::String');
+ my $countries = $locales->{country};
+ for my $cc (sort { $countries->{$a}->{name} cmp $countries->{$b}->{name} } keys %$countries) {
+ my $iter = $country_store->append();
+ $country_store->set($iter, 0, $countries->{$cc}->{name});
}
- $c->set_model ($ls);
+ $c->set_model($country_store);
$w->set_completion ($c);
- my $hbox = Gtk3::HBox->new(0, 0);
+ my $hbox = Gtk3::Box->new('horizontal', 0);
$label = Gtk3::Label->new("Country");
- $label->set_alignment(1, 0.5);
+ $label->set_xalign(1.0);
$label->set_size_request(150, -1);
$hbox->pack_start($label, 0, 0, 10);
$hbox->pack_start($w, 0, 0, 0);
$vbox->pack_start($hbox2, 0, 0, 5);
$vbox->pack_start($hbox3, 0, 0, 5);
- if ($country && $ctr->{$country}) {
- $w->set_text ($ctr->{$country}->{name});
+ if ($country && (my $entry = $locales->{country}->{$country})) {
+ $w->set_text($entry->{name});
}
$inbox->show_all;
my $text = $w->get_text;
- if (my $cc = $countryhash->{lc($text)}) {
+ if (my $cc = $locales->{countryhash}->{lc($text)}) {
$country = $cc;
$step_number++;
create_password_view();
my $widget = @$labeled_widgets[$i+1];
my $label = Gtk3::Label->new(@$labeled_widgets[$i]);
$label->set_visible(1);
- $label->set_alignment (1, 0.5);
+ $label->set_xalign(1.0);
$grid->attach($label, 0, $row, 1, 1);
$widget->set_visible(1);
$grid->attach($widget, 1, $row, 1, 1);
# Filesystem type
my $label0 = Gtk3::Label->new("Filesystem");
- $label0->set_alignment (1, 0.5);
+ $label0->set_xalign(1.0);
$grid->attach($label0, 0, $row, 1, 1);
my $fstypecb = Gtk3::ComboBoxText->new();
$row++;
- my $sep = Gtk3::HSeparator->new();
+ my $sep = Gtk3::Separator->new('horizontal');
$sep->set_visible(1);
$grid->attach($sep, 0, $row, 2, 1);
$row++;
# size compute
my $hdsize = 0;
if ( -b $target_hd) {
- $hdsize = int(hd_size($target_hd) / (1024 * 1024.0)); # size in GB
+ $hdsize = int(Proxmox::Sys::Block::hd_size($target_hd) / (1024 * 1024.0)); # size in GB
} elsif ($target_hd) {
$hdsize = int((-s $target_hd) / (1024 * 1024 * 1024.0));
}
&$switch_view();
});
- my $sep2 = Gtk3::HSeparator->new();
+ my $sep2 = Gtk3::Separator->new('horizontal');
$sep2->set_visible(1);
$contarea->pack_end($sep2, 1, 1, 10);
sub legacy_bios_4k_check {
my ($lbs) = @_;
die "Booting from 4kn drive in legacy BIOS mode is not supported.\n"
- if (($boot_type ne 'efi') && ($lbs == 4096));
+ if $boot_type ne 'efi' && $lbs == 4096;
}
sub get_zfs_raid_setup {
cleanup_view();
- my $vbox = Gtk3::VBox->new(0, 0);
+ my $vbox = Gtk3::Box->new('vertical', 0);
$inbox->pack_start($vbox, 1, 0, 0);
- my $hbox = Gtk3::HBox->new(0, 0);
+ my $hbox = Gtk3::Box->new('horizontal', 0);
$vbox->pack_start($hbox, 0, 0, 10);
my $cached_disks = get_cached_disks();
$prev_btn->set_sensitive(0);
$prev_btn->hide();
- my $vbox = Gtk3::VBox->new(0, 0);
+ my $vbox = Gtk3::Box->new('vertical', 0);
$inbox->pack_start ($vbox, 1, 0, 0);
- my $hbox = Gtk3::HBox->new(0, 0);
+ my $hbox = Gtk3::Box->new('horizontal', 0);
$vbox->pack_start ($hbox, 0, 0, 10);
- my $vbox2 = Gtk3::VBox->new(0, 0);
+ my $vbox2 = Gtk3::Box->new('vertical', 0);
$hbox->pack_start ($vbox2, 0, 0, 0);
$progress_status = Gtk3::Label->new('');
$next->set_sensitive(1);
- set_next("_Reboot", sub { exit (0); } );
+ set_next("_Reboot", sub { app_quit(0); } );
if ($err) {
display_html("fail.htm");
$autoreboot_seconds--;
display_html("success.htm");
} else {
- exit(0);
+ app_quit(0);
}
});
}
$country = detect_country() if $ipconf->{default} || is_test_mode();
-# read country, kmap and timezone infos
-$cmap = read_cmap();
-
-if (!defined($cmap->{country}->{$country})) {
+if (!defined($env->{locales}->{country}->{$country})) {
log_warn("ignoring detected country '$country', invalid or unknown\n");
$country = undef;
}
print "no harddisks found\n";
$initial_error = 1;
display_html("nohds.htm");
- set_next("Reboot", sub { exit(0); } );
+ set_next("Reboot", sub { app_quit(0); } );
} else {
foreach my $hd (@$cached_disks) {
my ($disk, $devname) = @$hd;
print "no network interfaces found\n";
$initial_error = 1;
display_html("nonics.htm");
- set_next("Reboot", sub { exit(0); } );
+ set_next("Reboot", sub { app_quit(0); } );
}
create_intro_view () if !$initial_error;
Gtk3->main;
-# reap left over zombie processes
-while ((my $child = waitpid(-1, POSIX::WNOHANG)) > 0) {
- print "reaped child $child\n";
-}
-
-exit 0;
+app_quit(0);