summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/XFdrake4
-rwxr-xr-xperl-install/standalone/adduserdrake14
-rwxr-xr-xperl-install/standalone/autosetupprintqueues51
-rwxr-xr-xperl-install/standalone/bootloader-config57
-rwxr-xr-xperl-install/standalone/diskdrake12
-rwxr-xr-xperl-install/standalone/drakTermServ449
-rwxr-xr-xperl-install/standalone/drakauth9
-rwxr-xr-xperl-install/standalone/drakautoinst66
-rwxr-xr-xperl-install/standalone/drakbackup1166
-rwxr-xr-xperl-install/standalone/drakboot131
-rwxr-xr-xperl-install/standalone/drakbug301
-rwxr-xr-xperl-install/standalone/drakbug_report1
-rwxr-xr-xperl-install/standalone/drakclock65
-rwxr-xr-xperl-install/standalone/drakconnect345
-rw-r--r--perl-install/standalone/drakedm16
-rwxr-xr-xperl-install/standalone/drakfirewall2
-rwxr-xr-xperl-install/standalone/drakfloppy27
-rwxr-xr-xperl-install/standalone/drakfont14
-rwxr-xr-xperl-install/standalone/drakgw12
-rw-r--r--perl-install/standalone/drakhelp11
-rwxr-xr-xperl-install/standalone/drakperm66
-rwxr-xr-xperl-install/standalone/drakproxy1
-rwxr-xr-xperl-install/standalone/drakpxe12
-rwxr-xr-xperl-install/standalone/drakroam397
-rwxr-xr-xperl-install/standalone/draksec139
-rwxr-xr-xperl-install/standalone/draksound24
-rwxr-xr-xperl-install/standalone/draksplash97
-rw-r--r--perl-install/standalone/draksplash2351
-rwxr-xr-xperl-install/standalone/drakupdate_fstab80
-rwxr-xr-xperl-install/standalone/drakups79
-rw-r--r--perl-install/standalone/drakvpn82
-rwxr-xr-xperl-install/standalone/drakxservices1
-rwxr-xr-xperl-install/standalone/drakxtv23
-rwxr-xr-xperl-install/standalone/finish-install134
-rwxr-xr-xperl-install/standalone/finish-install.xsetup16
-rwxr-xr-xperl-install/standalone/harddrake232
-rw-r--r--perl-install/standalone/icons/harddrake2/ups.pngbin0 -> 699 bytes
-rwxr-xr-xperl-install/standalone/keyboarddrake1
-rwxr-xr-xperl-install/standalone/listsupportedprinters64
-rw-r--r--perl-install/standalone/localedrake32
-rwxr-xr-xperl-install/standalone/logdrake110
-rw-r--r--perl-install/standalone/man/C/man8/drakconnect.8109
-rwxr-xr-xperl-install/standalone/mousedrake11
-rw-r--r--perl-install/standalone/net_applet106
-rwxr-xr-xperl-install/standalone/net_monitor116
-rwxr-xr-xperl-install/standalone/printerdrake110
-rwxr-xr-xperl-install/standalone/scannerdrake22
-rwxr-xr-xperl-install/standalone/service_harddrake103
-rw-r--r--perl-install/standalone/service_harddrake.sh1
-rw-r--r--perl-install/standalone/service_harddrake_confirm2
50 files changed, 3170 insertions, 1904 deletions
diff --git a/perl-install/standalone/XFdrake b/perl-install/standalone/XFdrake
index 334f18972..ee5fda955 100755
--- a/perl-install/standalone/XFdrake
+++ b/perl-install/standalone/XFdrake
@@ -39,8 +39,6 @@ $configure_this ||= 'everything';
{
my $in = 'interactive'->vnew('su');
- modules::mergein_conf();
-
my $rc = do {
my $options = { allowFB => listlength(cat_("/proc/fb")) };
@@ -71,7 +69,7 @@ sub check_XFree {
my $f = "/usr/X11R6/lib/X11/rgb.txt"; #- this one is on all platform
-e $f or $in->do_pkgs->install('xorg-x11', 'xorg-x11-75dpi-fonts');
- -e $f or die "install XFree86 first!\n";
+ -e $f or die "install Xorg first!\n";
system("mount /proc 2>/dev/null"); # ensure /proc is mounted for pci probing
}
diff --git a/perl-install/standalone/adduserdrake b/perl-install/standalone/adduserdrake
index 40659017f..a2d380766 100755
--- a/perl-install/standalone/adduserdrake
+++ b/perl-install/standalone/adduserdrake
@@ -6,12 +6,10 @@ use standalone; #- warning, standalone must be loaded very first, for 'expla
use common;
use interactive;
+use security::level;
+use authentication;
use any;
-my $isMD5 = cat_("/etc/pam.d/system-auth") =~ /md5/;
-my $isShadow = cat_("/etc/pam.d/system-auth") =~ /shadow/;
-
-
my $users = [];
my $in;
@@ -19,13 +17,9 @@ if (my @l = grep { ! /^-/ } @ARGV) {
$users = [ map { { name => $_, realname => $_ } } @l ];
} else {
$in = 'interactive'->vnew('su');
- any::ask_users($in, $users, $ENV{SECURE_LEVEL}, []);
+ any::ask_users($in, $users, security::level::get(), []);
}
-system("adduser", $_->{name}) foreach @$users;
-any::write_passwd_user($_, $isMD5) foreach @$users;
-system("pwconv") if $isShadow;
-
-any::addUsers($users);
+any::add_users($users, authentication::get());
$in->exit(0) if $in;
diff --git a/perl-install/standalone/autosetupprintqueues b/perl-install/standalone/autosetupprintqueues
new file mode 100755
index 000000000..85a688af5
--- /dev/null
+++ b/perl-install/standalone/autosetupprintqueues
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2003-2004 Mandrakesoft
+#
+# Till Kamppeter <till@mandrakesoft.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License Version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+use strict;
+use lib qw(/usr/lib/libDrakX);
+use standalone;
+use printer::printerdrake;
+use printer::main;
+
+# Data structure for printer data
+my $printer;
+
+# Dummy variable needed to call the subroutines of the printerdrak.pm module
+# The real data structure is not needed for non-interactive mode
+my $in;
+
+# Run the subroutines of printerdrake.pm in non-interactive non-X mode
+$::noX = 1;
+
+# Do not let printerdrake ask for the spooler
+$printer->{SPOOLER} ||= 'cups';
+
+# Were we in expert mode last time?
+$printer->{expert} = printer::main::get_usermode();
+
+# Do not auto-install queues in expert mode
+exit 0 if $printer->{expert};
+
+# Get info about already installed print queues
+eval { $printer = printer::main::getinfo('') };
+
+# Run the automatic, non-interactive print queue setup of printerdrake
+printer::printerdrake::init($printer, $in);
+
diff --git a/perl-install/standalone/bootloader-config b/perl-install/standalone/bootloader-config
index 56245dcd3..e80133fde 100755
--- a/perl-install/standalone/bootloader-config
+++ b/perl-install/standalone/bootloader-config
@@ -26,14 +26,14 @@ my %options = (
);
GetOptions(%options) or die <<'EOF';
-usage: Releve --action add-kernel (--image <vmlinuz> | --kernel-version <2.6.xxx>) [--label <...>] [--no-short-name] [--initrd-options <options>]
- Releve --action remove-kernel (--image <vmlinuz> | --kernel-version <2.6.xxx>)
+usage: bootloader-config --action add-kernel (--image <vmlinuz> | --kernel-version <2.6.xxx>) [--label <...>] [--no-short-name] [--initrd-options <options>]
+ bootloader-config --action remove-kernel (--image <vmlinuz> | --kernel-version <2.6.xxx>)
- Releve --action add-entry (--image <image> | --chainload <device>) --label <...>
- Releve --action remove-entry (--image <image> | --chainload <device> | --label <...>)
+ bootloader-config --action add-entry (--image <image> | --chainload <device>) --label <...>
+ bootloader-config --action remove-entry (--image <image> | --chainload <device> | --label <...>)
- Releve --action update-splash
- Releve --action remove-splash
+ bootloader-config --action update-splash
+ bootloader-config --action remove-splash
EOF
my @known_actions = qw(add-kernel remove-kernel update-splash remove-splash detectloader add-entry remove-entry);
@@ -54,10 +54,9 @@ if ($image) {
my $all_hds = fsedit::get_hds();
-fs::get_info_from_fstab($all_hds, '');
-my $hds = $all_hds->{hds};
+fs::get_info_from_fstab($all_hds);
-my $bootloader = bootloader::read([ fsedit::get_fstab(@$hds) ]) or die "Cannot find a boot loader installed\n";
+my $bootloader = bootloader::read([ fs::get::fstab($all_hds) ]) or die "Cannot find a boot loader installed\n";
$action =~ s/-/_/g;
@@ -76,19 +75,37 @@ sub remove_kernel() {
unlink "/lib/modules/$kernel_version/build";
remove_now_broken_boot_symlinks();
+ my %proposed_labels;
+ my @new_entries;
my ($to_remove, $to_keep) = partition {
- $_->{kernel_or_dev} && $_->{kernel_or_dev} eq $image;
+ if ($_->{kernel_or_dev} && $_->{kernel_or_dev} eq $image) {
+ 1;
+ } else {
+ my $vmlinuz = $_->{kernel_or_dev} && bootloader::expand_vmlinuz_symlink($_->{kernel_or_dev});
+ if ($vmlinuz && "/boot/$vmlinuz" eq $image) {
+ if (!%proposed_labels) {
+ %proposed_labels = bootloader::get_kernels_and_labels_before_kernel_remove($vmlinuz);
+ }
+ if (my $proposed = $proposed_labels{$_->{label}}) {
+ my %to_add = %$_;
+ put_in_hash(\%to_add, $proposed);
+ push @new_entries, \%to_add;
+ }
+ 1;
+ } else {
+ 0;
+ }
+ }
} @{$bootloader->{entries}};
$_->{initrd} && unlink $_->{initrd} foreach @$to_remove;
-# foreach (@$to_keep) {
-# $_->{kernel_or_dev} && bootloader::expand_vmlinuz_symlink($_->{kernel_or_dev}) eq $image or next;
-# }
-
@{$bootloader->{entries}} = @$to_keep;
+ foreach (@new_entries) {
+ bootloader::add_kernel($bootloader, $_, {});
+ }
modify_bootloader();
}
@@ -98,9 +115,9 @@ sub remove_kernel() {
sub add_kernel() {
bootloader::create_link_source();
- my $kernel_str = bootloader::vmlinuz2kernel_str($image);
+ my $kernel_str = bootloader::vmlinuz2kernel_str($image) or die "bad kernel name $image\n";
- my $root_part = fsedit::get_root([ fsedit::get_fstab(@$hds) ]);
+ my $root_part = fs::get::root([ fs::get::fstab($all_hds) ]) or die "can't find root partition\n";
my %opts = (
root => "/dev/$root_part->{device}",
initrd_options => $initrd_options,
@@ -120,8 +137,8 @@ sub add_kernel() {
sub modify_bootloader() {
!$no_entry or return;
- bootloader::action($bootloader, 'write', $hds);
- bootloader::action($bootloader, 'when_config_changed', $hds) if !$no_launch;
+ bootloader::action($bootloader, 'write', $all_hds);
+ bootloader::action($bootloader, 'when_config_changed') if !$no_launch;
}
#-###############################################################################
@@ -156,14 +173,14 @@ sub update_splash() {
foreach (@{$bootloader->{entries}}) {
bootloader::add_boot_splash($_->{initrd}, $_->{vga}) if $_->{initrd};
}
- bootloader::action($bootloader, 'when_config_changed', $hds) if !$no_launch;
+ bootloader::action($bootloader, 'when_config_changed') if !$no_launch;
}
sub remove_splash() {
foreach (@{$bootloader->{entries}}) {
bootloader::remove_boot_splash($_->{initrd}) if $_->{initrd};
}
- bootloader::action($bootloader, 'when_config_changed', $hds) if !$no_launch;
+ bootloader::action($bootloader, 'when_config_changed') if !$no_launch;
}
sub detectloader() {
diff --git a/perl-install/standalone/diskdrake b/perl-install/standalone/diskdrake
index f8fbda251..77d30bedc 100755
--- a/perl-install/standalone/diskdrake
+++ b/perl-install/standalone/diskdrake
@@ -34,6 +34,8 @@ use fs;
use log;
use c;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/diskdrake_hd.png";
+
my %options;
my @l = @ARGV;
while (my $e = shift @l) {
@@ -73,13 +75,13 @@ my $all_hds = fsedit::get_hds({}, $in);
fs::get_raw_hds('', $all_hds);
-fs::get_info_from_fstab($all_hds, '');
-fs::merge_info_from_mtab([ fsedit::get_really_all_fstab($all_hds) ]);
+fs::get_info_from_fstab($all_hds);
+fs::merge_info_from_mtab([ fs::get::really_all_fstab($all_hds) ]);
$all_hds->{current_fstab} = fs::fstab_to_string($all_hds, '');
if ($type eq 'list-hd') {
- print partition_table::description($_), "\n" foreach fsedit::get_all_fstab($all_hds);
+ print partition_table::description($_), "\n" foreach fs::get::fstab($all_hds);
} elsif ($type eq 'change-geometry') {
$para =~ s|^/dev/||;
my ($device, undef, $heads, $sectors) = $para =~ /(.+)=(\d+,)?(\d+),(\d+)$/ or die "usage: diskdrake --change-geometry=<device>=[<cylinders>,]<heads>,<sectors>\n";
@@ -100,13 +102,13 @@ if ($type eq 'list-hd') {
if (!$raw_hd->{mntpoint}) {
my $mntpoint = detect_devices::suggest_mount_point($raw_hd);
- $raw_hd->{mntpoint} ||= find { !fsedit::has_mntpoint($_, $all_hds) } map { "/mnt/$mntpoint$_" } '', 2 .. 10;
+ $raw_hd->{mntpoint} ||= find { !fs::get::has_mntpoint($_, $all_hds) } map { "/mnt/$mntpoint$_" } '', 2 .. 10;
$raw_hd->{is_removable} = 1; #- force removable flag
my $useSupermount = 'magicdev';
require security::level;
require lang;
- fs::set_default_options($raw_hd,
+ fs::mount_options::set_default($raw_hd,
useSupermount => $useSupermount,
security => security::level::get(),
lang::fs_options(lang::read()));
diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ
index c97193c03..e840fd094 100755
--- a/perl-install/standalone/drakTermServ
+++ b/perl-install/standalone/drakTermServ
@@ -54,6 +54,7 @@ $conf{ALLOW_THIN} = 0;
my $nfs_subnet;
my $nfs_mask;
my $cfg_dir = "/etc/drakxtools/draktermserv/";
+-e $cfg_dir or mkdir_p($cfg_dir);
my $cfg_file = $cfg_dir . "draktermserv.conf";
my $interface = get_net_interface();
my $server_ip = get_ip_from_sys();
@@ -61,6 +62,7 @@ my $changes_made = 0;
my $client_cfg = "/etc/dhcpd.conf.etherboot.clients";
my $tftpboot = "/var/lib/tftpboot";
my @kernels = bootloader::installed_vmlinuz();
+my $cmd_line = 1;
#- make sure terminal server and friends are installed
my $ts = system("rpm -q terminal-server > /dev/null");
@@ -78,67 +80,57 @@ if ($ts == 256) {
}
if ("@ARGV" =~ /--enable/) {
- my $cmd_line = 1;
- enable_ts($cmd_line);
+ enable_ts();
exit(0);
}
if ("@ARGV" =~ /--disable/) {
- my $cmd_line = 1;
- disable_ts($cmd_line);
+ disable_ts();
exit(0);
}
if ("@ARGV" =~ /--restart/) {
- my $cmd_line = 1;
- stop_ts($cmd_line);
- start_ts($cmd_line);
+ stop_ts();
+ start_ts();
exit(0);
}
if ("@ARGV" =~ /--start/) {
- my $cmd_line = 1;
- start_ts($cmd_line);
+ start_ts();
exit(0);
}
if ("@ARGV" =~ /--stop/) {
- my $cmd_line = 1;
- stop_ts($cmd_line);
+ stop_ts();
exit(0);
}
if ("@ARGV" =~ /--adduser/) {
die N("%s: %s requires a username...\n", $0, $ARGV[0]) if $#ARGV < 1;
- my $cmd_line = 1;
- adduser($cmd_line, $ARGV[1]);
+ adduser($ARGV[1]);
exit(0);
}
if ("@ARGV" =~ /--deluser/) {
die N("%s: %s requires a username...\n", $0, $ARGV[0]) if $#ARGV < 1;
- my $cmd_line = 1;
- deluser($cmd_line, $ARGV[1]);
+ deluser($ARGV[1]);
exit(0);
}
if ("@ARGV" =~ /--syncusers/) {
- my $cmd_line = 1;
- sync_users($cmd_line);
+ sync_users();
exit(0);
}
if ("@ARGV" =~ /--addclient/) {
die N("%s: %s requires hostname, MAC address, IP, nbi-image, 0/1 for THIN_CLIENT, 0/1 for Local Config...\n", $0, $ARGV[0]) if $#ARGV < 6;
- my $cmd_line = 1;
- addclient($cmd_line, @ARGV[1..6]);
+ addclient(@ARGV[1..6]);
exit(0);
}
if ("@ARGV" =~ /--delclient/) {
die N("%s: %s requires hostname...\n", $0, $ARGV[0]) if $#ARGV < 1;
- my $cmd_line = 1;
- delclient($cmd_line, $ARGV[1]);
+ delclient($ARGV[1]);
exit(0);
}
@@ -199,27 +191,15 @@ x:5:respawn:/usr/X11R6/bin/X -ac -query $server_ip\n";
output_p($inittab_file, $inittab);
}
-sub cursor_wait() {
- # turn the cursor to a watch
- $window1->{rwindow}->window->set_cursor(new Gtk2::Gdk::Cursor("GDK_WATCH"));
- gtkflush();
-}
-
-sub cursor_norm() {
- # restore normal cursor
- $window1->{rwindow}->window->set_cursor(new Gtk2::Gdk::Cursor("GDK_LEFT_PTR"));
- gtkflush();
-}
-
sub display_error {
my ($message) = @_;
my $error_box;
destroy_widget();
gtkpack($status_box,
- $error_box = gtkpack_(new Gtk2::VBox(0,0),
- 1, new Gtk2::Label($message),
- 0, gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'spread'),
- gtksignal_connect(new Gtk2::Button(N("OK")), clicked => sub {
+ $error_box = gtkpack_(Gtk2::VBox->new(0,0),
+ 1, Gtk2::Label->new($message),
+ 0, gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'spread'),
+ gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub {
destroy_widget();
}),
),
@@ -229,6 +209,7 @@ sub display_error {
}
sub interactive_mode() {
+ $cmd_line = 0;
$in = 'interactive'->vnew;
$::Wizard_title = N("Terminal Server Configuration");
$::Wizard_pix_up = "ic82-network-40.png";
@@ -238,75 +219,75 @@ sub interactive_mode() {
$window1->{rwindow}->set_border_width(5);
gtkadd($window1->{window},
- gtkpack_(gtkset_size_request(new Gtk2::VBox(0,2), 620, 400),
- 1, gtkpack_(new Gtk2::HBox(0,2),
- 1, gtkpack_(new Gtk2::VBox(0,2),
- 1, gtkpack($status_box = new Gtk2::VBox(0,5),
- $main_box = new Gtk2::VBox(0,10),
+ gtkpack_(gtkset_size_request(Gtk2::VBox->new(0,2), 620, 400),
+ 1, gtkpack_(Gtk2::HBox->new(0,2),
+ 1, gtkpack_(Gtk2::VBox->new(0,2),
+ 1, gtkpack($status_box = Gtk2::VBox->new(0,5),
+ $main_box = Gtk2::VBox->new(0,10),
),
- 0, $wizard_buttons = gtkpack_(new Gtk2::HBox(1,2)),
- 0, gtkpack_($main_buttons = new Gtk2::VBox(0,2),
- 1, gtkpack_(new Gtk2::HBox(1,2),
- 1, gtkpack_(new Gtk2::VBox(1,0),
- 1, gtksignal_connect(new Gtk2::Button(N("Enable Server")), clicked => sub {
+ 0, $wizard_buttons = gtkpack_(Gtk2::HBox->new(1,2)),
+ 0, gtkpack_($main_buttons = Gtk2::VBox->new(0,2),
+ 1, gtkpack_(Gtk2::HBox->new(1,2),
+ 1, gtkpack_(Gtk2::VBox->new(1,0),
+ 1, gtksignal_connect(Gtk2::Button->new(N("Enable Server")), clicked => sub {
destroy_widget();
- cursor_wait();
+ gtkset_mousecursor_wait();
enable_ts();
- cursor_norm();
+ gtkset_mousecursor_normal();
}),
- 1, gtksignal_connect(new Gtk2::Button(N("Disable Server")), clicked => sub {
+ 1, gtksignal_connect(Gtk2::Button->new(N("Disable Server")), clicked => sub {
destroy_widget();
- cursor_wait();
+ gtkset_mousecursor_wait();
disable_ts();
- cursor_norm();
+ gtkset_mousecursor_normal();
}),
),
- 1, gtkpack_(new Gtk2::VBox(1,0),
- 1, gtksignal_connect(new Gtk2::Button(N("Start Server")), clicked => sub {
+ 1, gtkpack_(Gtk2::VBox->new(1,0),
+ 1, gtksignal_connect(Gtk2::Button->new(N("Start Server")), clicked => sub {
destroy_widget();
- cursor_wait();
+ gtkset_mousecursor_wait();
start_ts();
- cursor_norm();
+ gtkset_mousecursor_normal();
}),
- 1, gtksignal_connect(new Gtk2::Button(N("Stop Server")), clicked => sub {
+ 1, gtksignal_connect(Gtk2::Button->new(N("Stop Server")), clicked => sub {
destroy_widget();
- cursor_wait();
+ gtkset_mousecursor_wait();
stop_ts();
- cursor_norm();
+ gtkset_mousecursor_normal();
}),
),
- 1, gtkpack_(new Gtk2::VBox(1,0),
- 1, gtksignal_connect(new Gtk2::Button(N("Etherboot Floppy/ISO")), clicked => sub {
+ 1, gtkpack_(Gtk2::VBox->new(1,0),
+ 1, gtksignal_connect(Gtk2::Button->new(N("Etherboot Floppy/ISO")), clicked => sub {
destroy_widget();
make_boot();
}),
- 1, gtksignal_connect(new Gtk2::Button(N("Net Boot Images")), clicked => sub {
+ 1, gtksignal_connect(Gtk2::Button->new(N("Net Boot Images")), clicked => sub {
destroy_widget();
make_nbi();
}),
),
- 1, gtkpack_(new Gtk2::VBox(1,0),
- 1, gtksignal_connect(new Gtk2::Button(N("Add/Del Users")), clicked => sub {
+ 1, gtkpack_(Gtk2::VBox->new(1,0),
+ 1, gtksignal_connect(Gtk2::Button->new(N("Add/Del Users")), clicked => sub {
destroy_widget();
maintain_users();
}),
- 1, gtksignal_connect(new Gtk2::Button(N("Add/Del Clients")), clicked => sub {
+ 1, gtksignal_connect(Gtk2::Button->new(N("Add/Del Clients")), clicked => sub {
destroy_widget();
maintain_clients()
}),
),
),
- 0, gtkpack_(new Gtk2::HBox,
- 0, gtksignal_connect(new Gtk2::Button(N("Help")),clicked => sub {
+ 0, gtkpack_(Gtk2::HBox->new,
+ 0, gtksignal_connect(Gtk2::Button->new(N("Help")),clicked => sub {
destroy_widget();
help();
}),
- 0, gtksignal_connect(new Gtk2::Button(N("First Time Wizard")), clicked => sub {
+ 0, gtksignal_connect(Gtk2::Button->new(N("First Time Wizard")), clicked => sub {
destroy_widget();
start_wizard();
}),
1, "",
- 0, gtksignal_connect(new Gtk2::Button(N("Close")), clicked => sub {
+ 0, gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub {
write_conf_file();
restart_server() if $changes_made == 1;
Gtk2->main_quit;
@@ -325,8 +306,7 @@ sub interactive_mode() {
ugtk2->exit(0);
}
-sub check_gdm {
- my ($cmd_line) = @_;
+sub check_gdm() {
#- gdm now needs gdm user in /etc/passwd$$CLIENT$$
my %desktop = getVarsFromSh("/etc/sysconfig/desktop");
my $dm = $desktop{DISPLAYMANAGER};
@@ -335,7 +315,7 @@ sub check_gdm {
if ($dm =~ /GNOME|GDM/ && !$gdm) {
$in->ask_warn(N("Warning"), N("%s defined as dm, adding gdm user to /etc/passwd\$\$CLIENT\$\$", $dm)) if !$cmd_line;
warn(N("%s defined as dm, adding gdm user to /etc/passwd\$\$CLIENT\$\$", $dm)) if $cmd_line;
- adduser($cmd_line, "gdm");
+ adduser("gdm");
}
}
@@ -343,7 +323,7 @@ sub start_wizard() {
text_view(N("
This wizard routine will:
1) Ask you to select either 'thin' or 'fat' clients.
- 2) Setup dhcp.
+ 2) Setup DHCP.
After doing these steps, the wizard will:
@@ -369,7 +349,7 @@ sub wizard_step {
my ($do_step, $step) = @_;
&$do_step();
gtkadd($wizard_buttons,
- gtksignal_connect($previous_button = new Gtk2::Button(N("Previous")), clicked => sub {
+ gtksignal_connect($previous_button = Gtk2::Button->new(N("Previous")), clicked => sub {
clear_buttons();
if ($step == 1) {
exit_wizard();
@@ -385,12 +365,12 @@ sub wizard_step {
})
);
gtkadd($wizard_buttons,
- gtksignal_connect($cancel_button = new Gtk2::Button(N("Cancel Wizard")), clicked => sub {
+ gtksignal_connect($cancel_button = Gtk2::Button->new(N("Cancel Wizard")), clicked => sub {
exit_wizard();
})
);
gtkadd($wizard_buttons,
- gtksignal_connect($next_button = new Gtk2::Button(N("Next")), clicked => sub {
+ gtksignal_connect($next_button = Gtk2::Button->new(N("Next")), clicked => sub {
clear_buttons();
wizard_step(\&dhcpd_config, 2) if $step == 1;
if ($step == 2) {
@@ -425,13 +405,13 @@ sub clear_buttons() {
}
sub client_type() {
- my $check_allow_thin = new Gtk2::CheckButton(N("Use thin clients."));
+ my $check_allow_thin = Gtk2::CheckButton->new(N("Use thin clients."));
$check_allow_thin->set_active($conf{ALLOW_THIN});
text_view(N("Please select default client type.
'Thin' clients run everything off the server's CPU/RAM, using the client display.
'Fat' clients use their own CPU/RAM but the server's filesystem."), "wizard");
gtkpack_($$central_widget,
- 0, gtkpack_(new Gtk2::HBox(1,0),
+ 0, gtkpack_(Gtk2::HBox->new(1,0),
1, Gtk2::VBox->new,
0, gtksignal_connect($check_allow_thin, clicked => sub {
invbool \$conf{ALLOW_THIN};
@@ -439,24 +419,23 @@ sub client_type() {
}),
0, Gtk2::VBox->new,
),
- 0, gtksignal_connect(new Gtk2::Button(N("Sync client X keyboard settings with server.")),
+ 0, gtksignal_connect(Gtk2::Button->new(N("Sync client X keyboard settings with server.")),
clicked => sub { client_X_keyboard() }),
- 1, new Gtk2::HBox(0,0),
+ 1, Gtk2::HBox->new(0,0),
);
}
sub make_nbis() {
my $buff = N("Creating net boot images for all kernels");
$in->ask_warn(N("Information"), N("This will take a few minutes."));
- cursor_wait();
+ gtkset_mousecursor_wait();
system("/usr/bin/mknbi-set -k /boot/$_") foreach @kernels;
- cursor_norm();
+ gtkset_mousecursor_normal();
$buff .= "\n\n\t" . N("Done!");
text_view($buff, "wizard");
}
-sub sync_users {
- my ($cmd_line) = @_;
+sub sync_users() {
my $buff = N("Syncing server user list with client list, including root.");
my @active_users = cat_("/etc/shadow");
@@ -486,14 +465,14 @@ sub text_view {
my ($text, $option) = @_;
my $box;
gtkpack($status_box,
- $box = gtkpack_(new Gtk2::VBox(0,10),
- 1, gtkpack_(new Gtk2::HBox(0,0),
+ $box = gtkpack_(Gtk2::VBox->new(0,10),
+ 1, gtkpack_(Gtk2::HBox->new(0,0),
1, create_scrolled_window(gtktext_insert(
- new Gtk2::TextView, [ [ $text ] ])
+ Gtk2::TextView->new, [ [ $text ] ])
),
),
- 0, gtkpack(gtkset_layout(new Gtk2::HButtonBox, 'spread'),
- gtksignal_connect(my $ok_button = new Gtk2::Button(N("OK")), clicked => sub {
+ 0, gtkpack(gtkset_layout(Gtk2::HButtonBox->new, 'spread'),
+ gtksignal_connect(my $ok_button = Gtk2::Button->new(N("Ok")), clicked => sub {
destroy_widget() if $option eq "close";
do_wizard() if $option eq "wizard";
}),
@@ -510,7 +489,7 @@ sub text_view {
sub help() {
my $inittab_str = '/etc/inittab$$IP=client_ip$$';
my $shadow_str = '/etc/shadow$$CLIENT$$';
- my $xfconfig_str = '/etc/X11/XF86Config-4$$IP=client_ip$$';
+ my $xfconfig_str = '/etc/X11/xorg.conf$$IP=client_ip$$';
text_view(N("Terminal Server Overview") . "\n\n" .
N(" - Create Etherboot Enabled Boot Images:
@@ -542,11 +521,11 @@ N(" While you can use a pool of IP addresses, rather than setup a specifi
of client-specific configuration files that ClusterNFS provides.
Note: The '#type' entry is only used by drakTermServ. Clients can either be 'thin'
- or 'fat'. Thin clients run most software on the server via xdmcp, while fat clients run
+ or 'fat'. Thin clients run most software on the server via XDMCP, while fat clients run
most software on the client machine. A special inittab, %s is
written for thin clients. System config files xdm-config, kdmrc, and gdm.conf are
- modified if thin clients are used, to enable xdmcp. Since there are security issues in
- using xdmcp, hosts.deny and hosts.allow are modified to limit access to the local
+ modified if thin clients are used, to enable XDMCP. Since there are security issues in
+ using XDMCP, hosts.deny and hosts.allow are modified to limit access to the local
subnet.
Note: The '#hdw_config' entry is also only used by drakTermServ. Clients can either
@@ -592,7 +571,7 @@ N(" - /etc/xinetd.d/tftp:
by mkinitrd-net, and the entries in /etc/dhcpd.conf, to serve up the boot image to
each diskless client.
- A typical tftp configuration file looks like:
+ A typical TFTP configuration file looks like:
service tftp
{
@@ -610,7 +589,7 @@ N(" - /etc/xinetd.d/tftp:
puts its images.") . "\n\n" .
N(" - Create etherboot floppies/CDs:
The diskless client machines need either ROM images on the NIC, or a boot floppy
- or CD to initate the boot sequence. drakTermServ will help generate these
+ or CD to initiate the boot sequence. drakTermServ will help generate these
images, based on the NIC in the client machine.
A basic example of creating a boot floppy for a 3Com 3c509 manually:
@@ -626,32 +605,32 @@ sub make_boot() {
my $rom_path = "/usr/share/etherboot";
#- doesn't return list sorted
my @nics = sort(all("/usr/share/etherboot/zimg"));
- my $list_nics = new Gtk2::List();
+ my $list_nics = Gtk2::List->new;
my $nic;
foreach (@nics) {
my $t = $_;
- $list_nics->add(gtkshow(gtksignal_connect(new Gtk2::ListItem($t),
+ $list_nics->add(gtkshow(gtksignal_connect(Gtk2::ListItem->new($t),
select => sub { $nic = $t })));
}
$list_nics->set_selection_mode('single');
gtkpack($status_box,
- $boot_box = gtkpack_(new Gtk2::VBox(0,10),
- 0, gtkadd(new Gtk2::HBox(0,10),
- new Gtk2::HBox(0,5),
+ $boot_box = gtkpack_(Gtk2::VBox->new(0,10),
+ 0, gtkadd(Gtk2::HBox->new(0,10),
+ Gtk2::HBox->new(0,5),
create_scrolled_window($list_nics),
- gtkadd(new Gtk2::VBox(1,10),
- new Gtk2::HBox(0,20),
- gtksignal_connect(new Gtk2::Button(N("Boot Floppy")), clicked =>
+ gtkadd(Gtk2::VBox->new(1,10),
+ Gtk2::HBox->new(0,20),
+ gtksignal_connect(Gtk2::Button->new(N("Boot Floppy")), clicked =>
sub { write_eb_image($nic, $rom_path, "floppy") }),
- gtksignal_connect(new Gtk2::Button(N("Boot ISO")), clicked =>
+ gtksignal_connect(Gtk2::Button->new(N("Boot ISO")), clicked =>
sub { write_eb_image($nic, $rom_path, "iso") }),
- gtksignal_connect(new Gtk2::Button(N("PXE Image")), clicked =>
+ gtksignal_connect(Gtk2::Button->new(N("PXE Image")), clicked =>
sub { write_eb_image($nic, $rom_path, "pxe") }),
- new Gtk2::HBox(0,20),
+ Gtk2::HBox->new(0,20),
),
- new Gtk2::HBox(0,5),
+ Gtk2::HBox->new(0,5),
),
),
);
@@ -715,8 +694,8 @@ sub make_nbi() {
update_list($list_model);
- my $combo_default_kernel = Gtk2::ComboBox->new_text;
- $combo_default_kernel->set_popdown_strings(N("Default kernel version"), map { bootloader::vmlinuz2version($_) } @kernels);
+ my $combo_default_kernel = Gtk2::ComboBox->new_with_strings([ N("Default kernel version"),
+ map { bootloader::vmlinuz2version($_) } @kernels ]);
$combo_default_kernel->set_active(0);
$combo_default_kernel->entry->signal_connect('changed', sub {
my $default_kernel = $combo_default_kernel->entry->get_text;
@@ -739,52 +718,52 @@ sub make_nbi() {
});
gtkpack($status_box,
- $nbi_box = gtkpack_(new Gtk2::VBox(1,10),
- 0, gtkadd(new Gtk2::HBox(0,10),
+ $nbi_box = gtkpack_(Gtk2::VBox->new(1,10),
+ 0, gtkadd(Gtk2::HBox->new(0,10),
create_scrolled_window($tree_kernels),
- gtkadd(new Gtk2::VBox(1,10),
- gtksignal_connect(new Gtk2::Button(N("Build Whole Kernel -->")), clicked => sub {
+ gtkadd(Gtk2::VBox->new(1,10),
+ gtksignal_connect(Gtk2::Button->new(N("Build Whole Kernel -->")), clicked => sub {
if ($kernel) {
$in->ask_warn(N("Information"), N("This will take a few minutes."));
- cursor_wait();
+ gtkset_mousecursor_wait();
build_n_update($list_model, "-k /boot/$kernel");
- cursor_norm();
+ gtkset_mousecursor_normal();
} else {
$in->ask_warn(N("Error"), N("No kernel selected!")) if !($kernel);
}
}),
- gtksignal_connect(new Gtk2::Button(N("Build Single NIC -->")), clicked => sub {
+ gtksignal_connect(Gtk2::Button->new(N("Build Single NIC -->")), clicked => sub {
if ($nic) {
build_n_update($list_model, "-k /boot/$kernel -r $nic");
} else {
$in->ask_warn(N("Error"), N("No NIC selected!"));
}
}),
- gtksignal_connect(new Gtk2::Button(N("Build All Kernels -->")), clicked => sub {
+ gtksignal_connect(Gtk2::Button->new(N("Build All Kernels -->")), clicked => sub {
$in->ask_warn(N("Information"), N("This will take a few minutes."));
- cursor_wait();
+ gtkset_mousecursor_wait();
build_n_update($list_model, "-k /boot/$_") foreach @kernels;
- cursor_norm();
+ gtkset_mousecursor_normal();
}),
$combo_default_kernel,
- new Gtk2::HBox(1,1),
- gtksignal_connect(new Gtk2::Button(N("<-- Delete")), clicked => sub {
+ Gtk2::HBox->new(1,1),
+ gtksignal_connect(Gtk2::Button->new(N("<-- Delete")), clicked => sub {
my $nbi = $tftpboot . "/" . $nbi;
my $result = unlink($nbi) or warn("Can't delete $nbi...");
if ($result == 1) {
$list_model->remove($nbi_iter);
}
}),
- gtksignal_connect(new Gtk2::Button(N("Delete All NBIs")), clicked => sub {
- cursor_wait();
+ gtksignal_connect(Gtk2::Button->new(N("Delete All NBIs")), clicked => sub {
+ gtkset_mousecursor_wait();
foreach (grep { /\.nbi/ } all($tftpboot)) {
my $nbi = $tftpboot . "/" . $_;
unlink($nbi) || warn("Can't delete $nbi...");
}
$list_model->clear;
- cursor_norm();
+ gtkset_mousecursor_normal();
}),
- new Gtk2::HBox(1,1),
+ Gtk2::HBox->new(1,1),
),
create_scrolled_window($list_nbis),
),),
@@ -797,12 +776,12 @@ sub make_nbi() {
sub update_list {
my ($list_model) = @_;
$list_model->clear;
- $list_model->append_set(undef, $_) foreach grep { /\.nbi/ } all($tftpboot);
+ $list_model->append_set(0, $_) foreach grep { /\.nbi/ } all($tftpboot);
}
sub build_n_update {
my ($list_model, $command) = @_;
- system("/usr/bin/mknbi-set $command");
+ system("/usr/bin/mknbi-set -v $command");
update_list($list_model);
}
@@ -828,7 +807,7 @@ sub maintain_users() {
foreach (@sys_users) {
my ($s_label) = split(/:/, $_, 2);
if (any { /$s_label/ } @homes) {
- $list_model->append_set(undef, $s_label);
+ $list_model->append_set(0, $s_label);
}
}
@@ -849,7 +828,7 @@ sub maintain_users() {
my ($t_label) = split(/:/, $_, 2);
my @system_entry = grep { /$t_label/ } @sys_users;
$t_label = $t_label . " !!!" if $_ ne $system_entry[0];
- $list_model->append_set(undef, $t_label);
+ $list_model->append_set(0, $t_label);
}
$list_ts_users->get_selection->signal_connect(changed => sub {
@@ -861,23 +840,23 @@ sub maintain_users() {
});
gtkpack($status_box,
- $user_box = gtkpack_(new Gtk2::VBox(0,10),
- 0, gtkadd(new Gtk2::Label(N("!!! Indicates the password in the system database is different than\n the one in the Terminal Server database.\nDelete/re-add the user to the Terminal Server to enable login."))),
- 0, gtkadd(new Gtk2::HBox(0,20),
+ $user_box = gtkpack_(Gtk2::VBox->new(0,10),
+ 0, gtkadd(Gtk2::Label->new(N("!!! Indicates the password in the system database is different than\n the one in the Terminal Server database.\nDelete/re-add the user to the Terminal Server to enable login."))),
+ 0, gtkadd(Gtk2::HBox->new(0,20),
create_scrolled_window($list_sys_users),
- gtkadd(new Gtk2::VBox(1,10),
- new Gtk2::HBox(0,10),
- gtksignal_connect(new Gtk2::Button(N("Add User -->")), clicked =>
- sub { my $result = adduser(0, $sys_user);
+ gtkadd(Gtk2::VBox->new(1,10),
+ Gtk2::HBox->new(0,10),
+ gtksignal_connect(Gtk2::Button->new(N("Add User -->")), clicked =>
+ sub { my $result = adduser($sys_user);
if ($result == 0) {
- $list_model->append_set(undef, $sys_user);
+ $list_model->append_set(0, $sys_user);
}
}),
- gtksignal_connect(new Gtk2::Button(N("<-- Del User")), clicked =>
- sub { deluser(0, $ts_user);
+ gtksignal_connect(Gtk2::Button->new(N("<-- Del User")), clicked =>
+ sub { deluser($ts_user);
$list_model->remove($titer);
}),
- new Gtk2::HBox(0,10),
+ Gtk2::HBox->new(0,10),
),
create_scrolled_window($list_ts_users),
),),
@@ -934,16 +913,16 @@ sub maintain_clients() {
});
#- entry boxes for client data entry
- my $label_host = new Gtk2::Label("Client Name:");
- my $entry_host = new Gtk2::Entry();
- my $label_mac = new Gtk2::Label("MAC Address:");
- my $entry_mac = new Gtk2::Entry();
- my $label_ip = new Gtk2::Label("IP Address:");
- my $entry_ip = new Gtk2::Entry();
- my $label_nbi = new Gtk2::Label("Kernel Netboot Image:");
- my $entry_nbi = new Gtk2::Combo();
-
- gtksignal_connect(my $check_hdw_config = new Gtk2::CheckButton(N("Allow local hardware\nconfiguration.")),
+ my $label_host = Gtk2::Label->new("Client Name:");
+ my $entry_host = Gtk2::Entry->new;
+ my $label_mac = Gtk2::Label->new("MAC Address:");
+ my $entry_mac = Gtk2::Entry->new;
+ my $label_ip = Gtk2::Label->new("IP Address:");
+ my $entry_ip = Gtk2::Entry->new;
+ my $label_nbi = Gtk2::Label->new("Kernel Netboot Image:");
+ my $entry_nbi = Gtk2::Combo->new;
+
+ gtksignal_connect(my $check_hdw_config = Gtk2::CheckButton->new(N("Allow local hardware\nconfiguration.")),
clicked => sub { invbool \$local_config });
my @images = grep { /\.nbi/ } all($tftpboot);
@@ -962,27 +941,27 @@ sub maintain_clients() {
my $is_thin = 0;
gtkpack($status_box,
- $client_box = gtkpack_(new Gtk2::VBox(0,10),
- 0, gtkadd(new Gtk2::HBox(1,5),
- gtkadd(new Gtk2::VBox(0,5),
+ $client_box = gtkpack_(Gtk2::VBox->new(0,10),
+ 0, gtkadd(Gtk2::HBox->new(1,5),
+ gtkadd(Gtk2::VBox->new(0,5),
gtkadd($label_host), gtkadd($entry_host),
gtkadd($label_mac), gtkadd($entry_mac),
gtkadd($label_ip), gtkadd($entry_ip),
gtkadd($label_nbi), gtkadd($entry_nbi),
gtkadd($check_hdw_config),
- gtksignal_connect($check_thin = new Gtk2::CheckButton(N("Thin Client")),
+ gtksignal_connect($check_thin = Gtk2::CheckButton->new(N("Thin Client")),
clicked => sub { invbool \$is_thin }),
),
- gtkadd(new Gtk2::VBox(1,10),
- $check_allow_thin = new Gtk2::CheckButton(N("Allow Thin Clients")),
- gtksignal_connect(new Gtk2::Button(N("Add Client -->")), clicked =>
+ gtkadd(Gtk2::VBox->new(1,10),
+ $check_allow_thin = Gtk2::CheckButton->new(N("Allow Thin Clients")),
+ gtksignal_connect(Gtk2::Button->new(N("Add Client -->")), clicked =>
sub { my $hostname = $entry_host->get_text;
my $mac = $entry_mac->get_text;
my $ip = $entry_ip->get_text;
my $nbi = $entry_nbi->entry->get_text;
if ($hostname && $mac && $ip) {
- my $result = addclient(0, $hostname, $mac, $ip, $nbi, $is_thin, $local_config);
+ my $result = addclient($hostname, $mac, $ip, $nbi, $is_thin, $local_config);
if ($result == 0) {
my $t_client = $model->append_set(undef, [ 0 => $hostname ]);
@@ -1006,7 +985,7 @@ sub maintain_clients() {
}
}
}),
- gtksignal_connect($button_edit = new Gtk2::Button(N("<-- Edit Client")), clicked =>
+ gtksignal_connect($button_edit = Gtk2::Button->new(N("<-- Edit Client")), clicked =>
sub { $entry_host->set_text($client);
$entry_mac->set_text($clients{$client}{hardware});
$entry_ip->set_text($clients{$client}{address});
@@ -1024,7 +1003,7 @@ sub maintain_clients() {
$check_hdw_config->set_active(0);
}
- my $result = delclient(0, $client);
+ my $result = delclient($client);
if ($result == 0) {
$model->remove($citer);
$button_edit->set_sensitive(0);
@@ -1032,15 +1011,15 @@ sub maintain_clients() {
$button_delete->set_sensitive(0);
}
}),
- gtksignal_connect($button_config = new Gtk2::Button(N("Disable Local Config")), clicked =>
+ gtksignal_connect($button_config = Gtk2::Button->new(N("Disable Local Config")), clicked =>
sub {
my $hdw_config = $clients{$client}{hdw_config};
if ($hdw_config eq "true") {
client_hdw_config($clients{$client}{address}, 0);
}
}),
- gtksignal_connect($button_delete = new Gtk2::Button(N("Delete Client")), clicked =>
- sub { my $result = delclient(0, $client);
+ gtksignal_connect($button_delete = Gtk2::Button->new(N("Delete Client")), clicked =>
+ sub { my $result = delclient($client);
if ($result == 0) {
$model->remove($citer);
$button_edit->set_sensitive(0);
@@ -1048,12 +1027,12 @@ sub maintain_clients() {
$button_delete->set_sensitive(0);
}
}),
- gtksignal_connect(new Gtk2::Button(N("dhcpd Config...")), clicked =>
+ gtksignal_connect(Gtk2::Button->new(N("dhcpd Config...")), clicked =>
sub { $client_box->destroy; dhcpd_config() }),
),
create_scrolled_window($tree_clients),
),
- 0, gtksignal_connect(new Gtk2::Button(N("Sync client X keyboard settings with server.")),
+ 0, gtksignal_connect(Gtk2::Button->new(N("Sync client X keyboard settings with server.")),
clicked => sub { client_X_keyboard() }),
),
);
@@ -1075,20 +1054,20 @@ sub maintain_clients() {
}
sub client_X_keyboard() {
- my $server_conf = "/etc/X11/XF86Config-4";
- my $client_conf = '/etc/X11/XF86Config-4$$CLIENT$$';
+ my $server_conf = "/etc/X11/xorg.conf";
+ my $client_conf = '/etc/X11/xorg.conf$$CLIENT$$';
my @server_X_config = cat_($server_conf);
foreach (@server_X_config) {
chomp;
if (/XkbModel/) {
- my $oldmodel = `grep XkbModel '/etc/X11/XF86Config-4\$\$CLIENT\$\$'`;
+ my $oldmodel = `grep XkbModel '/etc/X11/xorg.conf\$\$CLIENT\$\$'`;
chomp $oldmodel;
my $newmodel = $_;
substInFile { s/$oldmodel/$newmodel/ } $client_conf;
log::explanations("Sync XkbModel in $client_conf from $server_conf");
}
if (/XkbLayout/) {
- my $oldlayout = `grep XkbLayout '/etc/X11/XF86Config-4\$\$CLIENT\$\$'`;
+ my $oldlayout = `grep XkbLayout '/etc/X11/xorg.conf\$\$CLIENT\$\$'`;
chomp $oldlayout;
my $newlayout = $_;
substInFile { s/$oldlayout/$newlayout/ } $client_conf;
@@ -1100,7 +1079,7 @@ sub client_X_keyboard() {
sub client_set {
my ($default) = @_;
# we need to change some system files to allow the thin clients
- # to access the server - enabling xdmcp and modify hosts.deny/hosts.allow for some security
+ # to access the server - enabling XDMCP and modify hosts.deny/hosts.allow for some security
# we also need to set runlevel to 5 and restart the display manager
if ($conf{ALLOW_THIN} == 1) {
if (-f "/etc/sysconfig/autologin") {
@@ -1113,10 +1092,10 @@ sub client_set {
substInFile { s/id:3:initdefault:/id:5:initdefault:/ } "/etc/inittab";
substInFile { s/! DisplayManager.requestPort:/DisplayManager.requestPort:/ } "/etc/X11/xdm/xdm-config";
substInFile { s/Enable=false/Enable=true/ } "/usr/share/config/kdm/kdmrc";
- # This file had 2 "Enable=" entries, one for xdmcp and one for debug
+ # This file had 2 "Enable=" entries, one for XDMCP and one for debug
change_gdm_xdmcp("true");
log::explanations("Modified files /etc/inittab, /etc/X11/xdm/xdm-config, /usr/share/config/kdm/kdmrc, /etc/X11/gdm/gdm.conf");
- # just xdmcp in hosts.allow is enough for xdm & kdm, but gdm doesn't work - x11 doesn't help either
+ # just XDMCP in hosts.allow is enough for xdm & kdm, but gdm doesn't work - x11 doesn't help either
update_hosts_allow("enable");
if ($default eq "all") {
my $inittab = '/etc/initab$$CLIENT$$';
@@ -1151,65 +1130,65 @@ sub dhcpd_config() {
my $new_config = 0;
#- entry boxes for data entry
- my $box_subnet = new Gtk2::HBox(0,0);
- my $label_subnet = new Gtk2::Label(N("Subnet:"));
+ my $box_subnet = Gtk2::HBox->new(0,0);
+ my $label_subnet = Gtk2::Label->new(N("Subnet:"));
$label_subnet->set_justify('right');
- my $entry_subnet = new Gtk2::Entry();
+ my $entry_subnet = Gtk2::Entry->new;
$box_subnet->pack_end($entry_subnet, 0, 0, 10);
$box_subnet->pack_end($label_subnet, 0, 0, 10);
- my $box_netmask = new Gtk2::HBox(0,0);
- my $label_netmask = new Gtk2::Label(N("Netmask:"));
+ my $box_netmask = Gtk2::HBox->new(0,0);
+ my $label_netmask = Gtk2::Label->new(N("Netmask:"));
$label_netmask->set_justify('left');
- my $entry_netmask = new Gtk2::Entry();
+ my $entry_netmask = Gtk2::Entry->new;
$box_netmask->pack_end($entry_netmask, 0, 0, 10);
$box_netmask->pack_end($label_netmask, 0, 0, 10);
- my $box_routers = new Gtk2::HBox(0,0);
- my $label_routers = new Gtk2::Label(N("Routers:"));
+ my $box_routers = Gtk2::HBox->new(0,0);
+ my $label_routers = Gtk2::Label->new(N("Routers:"));
$label_routers->set_justify('left');
- my $entry_routers = new Gtk2::Entry();
+ my $entry_routers = Gtk2::Entry->new;
$box_routers->pack_end($entry_routers, 0, 0, 10);
$box_routers->pack_end($label_routers, 0, 0, 10);
- my $box_subnet_mask = new Gtk2::HBox(0,0);
- my $label_subnet_mask = new Gtk2::Label(N("Subnet Mask:"));
+ my $box_subnet_mask = Gtk2::HBox->new(0,0);
+ my $label_subnet_mask = Gtk2::Label->new(N("Subnet Mask:"));
$label_subnet_mask->set_justify('left');
- my $entry_subnet_mask = new Gtk2::Entry();
+ my $entry_subnet_mask = Gtk2::Entry->new;
$box_subnet_mask->pack_end($entry_subnet_mask, 0, 0, 10);
$box_subnet_mask->pack_end($label_subnet_mask, 0, 0, 10);
- my $box_broadcast = new Gtk2::HBox(0,0);
- my $label_broadcast = new Gtk2::Label(N("Broadcast Address:"));
+ my $box_broadcast = Gtk2::HBox->new(0,0);
+ my $label_broadcast = Gtk2::Label->new(N("Broadcast Address:"));
$label_broadcast->set_justify('left');
- my $entry_broadcast = new Gtk2::Entry();
+ my $entry_broadcast = Gtk2::Entry->new;
$box_broadcast->pack_end($entry_broadcast, 0, 0, 10);
$box_broadcast->pack_end($label_broadcast, 0, 0, 10);
- my $box_domain = new Gtk2::HBox(0,0);
- my $label_domain = new Gtk2::Label(N("Domain Name:"));
+ my $box_domain = Gtk2::HBox->new(0,0);
+ my $label_domain = Gtk2::Label->new(N("Domain Name:"));
$label_domain->set_justify('left');
- my $entry_domain = new Gtk2::Entry();
+ my $entry_domain = Gtk2::Entry->new;
$box_domain->pack_end($entry_domain, 0, 0, 10);
$box_domain->pack_end($label_domain, 0, 0, 10);
- my $box_name_servers = new Gtk2::HBox(0,0);
- my $box_name_servers_entry = new Gtk2::VBox(0,0);
- my $label_name_servers = new Gtk2::Label(N("Name Servers:"));
+ my $box_name_servers = Gtk2::HBox->new(0,0);
+ my $box_name_servers_entry = Gtk2::VBox->new(0,0);
+ my $label_name_servers = Gtk2::Label->new(N("Name Servers:"));
$label_name_servers->set_justify('left');
- my $entry_name_server1 = new Gtk2::Entry();
- my $entry_name_server2 = new Gtk2::Entry();
- my $entry_name_server3 = new Gtk2::Entry();
+ my $entry_name_server1 = Gtk2::Entry->new;
+ my $entry_name_server2 = Gtk2::Entry->new;
+ my $entry_name_server3 = Gtk2::Entry->new;
$box_name_servers_entry->pack_start($entry_name_server1, 0, 0, 0);
$box_name_servers_entry->pack_start($entry_name_server2, 0, 0, 0);
$box_name_servers_entry->pack_start($entry_name_server3, 0, 0, 0);
$box_name_servers->pack_end($box_name_servers_entry, 0, 0, 10);
$box_name_servers->pack_end($label_name_servers, 0, 0, 10);
- my $label_ip_range_start = new Gtk2::Label(N("IP Range Start:"));
- my $label_ip_range_end = new Gtk2::Label(N("IP Range End:"));
- my $entry_ip_range_start = new Gtk2::Entry();
- my $entry_ip_range_end = new Gtk2::Entry();
+ my $label_ip_range_start = Gtk2::Label->new(N("IP Range Start:"));
+ my $label_ip_range_end = Gtk2::Label->new(N("IP Range End:"));
+ my $entry_ip_range_start = Gtk2::Entry->new;
+ my $entry_ip_range_end = Gtk2::Entry->new;
#- grab some default entries from the running system
@@ -1256,8 +1235,8 @@ sub dhcpd_config() {
}
gtkpack($status_box,
- $dhcpd_box = gtkpack_(new Gtk2::HBox(1,10),
- 0, gtkadd(new Gtk2::VBox,
+ $dhcpd_box = gtkpack_(Gtk2::HBox->new(1,10),
+ 0, gtkadd(Gtk2::VBox->new,
gtkadd($box_subnet),
gtkadd($box_netmask),
gtkadd($box_routers),
@@ -1266,25 +1245,25 @@ sub dhcpd_config() {
gtkadd($box_domain),
gtkadd($box_name_servers),
),
- 0, gtkadd(new Gtk2::VBox(0,0),
- new Gtk2::Label(N("dhcpd Server Configuration") . "\n\n" .
+ 0, gtkadd(Gtk2::VBox->new(0,0),
+ Gtk2::Label->new(N("dhcpd Server Configuration") . "\n\n" .
N("Most of these values were extracted\nfrom your running system.\nYou can modify as needed.")),
- new Gtk2::HSeparator,
- gtkadd(new Gtk2::HBox,
- new Gtk2::Label(N("Dynamic IP Address Pool:")),
+ Gtk2::HSeparator->new,
+ gtkadd(Gtk2::HBox->new,
+ Gtk2::Label->new(N("Dynamic IP Address Pool:")),
),
- gtkadd(new Gtk2::HBox(0,0),
- gtkadd(new Gtk2::VBox,
+ gtkadd(Gtk2::HBox->new(0,0),
+ gtkadd(Gtk2::VBox->new,
gtkadd($label_ip_range_start),
gtkadd($entry_ip_range_start),
),
- gtkadd(new Gtk2::VBox,
+ gtkadd(Gtk2::VBox->new,
gtkadd($label_ip_range_end),
gtkadd($entry_ip_range_end),
),
),
- gtkadd(new Gtk2::HBox),
- gtksignal_connect(new Gtk2::Button($button_msg), clicked =>
+ gtkadd(Gtk2::HBox->new),
+ gtksignal_connect(Gtk2::Button->new($button_msg), clicked =>
sub {
if ($new_config == 1) {
write_dhcpd_config("full",
@@ -1304,7 +1283,7 @@ sub dhcpd_config() {
}
}
),
- new Gtk2::HBox(0,10),
+ Gtk2::HBox->new(0,10),
),
),
);
@@ -1314,7 +1293,7 @@ sub dhcpd_config() {
}
sub get_net_interface() {
- my @interfaces = `/sbin/route | grep -v lo | tail +3 | awk '{print \$8}' | uniq`;
+ my @interfaces = `/sbin/route | grep -v lo | grep -v vmnet | tail +3 | awk '{print \$8}' | uniq`;
chop @interfaces;
my $count = @interfaces;
if ($count == 1) {
@@ -1450,11 +1429,10 @@ sub write_eb_image {
}
}
-sub enable_ts {
+sub enable_ts() {
#- setup default config files for terminal server
- my $cmd_line = @_;
- check_gdm($cmd_line);
+ check_gdm();
@buff = ();
$buff[0] = "Enabling Terminal Server...\n\n";
@@ -1486,7 +1464,6 @@ sub enable_ts {
$squash = "no_root_squash" if $msec{SECURE_LEVEL} > 2;
my $exports = "#/etc/exports - generated by drakTermServ\n\n";
if ($nfs_subnet eq '') {
- $nfs_subnet = get_subnet_from_sys();
$nfs_mask = get_mask_from_sys();
my $sys_broadcast = get_broadcast_from_sys();
$nfs_subnet = get_subnet_from_sys($sys_broadcast, $nfs_mask);
@@ -1507,9 +1484,8 @@ sub enable_ts {
show_status(@buff);
}
-sub disable_ts {
+sub disable_ts() {
#- restore pre-terminal server configs
- my $cmd_line = @_;
@buff = ();
$buff[0] = "Disabling Terminal Server...\n\n";
@@ -1553,14 +1529,14 @@ sub service_change {
$buff_index;
}
-sub start_ts {
+sub start_ts() {
#- start the terminal server
- my $cmd_line = @_;
my $pcimap = "/etc/dhcpd.conf.etherboot-pcimap.include";
@buff = ();
if (-f $pcimap) {
$buff[0] = "Starting Terminal Server...\n\n";
+ `touch /etc/dhcpd.conf.etherboot.kernel` if ! -f "/etc/dhcpd.conf.etherboot.kernel";
my $buff_index = service_change("dhcpd", "start", 2);
$buff_index = service_change("clusternfs", "start", $buff_index);
$buff[$buff_index] = "\n\tDone!";
@@ -1576,9 +1552,8 @@ sub start_ts {
show_status(@buff);
}
-sub stop_ts {
+sub stop_ts() {
#- stop the terminal server
- my $cmd_line = @_;
@buff = ();
$buff[0] = "Stopping Terminal Server...\n\n";
@@ -1608,7 +1583,7 @@ sub show_status() {
}
sub adduser {
- my ($cmd_line, $username) = @_;
+ my ($username) = @_;
my @active_users = cat_("/etc/shadow");
my @passwd_users = cat_("/etc/passwd");
my @ts_users = cat_('/etc/shadow$$CLIENT$$');
@@ -1627,8 +1602,8 @@ sub adduser {
} else {
#in but password changed
print N("%s passwd bad in Terminal Server - rewriting...\n", $username);
- deluser($cmd_line, $username);
- adduser($cmd_line, $username);
+ deluser($username);
+ adduser($username);
}
} else {
# new ts user
@@ -1654,7 +1629,7 @@ sub adduser {
sub deluser {
# del a user from the shadow$$CLIENT$$ file
- my ($cmd_line, $username) = @_;
+ my ($username) = @_;
my $i;
my $user_deleted;
my @ts_users = cat_('/etc/shadow$$CLIENT$$');
@@ -1700,7 +1675,7 @@ sub deluser {
sub addclient {
#- add a new client entry after checking for dups
- my ($cmd_line, $hostname, $mac, $ip, $nbi, $is_thin, $local_config) = @_;
+ my ($hostname, $mac, $ip, $nbi, $is_thin, $local_config) = @_;
my $host_in_use = 0;
my $mac_in_use = 0;
@@ -1748,7 +1723,7 @@ sub addclient {
sub delclient {
#- find a client and delete the entry in dhcpd.conf
- my ($cmd_line, $hostname) = @_;
+ my ($hostname) = @_;
my $host_found;
my %ts_clients = read_dhcpd_conf();
@@ -1914,11 +1889,11 @@ sub client_hdw_config {
# make all the local config files
cp_af("/etc/sysconfig/mouse", "/etc/sysconfig/mouse$suffix") if -f "/etc/sysconfig/mouse";
cp_af("/etc/X11/XF86Config", "/etc/X11/XF86Config$suffix") if -f "/etc/X11/XF86Config";
- cp_af('/etc/X11/XF86Config-4$$CLIENT$$', "/etc/X11/XF86Config-4$suffix") if -f '/etc/X11/XF86Config-4$$CLIENT$$';
- cp_af("/dev/null", "/etc/modules.conf$suffix");
- cp_af("/dev/null", "/etc/modules$suffix");
- cp_af("/dev/null", "/etc/modprobe.conf$suffix");
- cp_af("/dev/null", "/etc/modprobe.preload$suffix");
+ cp_af('/etc/X11/xorg.conf$$CLIENT$$', "/etc/X11/xorg.conf$suffix") if -f '/etc/X11/xorg.conf$$CLIENT$$';
+ output("/etc/modules.conf$suffix", '');
+ output("/etc/modules$suffix", '');
+ output("/etc/modprobe.conf$suffix", '');
+ output("/etc/modprobe.preload$suffix", '');
# create mount points so they can be edited by the client
my $mnt_access = "$client_ip(rw,no_root_squash)";
append_to_file("/etc/exports", "/etc/sysconfig/mouse$suffix\t$mnt_access\n");
@@ -1927,7 +1902,7 @@ sub client_hdw_config {
append_to_file("/etc/exports", "/etc/modprobe.conf$suffix\t$mnt_access\n");
append_to_file("/etc/exports", "/etc/modprobe.preload$suffix\t$mnt_access\n");
append_to_file("/etc/exports", "/etc/X11/XF86Config$suffix\t$mnt_access\n");
- append_to_file("/etc/exports", "/etc/X11/XF86Config-4$suffix\t$mnt_access\n");
+ append_to_file("/etc/exports", "/etc/X11/xorg.conf$suffix\t$mnt_access\n");
} else {
log::explanations("Removing root access for $client_ip");
eval { rm_rf("/etc/shadow\$\$IP=$client_ip\$\$") };
@@ -1965,7 +1940,7 @@ sub clean_client_config {
eval { rm_rf("/etc/modprobe.conf$suffix") };
eval { rm_rf("/etc/modprobe.preload$suffix") };
eval { rm_rf("/etc/X11/XF86Config$suffix") };
- eval { rm_rf("/etc/X11/XF86Config-4$suffix") };
+ eval { rm_rf("/etc/X11/xorg.conf$suffix") };
eval { rm_rf("/etc/sysconfig/network$suffix") };
remove_client_mounts($client_ip);
}
diff --git a/perl-install/standalone/drakauth b/perl-install/standalone/drakauth
index c48792ad9..c68a75b84 100755
--- a/perl-install/standalone/drakauth
+++ b/perl-install/standalone/drakauth
@@ -19,18 +19,19 @@ my $in = 'interactive'->vnew('su');
my $authentication = {}; # TODO
my $kind = authentication::to_kind($authentication);
+my $meta_class = { getVarsFromSh("/etc/sysconfig/system") }->{META_CLASS};
main:
-$in->ask_from('', '',
+$in->ask_from(N("Authentication"), authentication::kind2description(),
[
- { label => N("Authentication"), val => \$kind, type => 'list' , list => [ authentication::kinds() ], format => \&authentication::kind2description },
+ { label => N("Authentication"), val => \$kind, type => 'list' , list => [ authentication::kinds($meta_class) ], format => \&authentication::kind2name },
]) or $in->exit;
authentication::ask_parameters($in, $netc, $authentication, $kind) or goto main;
eval {
- authentication::set($in, $netc, $authentication, sub { my ($f) = @_; $f->() });
- network::network::write_conf("$::prefix/etc/sysconfig/network", $netc);
+ authentication::set($in, $netc, $authentication);
+ network::network::write_conf($netc);
};
if (my $err = $@) {
$in->ask_warn(N("Error"), formatError($err));
diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst
index f54b47323..abc0e7ea1 100755
--- a/perl-install/standalone/drakautoinst
+++ b/perl-install/standalone/drakautoinst
@@ -144,34 +144,34 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
my $W = ugtk2->new('$o edition');
my @box_to_hide;
my $nb_pages=0;
- my $notebook = new Gtk2::Notebook;
+ my $notebook = Gtk2::Notebook->new;
$notebook->set_show_border(0);
$notebook->set_show_tabs(0);
- $notebook->append_page(gtkpack_(gtkset_border_width(new Gtk2::VBox(0,0), 10),
- 1, new Gtk2::VBox(0,0),
- 0, gtkpack_(new Gtk2::HBox(0,0),
- 1, new Gtk2::VBox(0,0),
- 0, gtkadd(gtkset_shadow_type(new Gtk2::Frame, 'etched-in'),
+ $notebook->append_page(gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,0), 10),
+ 1, Gtk2::VBox->new(0,0),
+ 0, gtkpack_(Gtk2::HBox->new(0,0),
+ 1, Gtk2::VBox->new(0,0),
+ 0, gtkadd(gtkset_shadow_type(Gtk2::Frame->new, 'etched-in'),
gtkcreate_img('mdk_logo')),
- 1, new Gtk2::VBox(0,0),
+ 1, Gtk2::VBox->new(0,0),
),
0, N("\nWelcome.\n\nThe parameters of the auto-install are available in the sections on the left"),
- 1, new Gtk2::VBox(0,0),
+ 1, Gtk2::VBox->new(0,0),
), undef);
$notebook->show_all;
$notebook->set_current_page(0);
gtkadd($W->{window},
- gtkpack_(new Gtk2::VBox(0,5),
- 1, gtkpack_(new Gtk2::HBox(0,0),
- 0, gtkadd(gtkset_size_request(gtkset_shadow_type(new Gtk2::Frame, 'in'), 130, 470),
- gtkpack_(new Gtk2::VBox(0,0),
+ gtkpack_(Gtk2::VBox->new(0,5),
+ 1, gtkpack_(Gtk2::HBox->new(0,0),
+ 0, gtkadd(gtkset_size_request(gtkset_shadow_type(Gtk2::Frame->new, 'in'), 130, 470),
+ gtkpack_(Gtk2::VBox->new(0,0),
map {
- my $box = new Gtk2::VBox(0,0);
+ my $box = Gtk2::VBox->new(0,0);
push @box_to_hide, $box;
$box->{vis} = 0;
my @button_to_hide;
- 0, gtksignal_connect(new Gtk2::Button($_), clicked => sub {
+ 0, gtksignal_connect(Gtk2::Button->new($_), clicked => sub {
if ($box->{vis}) { $box->hide; $box->{vis} = 0; $notebook->set_current_page(0) }
else {
$_->hide, $_->{vis}=0 foreach @box_to_hide;
@@ -180,7 +180,7 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
}
}), 1, gtkpack__($box,
map {
- my $button = gtkset_relief(new Gtk2::ToggleButton(), 'none');
+ my $button = gtkset_relief(Gtk2::ToggleButton->new, 'none');
push @button_to_hide, $button;
my $gru = $_->[0];
$notebook->append_page(gtkshow($_->[2]), undef);
@@ -191,9 +191,9 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
$button->get_active and $function->()
});
my $b;
- if ($_->[1] ne "") { $b = gtkcreate_img($_->[1]) } else { $b = () };
+ if ($_->[1] ne "") { $b = gtkcreate_img($_->[1]) } else { undef $b };
gtksignal_connect(gtkadd($button,
- gtkpack__(new Gtk2::VBox(0,3),
+ gtkpack__(Gtk2::VBox->new(0,3),
$b,
translate($gru),
)
@@ -211,10 +211,10 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
),
1, $notebook,
),
- 0, new Gtk2::HSeparator,
- 0, gtkadd(gtkset_border_width(gtkset_layout(new Gtk2::HButtonBox, 'end'), 5),
- gtksignal_connect(new Gtk2::Button(N("Accept")), clicked => sub { Gtk2->main_quit }),
- gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { $o = $o_old; Gtk2->main_quit; quit_global($in, 0) }),
+ 0, Gtk2::HSeparator->new,
+ 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk2::HButtonBox->new, 'end'), 5),
+ gtksignal_connect(Gtk2::Button->new(N("Accept")), clicked => sub { Gtk2->main_quit }),
+ gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { $o = $o_old; Gtk2->main_quit; quit_global($in, 0) }),
)
)
);
@@ -222,8 +222,8 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
# $W->{window}->show_all;
# gtkadd($W->{window},
# gtkpack_($W->create_box_with_title(N("Edit variables")),
-# 1, my $notebook = create_notebook( map { $_, h2widget($o->{$_}, "\$o->\{$_\}") } keys %$o ),
-# 0, gtkpack(gtkset_border_width(new Gtk2::HBox(0,0),5), $W->create_okcancel),
+# 1, my $notebook = create_notebook( map { h2widget($o->{$_}, "\$o->\{$_\}"), $_ } keys %$o ),
+# 0, gtkpack(gtkset_border_width(Gtk2::HBox->new(0,0),5), $W->create_okcancel),
# ),
# );
# $notebook->set_tab_pos('left');
@@ -273,8 +273,8 @@ sub h2widget {
my @list_keys = keys(%$k);
if (ref($k->{$list_keys[0]}) =~ /HASH/) {
$i++;
- $w = gtkpack_(new Gtk2::VBox(0,0),
- 1, create_scrolled_window(gtkpack__($vb = new Gtk2::VBox(0,10),
+ $w = gtkpack_(Gtk2::VBox->new(0,0),
+ 1, create_scrolled_window(gtkpack__($vb = Gtk2::VBox->new(0,10),
$widget_list[$i] = create_packtable({ col_spacings => 10, row_spacings => 3 },
map {
my $e;
@@ -305,9 +305,9 @@ sub h2widget {
my $vb;
my @widget_list;
my $i = -1;
- $w = gtkpack_(new Gtk2::VBox(0,0),
+ $w = gtkpack_(Gtk2::VBox->new(0,0),
1, create_scrolled_window(
- gtkpack__($vb = new Gtk2::VBox(0,5),
+ gtkpack__($vb = Gtk2::VBox->new(0,5),
map { $i++; $widget_list[$i] = h2widget($_, "$label\[$i]") } @$k,
)
),
@@ -335,7 +335,7 @@ sub create_entry_element {
} elsif (ref $text =~ /ARRAY/) {
return [ "$label : ", h2widget($text, $label) ];
} else {
- $e = new Gtk2::Entry;
+ $e = Gtk2::Entry->new;
$e->{value} = $value;
my $_tag = Glib::Timeout->add(1000, sub { $e->set_text($text); 0 });
gtksignal_connect($e, changed => sub {
@@ -352,17 +352,17 @@ sub control_buttons {
my @widget_list = @$widget_list2;
my $i = $$j;
ref($ref_local_k) =~ /HASH/ or return();
- my (%local_k) = %$ref_local_k;
- my ($button_add, $button_remove);
- 0, gtkadd(gtkset_border_width(gtkset_layout(new Gtk2::HButtonBox, 'spread'), 5),
- gtksignal_connect($button_add = new Gtk2::Button(N("Add an item")), clicked => sub {
+ my %local_k = %$ref_local_k;
+ my ($button_remove);
+ 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk2::HButtonBox->new, 'spread'), 5),
+ gtksignal_connect(Gtk2::Button->new(N("Add an item")), clicked => sub {
$local_k{$_} = undef foreach keys %local_k;
$i++;
$local_gui->($vb, \@widget_list, \%local_k, $i) or $i--, return;
$i >= 0 and $button_remove->set_sensitive(1);
}
),
- gtksignal_connect($button_remove = new Gtk2::Button(N("Remove the last item")), clicked => sub {
+ gtksignal_connect($button_remove = Gtk2::Button->new(N("Remove the last item")), clicked => sub {
$i >= 0 or return;
$widget_list[$i]->destroy;
$i--;
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup
index 67140d644..defb1dcfa 100755
--- a/perl-install/standalone/drakbackup
+++ b/perl-install/standalone/drakbackup
@@ -85,7 +85,7 @@ my $remove_user_before_restore = 0;
my @file_list_to_send_by_ftp;
my $results;
my @net_methods = ("ftp", "rsync", "ssh", "webdav");
-my @media_types = (translate(N_("hd")), "cd", translate(N_("tape")));
+my @media_types = ("hd", "cd", "tape");
my %cd_devices;
my $std_device;
my @tape_devices;
@@ -109,7 +109,7 @@ my $nonroot_user = 0;
my $media_problem = 0;
my $vol_name = 'Drakbackup';
my $good_restore_path = 1;
-my @no_devices = translate(N_("No devices found"));
+my @no_devices = translate(N_("No device found"));
my %help;
my %conf;
my $time_string = "* * * * *";
@@ -118,6 +118,7 @@ my $ignore_files_list;
my @list_of_rpm_to_install;
my @other_files;
my @sys_files = "/etc";
+my @files_for_direct_tape;
my $host_passwd;
my $untar_prefix = "tar -C $restore_path -x";
@@ -149,13 +150,13 @@ foreach (@ARGV) {
sub setup_tooltips() {
%help = (
- 'use_expect' => N("Expect is an extension to the Tcl scripting language that allows interactive sessions without user intervention."),
+ 'use_expect' => N("Expect is an extension to the TCL scripting language that allows interactive sessions without user intervention."),
'remember_pass' => N("Store the password for this system in drakbackup configuration."),
'erase_cdrw' => N("For a multisession CD, only the first session will erase the cdrw. Otherwise the cdrw is erased before each backup."),
'use_incr_decr' => N("This option will save files that have changed. Exact behavior depends on whether incremental or differential mode is used."),
'use_incremental' => N("Incremental backups only save files that have changed or are new since the last backup."),
'use_differential' => N("Differential backups only save files that have changed or are new since the original 'base' backup."),
- 'send_mail_to' => N("This should be a local user or email addresse that you want the backup results sent to. You will need to define a functioning mail server."),
+ 'send_mail_to' => N("This should be a local user or email address that you want the backup results sent to. You will need to define a functioning mail server."),
'backupignore' => N("Files or wildcards listed in a .backupignore file at the top of a directory tree will not be backed up."),
'delete_files' => N("For backups to other media, files are still created on the hard drive, then moved to the other media. Enabling this option will remove the hard drive tar files after the backup."),
'dir_or_module' => N("Some protocols, like rsync, may be configured at the server end. Rather than using a directory path, you would use the 'module' name for the service path."),
@@ -193,7 +194,7 @@ if (check_for_xserver()) {
sub set_help_tip {
my ($entry, $key) = @_;
- gtkset_tip(new Gtk2::Tooltips, $entry, formatAlaTeX($help{$key}));
+ gtkset_tip(Gtk2::Tooltips->new, $entry, formatAlaTeX($help{$key}));
}
sub all_user_list() {
@@ -243,8 +244,8 @@ sub get_free_space {
sub check_storage_quota {
my ($dir) = @_;
- my $used = `du $dir`;
- my $used_space = $used / 1024;
+ my $used = `du -b $dir`;
+ my $used_space = $used / 1024 / 1024;
if ($used_space > $conf{MAX_SPACE}) {
return $used_space;
} else {
@@ -307,7 +308,7 @@ sub get_cd_info() {
print "{$key}->{dvdr} = $cd_devices{$key}{dvdr}\n";
print "{$key}->{dvdram} = $cd_devices{$key}{dvdram}\n";
} else {
- delete $cd_devices{$key} if $cd_devices{$key}{rec_dev} eq ''
+ delete $cd_devices{$key} if $cd_devices{$key}{rec_dev} eq '';
}
}
}
@@ -389,7 +390,7 @@ sub save_cron_files() {
system("chmod +x /etc/cron.$conf{DAEMON_TIME_SPACE}/drakbackup");
}
if ($conf{DAEMON_TIME_SPACE} eq "custom" || !$backup_daemon) {
- my $newdetail = join(" ", $time_string, $exec_string, "\n") if $backup_daemon;
+ my $newdetail = $backup_daemon && join(" ", $time_string, $exec_string, "\n");
system("crontab -l | tail +4 > $tmpcron");
my @cronlines = cat_($tmpcron);
my $index = 0;
@@ -397,7 +398,7 @@ sub save_cron_files() {
if (/$exec_string/) {
splice(@cronlines, $index, 1);
}
- $index++
+ $index++;
}
push(@cronlines, $newdetail) if $backup_daemon;
output($tmpcron, @cronlines);
@@ -618,7 +619,7 @@ sub do_expect {
$in->ask_warn(N("Information"), N("This may take a moment to generate the keys."));
gtkset_mousecursor_wait();
#- not using a passphrase for the moment
- system("ssh-keygen -P '' -t dsa -f $backup_key");
+ system("ssh-keygen", "-P", "", "-t", "dsa", "-f", $backup_key);
gtkset_mousecursor_normal();
}
@@ -672,12 +673,12 @@ sub ssh_client() {
$interactive and progress($pbar, $plabel, 0.5, "File Transfer...");
$interactive and $stext->set_text($_);
$log_buff .= $command . "\n\n";
- local *TMP;
- open TMP, "$command 2>&1 |";
- while ($value = <TMP>) {
+ my $TMP;
+ open $TMP, "$command 2>&1 |";
+ while ($value = <$TMP>) {
$log_buff .= $value;
}
- close TMP;
+ close $TMP;
$log_buff .= "\n";
$interactive and progress($pbar, $plabel, 0.5, "Done...");
$interactive and progress($pbar3, $plabel3, 1/@file_list_to_send_by_ftp, N("Total progress"));
@@ -726,9 +727,11 @@ sub check_for_cd() {
show_warning("f", N("Does not appear to be recordable media!"));
return 1;
}
- if ($log_buff =~ /Is not erasable/ && $conf{MEDIA_ERASE}) {
- show_warning("f", N("Not erasable media!"));
- return 1;
+ #- non-fatal, just disable erase
+ if (($log_buff =~ /Is not erasable/ || $log_buff =~ /Found DVD media/) && $conf{MEDIA_ERASE}) {
+ show_warning("w", N("Not erasable media!"));
+ $conf{MEDIA_ERASE} = 0;
+ save_conf_file();
}
if ($conf{MULTI_SESSION}) {
@@ -753,8 +756,8 @@ sub check_for_cd() {
sub write_on_cd() {
my $command = "cdrecord -v dev=$conf{CD_DEVICE} -data ";
- # DVD+RW use -dao
- $command .= "-dao " if $conf{DVDRW};
+ # DVD+RW use -sao
+ $command .= "-sao " if $conf{DVDRW};
#- only blank if it's the first session
$command .= "blank=fast " if $conf{MEDIA_ERASE} && $session_offset eq '';
#- multi-session mode
@@ -788,16 +791,16 @@ sub spawn_progress {
$log_buff .= $command . "\n\n";
standalone::explanations("Running $command");
- local *TMP;
- open TMP, "$command 2>&1 |";
- while ($value = <TMP>) {
+ my $TMP;
+ open $TMP, "$command 2>&1 |";
+ while ($value = <$TMP>) {
$log_buff .= $value;
if ($interactive) {
$stext->set_text($value);
gtkflush();
}
}
- close TMP;
+ close $TMP;
$interactive and Glib::Source->remove($timer);
}
@@ -896,7 +899,13 @@ sub build_tape() {
}
#- do the backup
- $command = "tar -cvf $conf{TAPE_DEVICE} @file_list_to_send_by_ftp";
+ $command = "tar -cvf $conf{TAPE_DEVICE} ";
+ if ($conf{DIRECT_TAPE}) {
+ ($command, undef) = handle_ignores($command, undef, @files_for_direct_tape);
+ $command .= " @files_for_direct_tape";
+ } else {
+ $command .= " @file_list_to_send_by_ftp";
+ }
spawn_progress($command, "Running tar to tape");
#- eject the tape?
@@ -932,12 +941,13 @@ sub build_backup_files() {
my $incr;
my $base;
my $find_args = "! -type d -print";
-
+
local $_;
$results = "";
$log_buff = "";
- #- flush this so if the user does 2 runs in a row we don't try to send the same files
+ #- flush these so if the user does 2 runs in a row we don't try to send the same files
@file_list_to_send_by_ftp = ();
+ @files_for_direct_tape = ();
$interactive and gtkset_mousecursor_wait();
read_conf_file();
@@ -1046,7 +1056,7 @@ sub build_backup_files() {
files_to_results("$incr$user");
}
}
- $interactive and progress($pbar2, $plabel1, 1, N("Backup User files..."));
+ $interactive and progress($pbar1, $plabel1, 1, N("Backup User files..."));
$interactive and progress($pbar3, $plabel3, 0.4, N("Hard Disk Backup files..."));
if ($conf{OTHER_FILES}) {
@@ -1081,16 +1091,16 @@ sub build_backup_files() {
push_list("list_$incr") if $incr =~ /_other/;
files_to_results($incr);
}
- $interactive and progress($pbar1, $plabel2, 1, N("Backup Other files..."));
+ $interactive and progress($pbar2, $plabel2, 1, N("Backup Other files..."));
$interactive and progress($pbar3, $plabel3, 0.3, N("Hard Disk Backup Progress..."));
}
my $filecount = @file_list_to_send_by_ftp;
- if (!$filecount) {
+ if (!$filecount && !$conf{DIRECT_TAPE}) {
my $msg = N("No changes to backup!");
show_warning("w", $msg);
$interactive and gtkset_mousecursor_normal();
- $interactive and interactive_mode();
+ $interactive and interactive_mode_box();
results_to_logfile();
return 1;
}
@@ -1156,13 +1166,15 @@ sub build_backup_files() {
#- write our catalog file
if (!$media_problem) {
my $catalog = substr($the_time, 1);
+ my $direct_tape = "";
+ $direct_tape = "Direct" if $conf{DIRECT_TAPE};
if (!$conf{USE_NET} && !$conf{USE_TAPE} && !$conf{USE_CD}) {
$catalog .= ":HD:localhost:$conf{PATH_TO_SAVE}";
$conf{NET_PROTO} = '';
}
$catalog .= ":$conf{NET_PROTO}:$conf{LOGIN}\@$conf{HOST_NAME}:$conf{HOST_PATH}" if $conf{NET_PROTO};
$catalog .= ":CD:$vol_name:$conf{CD_DEVICE}" if $conf{USE_CD};
- $catalog .= ":Tape:$vol_name:$conf{TAPE_DEVICE}" if $conf{USE_TAPE};
+ $catalog .= ":" . $direct_tape . "Tape:$vol_name:$conf{TAPE_DEVICE}" if $conf{USE_TAPE};
$catalog .= ":System" unless $conf{NO_SYS_FILES};
$catalog .= ":I" if $conf{SYS_INCREMENTAL_BACKUPS} && !$conf{NO_SYS_FILES} && !$conf{SYS_DIFFERENTIAL_BACKUPS};
$catalog .= ":D" if $conf{SYS_INCREMENTAL_BACKUPS} && !$conf{NO_SYS_FILES} && $conf{SYS_DIFFERENTIAL_BACKUPS};
@@ -1170,7 +1182,7 @@ sub build_backup_files() {
$catalog .= ":Users=(@user_list)" unless $conf{NO_USER_FILES};
$catalog .= ":I" if $conf{USER_INCREMENTAL_BACKUPS} && !$conf{NO_USER_FILES} && !$conf{USER_DIFFERENTIAL_BACKUPS};
$catalog .= ":D" if $conf{USER_INCREMENTAL_BACKUPS} && !$conf{NO_USER_FILES} && $conf{USER_DIFFERENTIAL_BACKUPS};
- $catalog .= ":F" if !$conf{USER_INCREMENTAL_BACKUPS} && !$conf{NO_USER_FILES};;
+ $catalog .= ":F" if !$conf{USER_INCREMENTAL_BACKUPS} && !$conf{NO_USER_FILES};
$catalog .= ":Other=(@other_files)" if $conf{OTHER_FILES};
$catalog .= ":I" if $conf{OTHER_INCREMENTAL_BACKUPS} && $conf{OTHER_FILES} && !$conf{OTHER_DIFFERENTIAL_BACKUPS};
$catalog .= ":D" if $conf{OTHER_INCREMENTAL_BACKUPS} && $conf{OTHER_FILES} && $conf{OTHER_DIFFERENTIAL_BACKUPS};
@@ -1237,13 +1249,22 @@ sub do_find {
#- $newer may be undef - if it's defined then "-cnewer $newer"
$newer = $conf{PATH_TO_SAVE} . "/" . $newer if defined($newer);
defined($newer) ? system("find @where -cnewer $newer $more_args > $into") : system("find @where $more_args > $into");
+ #- someone on club complained about perms being too open
+ chmod(0600, $into) if -e $into;
}
sub do_tar {
my ($tar_cmd, $dest_file, $list_file, @files) = @_;
my $full_dest_file = $conf{PATH_TO_SAVE} . "/" . $dest_file . $the_time . "." . $conf{OPTION_COMP};
- #- if $list_file is undefined, then use the @files list
- defined($list_file) ? system("$tar_cmd -f $full_dest_file -T $list_file") : system("$tar_cmd -f $full_dest_file @files");
+ if ($conf{DIRECT_TAPE}) {
+ log::explanations("Direct tape backup - tar deferred...");
+ defined($list_file) ? push @files_for_direct_tape, $list_file : push @files_for_direct_tape, @files;
+ } else {
+ #- if $list_file is undefined, then use the @files list
+ defined($list_file) ? system("$tar_cmd -f $full_dest_file -T $list_file") : system("$tar_cmd -f $full_dest_file @files");
+ }
+ #- someone on club complained about perms being too open
+ chmod(0600, $full_dest_file) if -e $full_dest_file;
push_list($dest_file);
}
@@ -1257,9 +1278,14 @@ sub push_list {
sub files_to_results {
my ($basename) = @_;
- $results .= "\nfile: " . $conf{PATH_TO_SAVE} . "/backup_" . $basename . $the_time . "." . $conf{OPTION_COMP} . "\n\n";
- $results .= cat_("$conf{PATH_TO_SAVE}/list_" . $basename . $the_time . ".txt");
+ if ($conf{DIRECT_TAPE}) {
+ $results .= "\nDirect to tape:\n\n";
+ } else {
+ $results .= "\nfile: " . $conf{PATH_TO_SAVE} . "/backup_" . $basename . $the_time . "." . $conf{OPTION_COMP} . "\n\n";
+ $results .= cat_("$conf{PATH_TO_SAVE}/list_" . $basename . $the_time . ".txt");
+ }
$results .= "\nignored:\n" . $ignore_files_list . "\n" if $ignore_files_list;
+
}
sub handle_ignores {
@@ -1316,7 +1342,7 @@ sub check_pkg_needs() {
}
sub show_status() {
- my $text = new Gtk2::TextView;
+ my $text = Gtk2::TextView->new;
destroy_widget();
my $scrolled_window = Gtk2::ScrolledWindow->new;
$scrolled_window->set_border_width(10);
@@ -1324,7 +1350,7 @@ sub show_status() {
gtktext_insert(gtkset_editable($text, 0), [ [ $results ] ]);
gtkpack($advanced_box,
- $table = gtkpack_(new Gtk2::VBox(0,10), 1, $scrolled_window)
+ $table = gtkpack_(Gtk2::VBox->new(0,10), 1, $scrolled_window)
);
$central_widget = \$table;
$table->show_all;
@@ -1350,15 +1376,17 @@ sub filedialog_generic {
my ($prompt, $widget) = @_;
my $file_dialog;
- $file_dialog = gtksignal_connect(new Gtk2::FileSelection($prompt), destroy => sub { $file_dialog->destroy });
+ $file_dialog = gtksignal_connect(Gtk2::FileSelection->new($prompt), destroy => sub { $file_dialog->destroy });
$file_dialog->ok_button->signal_connect(clicked => sub {
if (defined($widget)) {
$$widget->set_text($file_dialog->get_filename);
} else {
my $file_name = $file_dialog->get_filename;
+ #- catch files and dirs with spaces
+ $file_name = '"' . $file_name . '"' if $file_name =~ / /;
if (!member($file_name, @other_files)) {
push(@other_files, $file_name);
- $list_model->append_set(undef, $file_name);
+ $list_model->append_set(0, $file_name);
}
}
$file_dialog->destroy;
@@ -1389,17 +1417,17 @@ sub advanced_what_sys() {
my $box_what_sys;
gtkpack($advanced_box,
- $box_what_sys = gtkpack_(new Gtk2::VBox(0, 15),
+ $box_what_sys = gtkpack_(Gtk2::VBox->new(0, 15),
1, N("\nPlease check all options that you need.\n"),
1, N("These options can backup and restore all files in your /etc directory.\n"),
- 0, my $check_what_sys = new Gtk2::CheckButton(N("Backup your System files. (/etc directory)")),
- 0, my $check_what_versions = new Gtk2::CheckButton(N("Use Incremental/Differential Backups (do not replace old backups)")),
- 0, gtkpack__(new Gtk2::HBox(0,0),
+ 0, my $check_what_sys = Gtk2::CheckButton->new(N("Backup your System files. (/etc directory)")),
+ 0, my $check_what_versions = Gtk2::CheckButton->new(N("Use Incremental/Differential Backups (do not replace old backups)")),
+ 0, gtkpack__(Gtk2::HBox->new(0,0),
my @mode_buttons = gtkradio((N("Use Incremental Backups")) x 2, N("Use Differential Backups")),
),
- 0, my $check_what_critical = new Gtk2::CheckButton(N("Do not include critical files (passwd, group, fstab)")),
+ 0, my $check_what_critical = Gtk2::CheckButton->new(N("Do not include critical files (passwd, group, fstab)")),
0, N("With this option you will be able to restore any version\n of your /etc directory."),
- 1, new Gtk2::VBox(0, 15),
+ 1, Gtk2::VBox->new(0, 15),
),
);
check_list([$check_what_sys, \$conf{NO_SYS_FILES}, 1], [$check_what_critical, \$conf{NO_CRITICAL_SYS}]);
@@ -1428,14 +1456,14 @@ sub advanced_what_user {
all_user_list();
gtkpack($advanced_box,
- $box_what_user = gtkpack_(new Gtk2::VBox(0, 15),
+ $box_what_user = gtkpack_(Gtk2::VBox->new(0, 15),
0, N("Please check all users that you want to include in your backup."),
- 0, new Gtk2::HSeparator,
+ 0, Gtk2::HSeparator->new,
1, create_scrolled_window(
- gtkpack__(new Gtk2::VBox(0,0),
+ gtkpack__(Gtk2::VBox->new(0,0),
map { my $name = $_;
my @user_list_tmp;
- my $b = new Gtk2::CheckButton($name);
+ my $b = Gtk2::CheckButton->new($name);
if (any { /^$name$/ } @user_list) {
$check_what_user{$_}[1] = 1;
gtkset_active($b, 1);
@@ -1456,9 +1484,9 @@ sub advanced_what_user {
$b } (@user_list_all)
),
),
- 0, my $check_what_browser = new Gtk2::CheckButton(N("Do not include the browser cache")),
- 0, my $check_what_user_versions = new Gtk2::CheckButton(N("Use Incremental/Differential Backups (do not replace old backups)")),
- 0, gtkpack__(new Gtk2::HBox(0,0),
+ 0, my $check_what_browser = Gtk2::CheckButton->new(N("Do not include the browser cache")),
+ 0, my $check_what_user_versions = Gtk2::CheckButton->new(N("Use Incremental/Differential Backups (do not replace old backups)")),
+ 0, gtkpack__(Gtk2::HBox->new(0,0),
my @mode_buttons = gtkradio((N("Use Incremental Backups")) x 2, N("Use Differential Backups")),
),
),
@@ -1494,7 +1522,7 @@ sub advanced_what_other() {
$list_others->set_headers_visible(0);
foreach (@other_files) {
- $list_model->append_set(undef, $_);
+ $list_model->append_set(0, $_);
}
$list_others->get_selection->signal_connect(changed => sub {
@@ -1505,11 +1533,11 @@ sub advanced_what_other() {
});
gtkpack($advanced_box,
- $box_what_other = gtkpack_(new Gtk2::VBox(0, 15),
- 1, gtkpack_(new Gtk2::HBox(0,4),
+ $box_what_other = gtkpack_(Gtk2::VBox->new(0, 15),
+ 1, gtkpack_(Gtk2::HBox->new(0,4),
1, create_scrolled_window($list_others),
),
- 0, gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'spread'),
+ 0, gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'spread'),
gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => sub { filedialog_generic(N("Select the files or directories and click on 'OK'"), undef) }),
gtksignal_connect(Gtk2::Button->new(N("Remove Selected")), clicked => sub {
$list_model->remove($file_iter) if $file_iter;
@@ -1523,8 +1551,8 @@ sub advanced_what_other() {
}
}),
),
- 0, my $check_what_other_versions = new Gtk2::CheckButton(N("Use Incremental/Differential Backups (do not replace old backups)")),
- 0, gtkpack__(new Gtk2::HBox(0,0),
+ 0, my $check_what_other_versions = Gtk2::CheckButton->new(N("Use Incremental/Differential Backups (do not replace old backups)")),
+ 0, gtkpack__(Gtk2::HBox->new(0,0),
my @mode_buttons = gtkradio((N("Use Incremental Backups")) x 2, N("Use Differential Backups")),
),
),
@@ -1552,35 +1580,35 @@ sub advanced_what() {
my $box_what;
gtkpack($advanced_box,
- $box_what = gtkpack_(new Gtk2::HBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
- 1, gtkpack_(new Gtk2::VBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
+ $box_what = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
+ 1, gtkpack_(Gtk2::VBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
1, gtksignal_connect(my $button_what_sys = Gtk2::Button->new,
clicked => sub { $box_what->destroy; advanced_what_sys() }),
1, gtksignal_connect(my $button_what_user = Gtk2::Button->new,
- clicked => sub { destroy_widget(); advanced_what_user() }),
+ clicked => sub { destroy_widget(); advanced_what_user(undef) }),
1, gtksignal_connect(my $button_what_other = Gtk2::Button->new,
clicked => sub { destroy_widget(); advanced_what_other() }),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
);
- $button_what_sys->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_what_sys->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-system-40"),
- new Gtk2::Label(N("System")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("System")),
+ Gtk2::HBox->new(0, 5)
));
- $button_what_user->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_what_user->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-users-40"),
- new Gtk2::Label(N("Users")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("Users")),
+ Gtk2::HBox->new(0, 5)
));
- $button_what_other->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_what_other->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-others-40"),
- new Gtk2::Label(N("Other")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("Other")),
+ Gtk2::HBox->new(0, 5)
));
gtkset_sensitive($button_what_sys, !$conf{NO_SYS_FILES});
fonction_env(\$box_what, \&advanced_what, \&advanced_box);
@@ -1592,42 +1620,42 @@ sub advanced_where_net_types {
my $box_where_net;
gtkpack($advanced_box,
- $box_where_net = gtkpack_(new Gtk2::VBox(0, 10),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, my $check_where_use_net = new Gtk2::CheckButton(N("Use network connection to backup")),
- 1, new Gtk2::HBox(0,10),
- 0, new Gtk2::Label(N("Net Method:")),
+ $box_where_net = gtkpack_(Gtk2::VBox->new(0, 10),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, my $check_where_use_net = Gtk2::CheckButton->new(N("Use network connection to backup")),
+ 1, Gtk2::HBox->new(0,10),
+ 0, Gtk2::Label->new(N("Net Method:")),
0, gtkset_sensitive(my $entry_net_type = Gtk2::ComboBox->new_text, $conf{USE_NET}),
),
- 0, gtkpack_(new Gtk2::HBox(0,5),
- 0, gtkset_sensitive(my $check_use_expect = new Gtk2::CheckButton(N("Use Expect for SSH")), ($conf{USE_NET} && $conf{NET_PROTO} eq 'ssh')),
- 0, gtkset_sensitive(my $check_xfer_keys = new Gtk2::CheckButton(N("Create/Transfer backup keys for SSH")), ($conf{USE_NET} && $conf{NET_PROTO} eq 'ssh')),
- 1, new Gtk2::HBox(0,10),
+ 0, gtkpack_(Gtk2::HBox->new(0,5),
+ 0, gtkset_sensitive(my $check_use_expect = Gtk2::CheckButton->new(N("Use Expect for SSH")), ($conf{USE_NET} && $conf{NET_PROTO} eq 'ssh')),
+ 0, gtkset_sensitive(my $check_xfer_keys = Gtk2::CheckButton->new(N("Create/Transfer backup keys for SSH")), ($conf{USE_NET} && $conf{NET_PROTO} eq 'ssh')),
+ 1, Gtk2::HBox->new(0,10),
0, gtkset_sensitive(my $button_xfer_keys = Gtk2::Button->new(N("Transfer Now")), $conf{DRAK_KEYS}),
),
- 0, gtkset_sensitive(my $check_user_keys = new Gtk2::CheckButton(N("Other (not drakbackup) keys in place already")), ($conf{USE_NET} && $conf{NET_PROTO} eq 'ssh')),
- 0, new Gtk2::HSeparator,
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Host name or IP.")), $conf{USE_NET}),
- 1, new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(my $host_name_entry = new Gtk2::Entry(), $conf{USE_NET}),
+ 0, gtkset_sensitive(my $check_user_keys = Gtk2::CheckButton->new(N("Other (not drakbackup) keys in place already")), ($conf{USE_NET} && $conf{NET_PROTO} eq 'ssh')),
+ 0, Gtk2::HSeparator->new,
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Host name or IP.")), $conf{USE_NET}),
+ 1, Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(my $host_name_entry = Gtk2::Entry->new, $conf{USE_NET}),
),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Directory (or module) to put the backup on this host.")), $conf{USE_NET}),
- 1, new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(my $host_path_entry = new Gtk2::Entry(), $conf{USE_NET}),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Directory (or module) to put the backup on this host.")), $conf{USE_NET}),
+ 1, Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(my $host_path_entry = Gtk2::Entry->new, $conf{USE_NET}),
),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Login name")), $conf{USE_NET}),
- 1, new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(my $login_user_entry = new Gtk2::Entry(), $conf{USE_NET}),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Login name")), $conf{USE_NET}),
+ 1, Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(my $login_user_entry = Gtk2::Entry->new, $conf{USE_NET}),
),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Password")), $conf{USE_NET}),
- 1, new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(my $check_remember_pass = new Gtk2::CheckButton(N("Remember this password")), $conf{USE_NET}),
- 1, new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(my $passwd_user_entry = new Gtk2::Entry(), $conf{USE_NET}),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Password")), $conf{USE_NET}),
+ 1, Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(my $check_remember_pass = Gtk2::CheckButton->new(N("Remember this password")), $conf{USE_NET}),
+ 1, Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(my $passwd_user_entry = Gtk2::Entry->new, $conf{USE_NET}),
),
),
);
@@ -1727,61 +1755,54 @@ sub advanced_where_cd {
$dev_codes{$cd_devices{$key}{rec_dev}} = $key;
}
- my $combo_where_cd_device = Gtk2::ComboBox->new_text;
- if (keys %cd_devices) {
- $combo_where_cd_device->set_popdown_strings('', sort keys %dev_codes);
- } else {
- $combo_where_cd_device->set_popdown_strings(@no_devices);
- }
-
- my $combo_where_cd_time = Gtk2::ComboBox->new_text;
- $combo_where_cd_time->set_popdown_strings("650 MB", "700 MB", "750 MB", "800 MB", "4.7 GB");
+ my $combo_where_cd_device = Gtk2::ComboBox->new_with_strings(%cd_devices ? [ sort keys %dev_codes ] : \@no_devices);
+ my $combo_where_cd_time = Gtk2::ComboBox->new_with_strings([ "650 MB", "700 MB", "750 MB", "800 MB", "4.7 GB" ]);
gtkpack($advanced_box,
- $box_where_cd = gtkpack_(new Gtk2::VBox(0, 6),
- 0, my $check_where_cd = new Gtk2::CheckButton(N("Use CD-R/DVD-R to backup")),
- 0, new Gtk2::HSeparator,
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Choose your CD/DVD device")), $conf{USE_CD}),
- 1, new Gtk2::VBox(0, 5),
+ $box_where_cd = gtkpack_(Gtk2::VBox->new(0, 6),
+ 0, my $check_where_cd = Gtk2::CheckButton->new(N("Use CD-R/DVD-R to backup")),
+ 0, Gtk2::HSeparator->new,
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Choose your CD/DVD device")), $conf{USE_CD}),
+ 1, Gtk2::VBox->new(0, 5),
0, gtkset_sensitive($combo_where_cd_device, $conf{USE_CD}),
),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Choose your CD/DVD media size")), $conf{USE_CD}),
- 1, new Gtk2::VBox(0, 5),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Choose your CD/DVD media size")), $conf{USE_CD}),
+ 1, Gtk2::VBox->new(0, 5),
0, gtkset_sensitive($combo_where_cd_time, $conf{USE_CD}),
),
- 0, new Gtk2::VBox(0, 5),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 1, new Gtk2::VBox(0, 5),
- 0, gtkset_sensitive(new Gtk2::Label(N("Multisession CD")), $conf{USE_CD}),
- 0, gtkset_sensitive(my $check_multisession = new Gtk2::CheckButton(), $conf{USE_CD}),
- 0, gtkset_sensitive(new Gtk2::Label(N("CDRW media")), $conf{USE_CD}),
- 0, gtkset_sensitive(my $check_cdrw = new Gtk2::CheckButton(), $conf{USE_CD}),
+ 0, Gtk2::VBox->new(0, 5),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 1, Gtk2::VBox->new(0, 5),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Multisession CD")), $conf{USE_CD}),
+ 0, gtkset_sensitive(my $check_multisession = Gtk2::CheckButton->new, $conf{USE_CD}),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("CDRW media")), $conf{USE_CD}),
+ 0, gtkset_sensitive(my $check_cdrw = Gtk2::CheckButton->new, $conf{USE_CD}),
),
- 0, new Gtk2::VBox(0, 5),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 1, new Gtk2::VBox(0, 5),
- 0, gtkset_sensitive(new Gtk2::Label(N("Erase your RW media (1st Session)")), $conf{CDRW} && $conf{USE_CD}),
+ 0, Gtk2::VBox->new(0, 5),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 1, Gtk2::VBox->new(0, 5),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Erase your RW media (1st Session)")), $conf{CDRW} && $conf{USE_CD}),
0, gtkset_sensitive(my $button_erase_now = Gtk2::Button->new(N(" Erase Now ")), $conf{CDRW}),
- 0, gtkset_sensitive(my $check_cdrw_erase = new Gtk2::CheckButton(), $conf{CDRW} && $conf{USE_CD}),
+ 0, gtkset_sensitive(my $check_cdrw_erase = Gtk2::CheckButton->new, $conf{CDRW} && $conf{USE_CD}),
),
- 0, new Gtk2::VBox(0, 5),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 1, new Gtk2::VBox(0, 5),
- 0, gtkset_sensitive(new Gtk2::Label(N("DVD+RW media")), $conf{USE_CD}),
- 0, gtkset_sensitive(my $check_dvdrw = new Gtk2::CheckButton(), $conf{USE_CD}),
- 0, gtkset_sensitive(new Gtk2::Label(N("DVD-R media")), $conf{USE_CD}),
- 0, gtkset_sensitive(my $check_dvdr = new Gtk2::CheckButton(), $conf{USE_CD}),
- 0, gtkset_sensitive(new Gtk2::Label(N("DVDRAM device")), $conf{USE_CD}),
- 0, gtkset_sensitive(my $check_dvdram = new Gtk2::CheckButton(), $conf{USE_CD}),
+ 0, Gtk2::VBox->new(0, 5),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 1, Gtk2::VBox->new(0, 5),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("DVD+RW media")), $conf{USE_CD}),
+ 0, gtkset_sensitive(my $check_dvdrw = Gtk2::CheckButton->new, $conf{USE_CD}),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("DVD-R media")), $conf{USE_CD}),
+ 0, gtkset_sensitive(my $check_dvdr = Gtk2::CheckButton->new, $conf{USE_CD}),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("DVDRAM device")), $conf{USE_CD}),
+ 0, gtkset_sensitive(my $check_dvdram = Gtk2::CheckButton->new, $conf{USE_CD}),
),
),
);
foreach ([$check_cdrw_erase, \$conf{MEDIA_ERASE}], [$check_dvdrw, \$conf{DVDRW}], [$check_dvdr, \$conf{DVDR}], [$check_dvdram, \$conf{DVDRAM}], [$check_multisession, \$conf{MULTI_SESSION}]) {
my $ref = $_->[1];
- gtksignal_connect(gtkset_active($_->[0], $$ref), toggled => sub { $$ref = $$ref ? 0 : 1 })
+ gtksignal_connect(gtkset_active($_->[0], $$ref), toggled => sub { $$ref = $$ref ? 0 : 1 });
}
gtksignal_connect(gtkset_active($check_where_cd, $conf{USE_CD}), toggled => sub {
$conf{USE_CD} = $conf{USE_CD} ? 0 : 1;
@@ -1808,10 +1829,10 @@ sub advanced_where_cd {
}
});
- $combo_where_cd_time->entry->set_text($conf{CD_TIME});
+ $combo_where_cd_time->entry->set_text($conf{CD_TIME}) if $conf{CD_TIME};
$combo_where_cd_time->entry->signal_connect('changed', sub { $conf{CD_TIME} = $combo_where_cd_time->entry->get_text });
- $combo_where_cd_device->entry->set_text($conf{CD_DEVICE});
+ $combo_where_cd_device->entry->set_text($conf{CD_DEVICE}) if $conf{CD_DEVICE};
$combo_where_cd_device->entry->signal_connect('changed', sub {
$conf{CD_DEVICE} = $combo_where_cd_device->entry->get_text;
$std_device = $dev_codes{$conf{CD_DEVICE}};
@@ -1838,46 +1859,47 @@ sub advanced_where_tape {
#- look for tape devices;
get_tape_info();
- my $combo_where_tape_device = Gtk2::ComboBox->new_text;
- if (@tape_devices) {
- $combo_where_tape_device->set_popdown_strings('', @tape_devices)
- } else {
- $combo_where_tape_device->set_popdown_strings(@no_devices);
- }
+ my $combo_where_tape_device = Gtk2::ComboBox->new_with_strings(@tape_devices ? \@tape_devices : \@no_devices);
my $box_where_tape;
local $_;
gtkpack($advanced_box,
- $box_where_tape = gtkpack_(new Gtk2::VBox(0, 6),
- 0, new Gtk2::HSeparator,
- 0, my $check_where_tape = new Gtk2::CheckButton(N("Use tape to backup")),
- 0, new Gtk2::HSeparator,
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Device name to use for backup")), $conf{USE_TAPE}),
- 1, new Gtk2::VBox(0, 6),
+ $box_where_tape = gtkpack_(Gtk2::VBox->new(0, 6),
+ 0, Gtk2::HSeparator->new,
+ 0, my $check_where_tape = Gtk2::CheckButton->new(N("Use tape to backup")),
+ 0, Gtk2::HSeparator->new,
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Device name to use for backup")), $conf{USE_TAPE}),
+ 1, Gtk2::VBox->new(0, 6),
0, gtkset_sensitive($combo_where_tape_device, $conf{USE_TAPE}),
),
- 0, new Gtk2::VBox(0, 5),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Don't rewind tape after backup")), $conf{USE_TAPE}),
- 1, new Gtk2::VBox(0, 5),
- 0, gtkset_sensitive(my $check_tape_rewind = new Gtk2::CheckButton(), $conf{USE_TAPE}),
+ 0, Gtk2::VBox->new(0, 5),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Backup directly to tape")), $conf{USE_TAPE}),
+ 1, Gtk2::VBox->new(0, 5),
+ 0, gtkset_sensitive(my $direct_to_tape = Gtk2::CheckButton->new, $conf{USE_TAPE}),
),
- 0, new Gtk2::VBox(0, 5),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Erase tape before backup")), $conf{USE_TAPE}),
- 1, new Gtk2::VBox(0, 5),
- 0, gtkset_sensitive(my $check_tape_erase = new Gtk2::CheckButton(), $conf{USE_TAPE}),
+ 0, Gtk2::VBox->new(0, 5),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Don't rewind tape after backup")), $conf{USE_TAPE}),
+ 1, Gtk2::VBox->new(0, 5),
+ 0, gtkset_sensitive(my $check_tape_rewind = Gtk2::CheckButton->new, $conf{USE_TAPE}),
),
- 0, new Gtk2::VBox(0, 5),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Eject tape after the backup")), $conf{USE_TAPE}),
- 1, new Gtk2::VBox(0, 5),
- 0, gtkset_sensitive(my $check_tape_eject = new Gtk2::CheckButton(), $conf{USE_TAPE}),
+ 0, Gtk2::VBox->new(0, 5),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Erase tape before backup")), $conf{USE_TAPE}),
+ 1, Gtk2::VBox->new(0, 5),
+ 0, gtkset_sensitive(my $check_tape_erase = Gtk2::CheckButton->new, $conf{USE_TAPE}),
),
- 0, new Gtk2::VBox(0, 6),
- 0, gtkpack_(new Gtk2::HBox(0,10),),
+ 0, Gtk2::VBox->new(0, 5),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Eject tape after the backup")), $conf{USE_TAPE}),
+ 1, Gtk2::VBox->new(0, 5),
+ 0, gtkset_sensitive(my $check_tape_eject = Gtk2::CheckButton->new, $conf{USE_TAPE}),
+ ),
+ 0, Gtk2::VBox->new(0, 6),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),),
),
);
gtksignal_connect(gtkset_active($check_where_tape, $conf{USE_TAPE}), toggled => sub {
@@ -1902,6 +1924,11 @@ sub advanced_where_tape {
destroy_widget();
$current_widget->($previous_function);
});
+ gtksignal_connect(gtkset_active($direct_to_tape, $conf{DIRECT_TAPE}), toggled => sub {
+ $conf{DIRECT_TAPE} = $conf{DIRECT_TAPE} ? 0 : 1;
+ destroy_widget();
+ $current_widget->($previous_function);
+ });
gtksignal_connect(gtkset_active($check_tape_erase, $conf{MEDIA_ERASE}), toggled => sub {
$conf{MEDIA_ERASE} = $conf{MEDIA_ERASE} ? 0 : 1;
destroy_widget();
@@ -1912,7 +1939,7 @@ sub advanced_where_tape {
destroy_widget();
$current_widget->($previous_function);
});
- $combo_where_tape_device->entry->set_text($conf{TAPE_DEVICE});
+ $combo_where_tape_device->entry->set_text($conf{TAPE_DEVICE}) if $conf{TAPE_DEVICE};
$combo_where_tape_device->entry->signal_connect('changed', sub {
$conf{TAPE_DEVICE} = $combo_where_tape_device->entry->get_text;
});
@@ -1932,29 +1959,29 @@ sub advanced_where_hd {
if ($conf{MAX_SPACE} == 1000.0) {
$conf{MAX_SPACE} = int(0.8 * get_free_space($conf{PATH_TO_SAVE})) if -d $conf{PATH_TO_SAVE};
}
- my $adj = new Gtk2::Adjustment($conf{MAX_SPACE}, 0.0, $conf{MAX_SPACE}, 10.0, 5.0, 0.0);
+ my $adj = Gtk2::Adjustment->new($conf{MAX_SPACE}, 0.0, $conf{MAX_SPACE}, 10.0, 5.0, 0.0);
my $spinner;
gtkpack($advanced_box,
- $box_where_hd = gtkpack_(new Gtk2::VBox(0, 6),
- 0, new Gtk2::HSeparator,
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Enter the directory to save to:")), $conf{USE_HD}),
- 1, new Gtk2::VBox(0, 6),
- 0, gtkset_size_request(gtkset_sensitive($save_path_entry = new Gtk2::Entry(), $conf{USE_HD}), 152, 20),
+ $box_where_hd = gtkpack_(Gtk2::VBox->new(0, 6),
+ 0, Gtk2::HSeparator->new,
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Enter the directory to save to:")), $conf{USE_HD}),
+ 1, Gtk2::VBox->new(0, 6),
+ 0, gtkset_size_request(gtkset_sensitive($save_path_entry = Gtk2::Entry->new, $conf{USE_HD}), 152, 20),
0, gtkset_sensitive($button = gtksignal_connect(Gtk2::Button->new, clicked => sub {
- filedialog_generic(N("Directory to save to"), \$save_path_entry)
+ filedialog_generic(N("Directory to save to"), \$save_path_entry);
}), $conf{USE_HD}),
),
- 0, new Gtk2::VBox(0, 6),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Maximum size\n allowed for Drakbackup (MB)")), $conf{USE_HD}),
- 1, new Gtk2::VBox(0, 6),
- 0, gtkset_size_request(gtkset_sensitive($spinner = new Gtk2::SpinButton($adj, 0, 0), $conf{USE_HD}), 200, 20),
+ 0, Gtk2::VBox->new(0, 6),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Maximum size\n allowed for Drakbackup (MB)")), $conf{USE_HD}),
+ 1, Gtk2::VBox->new(0, 6),
+ 0, gtkset_size_request(gtkset_sensitive($spinner = Gtk2::SpinButton->new($adj, 0, 0), $conf{USE_HD}), 200, 20),
),
),
);
- $button->add(gtkpack(new Gtk2::HBox(0,10), gtkcreate_img("ic82-dossier-32")));
+ $button->add(gtkpack(Gtk2::HBox->new(0,10), gtkcreate_img("ic82-dossier-32")));
$save_path_entry->set_text($conf{PATH_TO_SAVE});
$spinner->signal_connect('changed', sub { $conf{MAX_SPACE} = $spinner->get_text });
$save_path_entry->signal_connect('changed', sub {
@@ -1980,50 +2007,50 @@ sub advanced_where() {
my $box_where;
gtkpack($advanced_box,
- $box_where = gtkpack_(new Gtk2::HBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
- 1, gtkpack_(new Gtk2::VBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
+ $box_where = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
+ 1, gtkpack_(Gtk2::VBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
1, gtksignal_connect(my $button_where_net = Gtk2::Button->new, clicked => sub {
destroy_widget();
- advanced_where_net_types();
+ advanced_where_net_types(undef);
}),
1, gtksignal_connect(my $button_where_cd = Gtk2::Button->new, clicked => sub {
destroy_widget();
- advanced_where_cd();
+ advanced_where_cd(undef);
}),
1, gtksignal_connect(my $button_where_hd = Gtk2::Button->new, clicked => sub {
destroy_widget();
- advanced_where_hd();
+ advanced_where_hd(undef);
}),
1, gtksignal_connect(my $button_where_tape = Gtk2::Button->new, clicked => sub {
destroy_widget();
- advanced_where_tape()
+ advanced_where_tape(undef);
}),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
);
- $button_where_net->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_where_net->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-network-40"),
- new Gtk2::Label(N("Network")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("Network")),
+ Gtk2::HBox->new(0, 5)
));
- $button_where_cd->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_where_cd->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-CD-40"),
- new Gtk2::Label(N("CD-R / DVD-R")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("CD-R / DVD-R")),
+ Gtk2::HBox->new(0, 5)
));
- $button_where_hd->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_where_hd->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-discdurwhat-40"),
- new Gtk2::Label(N("HardDrive / NFS")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("HardDrive / NFS")),
+ Gtk2::HBox->new(0, 5)
));
- $button_where_tape->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_where_tape->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-tape-40"),
- new Gtk2::Label(N("Tape")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("Tape")),
+ Gtk2::HBox->new(0, 5)
));
fonction_env(\$box_where, \&advanced_where, \&advanced_box);
$up_box->show_all;
@@ -2032,7 +2059,7 @@ sub advanced_where() {
sub advanced_when() {
my $box_when;
my $allow_custom = $backup_daemon && $custom_cron;
- my $combo_when_space = Gtk2::ComboBox->new_text;
+ my $combo_when_space = Gtk2::ComboBox->new_with_strings([ "", N("hourly"), N("daily"), N("weekly"), N("monthly"), N("custom") ]);
my %trans = (N("hourly") => 'hourly',
N("daily") => 'daily',
N("weekly") => 'weekly',
@@ -2043,27 +2070,22 @@ sub advanced_when() {
'weekly' => N("weekly"),
'monthly' => N("monthly"),
'custom' => N("custom"));
- $combo_when_space->set_popdown_strings("", N("hourly"), N("daily"), N("weekly"), N("monthly"), N("custom"));
set_help_tip($combo_when_space, 'when_space');
#- custom setup - let user specify month, day of month, day of week, hour, minute
- my $combo_month_when = Gtk2::ComboBox->new_text;
my @months = ("*", N("January"), N("February"), N("March"),
N("April"), N("May"), N("June"), N("July"), N("August"), N("September"),
N("October"), N("November"), N("December"));
- $combo_month_when->set_popdown_strings(@months);
- my $combo_day_when = Gtk2::ComboBox->new_text;
- $combo_day_when->set_popdown_strings("*", (1..31));
- my $combo_weekday_when = Gtk2::ComboBox->new_text;
+ my $combo_month_when = Gtk2::ComboBox->new_with_strings(\@months);
+ my $combo_day_when = Gtk2::ComboBox->new_with_strings([ "*", (1..31) ]);
my @weekdays = ("*", N("Sunday"), N("Monday"), N("Tuesday"),
N("Wednesday"), N("Thursday"), N("Friday"), N("Saturday"));
- $combo_weekday_when->set_popdown_strings(@weekdays);
+ my $combo_weekday_when = Gtk2::ComboBox->new_with_strings(\@weekdays);
my $combo_hour_when = Gtk2::ComboBox->new_text;
$combo_hour_when->set_popdown_strings("*", (0..23));
- my $combo_minute_when = Gtk2::ComboBox->new_text;
- $combo_minute_when->set_popdown_strings("*", (0..59));
+ my $combo_minute_when = Gtk2::ComboBox->new_with_strings([ "*", (0..59) ]);
- my $entry_crontab = new Gtk2::Entry();
+ my $entry_crontab = Gtk2::Entry->new;
gtkset_editable($entry_crontab, 0);
my @time_list = split(" ", $time_string);
@@ -2082,62 +2104,60 @@ sub advanced_when() {
}
#- drop down list of possible media - default to config value
- my $entry_media_type = Gtk2::ComboBox->new_text;
- $entry_media_type->set_popdown_strings(sort(@net_methods, @media_types));
- $entry_media_type->entry->set_text($conf{DAEMON_MEDIA});
+ my $entry_media_type = Gtk2::ComboBox->new_with_strings([ sort(@net_methods, @media_types) ], $conf{DAEMON_MEDIA});
gtkpack($advanced_box,
- $box_when = gtkpack_(new Gtk2::VBox(0, 10),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 1, new Gtk2::HBox(0,10),
+ $box_when = gtkpack_(Gtk2::VBox->new(0, 10),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 1, Gtk2::HBox->new(0,10),
1, gtkcreate_img("ic82-when-40"),
- 0, my $check_when_daemon = new Gtk2::CheckButton(N("Use daemon")),
- 1, new Gtk2::HBox(0,10),
+ 0, my $check_when_daemon = Gtk2::CheckButton->new(N("Use daemon")),
+ 1, Gtk2::HBox->new(0,10),
),
- 0, new Gtk2::HSeparator,
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Please choose the time interval between each backup")), $backup_daemon),
- 1, new Gtk2::HBox(0,10),
+ 0, Gtk2::HSeparator->new,
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Please choose the time interval between each backup")), $backup_daemon),
+ 1, Gtk2::HBox->new(0,10),
0, gtkset_sensitive($combo_when_space, $backup_daemon),
),
- 0, new Gtk2::HSeparator,
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Custom setup/crontab entry:")), $allow_custom),
+ 0, Gtk2::HSeparator->new,
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Custom setup/crontab entry:")), $allow_custom),
1, gtkset_sensitive($entry_crontab, $allow_custom),
),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 1, gtkpack_(new Gtk2::VBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Minute")), $allow_custom),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 1, gtkpack_(Gtk2::VBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Minute")), $allow_custom),
0, gtkset_sensitive($combo_minute_when, $allow_custom),
),
- 1, gtkpack_(new Gtk2::VBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Hour")), $allow_custom),
+ 1, gtkpack_(Gtk2::VBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Hour")), $allow_custom),
0, gtkset_sensitive($combo_hour_when, $allow_custom),
),
- 1, gtkpack_(new Gtk2::VBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Day")), $allow_custom),
+ 1, gtkpack_(Gtk2::VBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Day")), $allow_custom),
0, gtkset_sensitive($combo_day_when, $allow_custom),
),
- 1, gtkpack_(new Gtk2::VBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Month")), $allow_custom),
+ 1, gtkpack_(Gtk2::VBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Month")), $allow_custom),
0, gtkset_sensitive($combo_month_when, $allow_custom),
),
- 1, gtkpack_(new Gtk2::VBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Weekday")), $allow_custom),
+ 1, gtkpack_(Gtk2::VBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Weekday")), $allow_custom),
0, gtkset_sensitive($combo_weekday_when, $allow_custom),
),
),
- 0, new Gtk2::HSeparator,
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Please choose the media for backup.")), $backup_daemon),
- 1, new Gtk2::HBox(0,10),
- 0, gtkpack_(new Gtk2::VBox(0,10),
+ 0, Gtk2::HSeparator->new,
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Please choose the media for backup.")), $backup_daemon),
+ 1, Gtk2::HBox->new(0,10),
+ 0, gtkpack_(Gtk2::VBox->new(0,10),
0, gtkset_sensitive($entry_media_type, $backup_daemon),
),
),
- 0, new Gtk2::HSeparator,
- 0, gtkset_sensitive(new Gtk2::Label(N("Please be sure that the cron daemon is included in your services.")), $backup_daemon),
- 0, gtkset_sensitive(new Gtk2::Label(N("Note that currently all 'net' media also use the hard drive.")), $backup_daemon),
+ 0, Gtk2::HSeparator->new,
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Please be sure that the cron daemon is included in your services.")), $backup_daemon),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Note that currently all 'net' media also use the hard drive.")), $backup_daemon),
),
);
@@ -2154,15 +2174,14 @@ sub advanced_when() {
advanced_when();
});
if ($custom_cron) {
- $entry_crontab->set_text("$time_string $exec_string")
+ $entry_crontab->set_text("$time_string $exec_string");
}
- $combo_minute_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_minute_when->get_history - 1, 0) });
- $combo_hour_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_hour_when->get_history - 1, 1) });
- $combo_day_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_day_when->get_history, 2) });
- $combo_month_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_month_when->get_history, 3) });
- $combo_weekday_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_weekday_when->get_history - 1, 4) });
-
+ $combo_minute_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_minute_when->get_text, 0) });
+ $combo_hour_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_hour_when->get_text, 1) });
+ $combo_day_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_day_when->get_text, 2) });
+ $combo_month_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_month_when->get_active, 3) });
+ $combo_weekday_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_weekday_when->get_active - 1, 4) });
$entry_media_type->entry->signal_connect('changed', sub { $conf{DAEMON_MEDIA} = $entry_media_type->entry->get_text });
fonction_env(\$box_when, \&advanced_when, \&advanced_box);
$up_box->show_all;
@@ -2170,8 +2189,8 @@ sub advanced_when() {
sub combo_to_cron_string {
my ($field, $location) = @_;
- $field = "*" if $field == 0 && $location > 1 && $location < 4;
- $field = "*" if $field == -1 && ($location < 2 || $location == 4);
+ $field = "*" if $field == 0 && $location == 3;
+ $field = "*" if $field == -1 && $location == 4;
my @time_list = split(" ", $time_string);
splice(@time_list, $location, 1, $field);
$time_string = join(" ", @time_list);
@@ -2181,30 +2200,28 @@ sub combo_to_cron_string {
sub advanced_options() {
my $box_options;
- my $entry_comp_mode = Gtk2::ComboBox->new_text;
- $entry_comp_mode->set_popdown_strings("tar", "tar.gz", "tar.bz2");
- $entry_comp_mode->entry->set_text($conf{OPTION_COMP});
+ my $entry_comp_mode = Gtk2::ComboBox->new_with_strings([ "tar", "tar.gz", "tar.bz2" ], $conf{OPTION_COMP});
gtkpack($advanced_box,
- $box_options = gtkpack_(new Gtk2::VBox(0, 15),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, new Gtk2::Label(N("Please choose the compression type")),
- 1, new Gtk2::HBox(0,10),
+ $box_options = gtkpack_(Gtk2::VBox->new(0, 15),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, Gtk2::Label->new(N("Please choose the compression type")),
+ 1, Gtk2::HBox->new(0,10),
0, $entry_comp_mode,
),
- 0, my $check_backupignore = new Gtk2::CheckButton(N("Use .backupignore files")),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, my $check_mail = new Gtk2::CheckButton(N("Send mail report after each backup to:")),
- 1, new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(my $mail_entry = new Gtk2::Entry(), $conf{SEND_MAIL}),
+ 0, my $check_backupignore = Gtk2::CheckButton->new(N("Use .backupignore files")),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, my $check_mail = Gtk2::CheckButton->new(N("Send mail report after each backup to:")),
+ 1, Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(my $mail_entry = Gtk2::Entry->new, $conf{SEND_MAIL}),
),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 1, new Gtk2::HBox(0,10),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 1, Gtk2::HBox->new(0,10),
0, N("SMTP server for mail:"),
- 1, new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(my $smtp_entry = new Gtk2::Entry(), $conf{SEND_MAIL}),
+ 1, Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(my $smtp_entry = Gtk2::Entry->new, $conf{SEND_MAIL}),
),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, my $check_del_hd_files = new Gtk2::CheckButton(N("Delete Hard Drive tar files after backup to other media.")),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, my $check_del_hd_files = Gtk2::CheckButton->new(N("Delete Hard Drive tar files after backup to other media.")),
),
),
);
@@ -2225,10 +2242,10 @@ sub advanced_box() {
my $box_adv;
gtkpack($advanced_box,
- $box_adv = gtkpack_(new Gtk2::HBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
- 1, gtkpack_(new Gtk2::VBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
+ $box_adv = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
+ 1, gtkpack_(Gtk2::VBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
1, gtksignal_connect(my $button_what = Gtk2::Button->new, clicked => sub {
destroy_widget(); advanced_what() }),
1, gtksignal_connect(my $button_where = Gtk2::Button->new, clicked => sub {
@@ -2237,30 +2254,30 @@ sub advanced_box() {
destroy_widget(); advanced_when() }),
1, gtksignal_connect(my $button_options = Gtk2::Button->new, clicked => sub {
destroy_widget(); advanced_options() }),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
);
- $button_what->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_what->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-discdurwhat-40"),
- new Gtk2::Label(N("What")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("What")),
+ Gtk2::HBox->new(0, 5)
));
- $button_where->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_where->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-where-40"),
- new Gtk2::Label(N("Where")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("Where")),
+ Gtk2::HBox->new(0, 5)
));
- $button_when->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_when->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-when-40"),
- new Gtk2::Label(N("When")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("When")),
+ Gtk2::HBox->new(0, 5)
));
- $button_options->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_options->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-moreoption-40"),
- new Gtk2::Label(N("More Options")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("More Options")),
+ Gtk2::HBox->new(0, 5)
));
fonction_env(\$box_adv, \&advanced_box, \&interactive_mode_box);
$up_box->show_all;
@@ -2270,17 +2287,19 @@ sub advanced_box() {
sub wizard_step3() {
destroy_widget();
- my $no_device = 1 if $conf{USE_CD} && $conf{CD_DEVICE} eq '' || $conf{USE_TAPE} && $conf{TAPE_DEVICE} eq '' || $conf{USE_NET} && $conf{NET_PROTO} eq '';
+ my $no_device = $conf{USE_CD} && $conf{CD_DEVICE} eq '' || $conf{USE_TAPE} && $conf{TAPE_DEVICE} eq '' || $conf{USE_NET} && $conf{NET_PROTO} eq '' && 1;
if ($no_device) {
show_warning("f", N("Backup destination not configured..."));
- wizard_step2();
+ advanced_where_net_types(\&wizard_step2) if $conf{USE_NET};
+ advanced_where_cd(\&wizard_step2) if $conf{USE_CD};
+ advanced_where_tape(\&wizard_step2) if $conf{USE_TAPE};
return;
}
if (check_pkg_needs()) {
install_rpm(\&wizard_step3, undef);
return;
}
- my $text = new Gtk2::TextView;
+ my $text = Gtk2::TextView->new;
save_conf_file();
read_conf_file();
system_state();
@@ -2288,8 +2307,8 @@ sub wizard_step3() {
button_box_restore_main();
gtkpack($advanced_box,
- $box2 = gtkpack_(new Gtk2::HBox(0, 15),
- 1, gtkpack_(new Gtk2::VBox(0,10),
+ $box2 = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, gtkpack_(Gtk2::VBox->new(0,10),
0, N("Drakbackup Configuration"),
1, create_scrolled_window($text),
),
@@ -2302,74 +2321,58 @@ sub wizard_step3() {
sub wizard_step2() {
gtkpack($advanced_box,
- $box2 = gtkpack_(new Gtk2::HBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
- 1, gtkpack_(new Gtk2::VBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
+ $box2 = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
+ 1, gtkpack_(Gtk2::VBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
0, N("Please choose where you want to backup"),
- 0, gtkpack_(new Gtk2::HBox(0, 15),
- 0, N("Hard Drive used to prepare backups for all media"),
- 1, new Gtk2::VBox(0, 5),
+ 0, gtkpack_(Gtk2::HBox->new(0, 15),
+ 0, gtkpack__(Gtk2::VBox->new(0, 10),
+ my @where_radio = gtkradio('', N("Hard Drive used to prepare backups for all media"), N("Across Network"), N("On CD-R"), N("On Tape Device")),
+ ),
+ 1, gtkpack_(Gtk2::HBox->new(0,5),),
+ 0, gtkpack_(Gtk2::VBox->new(0,5),
0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("Configure")), clicked => sub {
destroy_widget();
advanced_where_hd(\&wizard_step2);
}), $use_hd),
- ),
- 0, gtkpack_(new Gtk2::HBox(0, 15),
- 0, my $check_wizard_net = new Gtk2::CheckButton(N("Across Network")),
- 1, new Gtk2::VBox(0, 5),
0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("Configure")), clicked => sub {
destroy_widget();
advanced_where_net_types(\&wizard_step2);
}), $conf{USE_NET}),
- ),
- 0, gtkpack_(new Gtk2::HBox(0, 15),
- 0, my $check_wizard_cd = new Gtk2::CheckButton(N("On CD-R")),
- 1, new Gtk2::VBox(0, 5),
- 0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("Configure")), clicked => sub {
+ 0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("Configure")), clicked => sub {
destroy_widget();
advanced_where_cd(\&wizard_step2);
- }), $conf{USE_CD}),
- ),
- 0, gtkpack_(new Gtk2::HBox(0, 15),
- 0, my $check_wizard_tape = new Gtk2::CheckButton(N("On Tape Device")),
- 1, new Gtk2::VBox(0, 5),
- 0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("Configure")), clicked => sub {
+ }), $conf{USE_CD}),
+ 0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("Configure")), clicked => sub {
destroy_widget();
advanced_where_tape(\&wizard_step2);
}), $conf{USE_TAPE}),
- ),
- 1, new Gtk2::VBox(0, 5),
+ ),
+ ),
+ 1, Gtk2::VBox->new(0, 5),
),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
);
- gtksignal_connect(gtkset_active($check_wizard_cd, $conf{USE_CD}), toggled => sub {
- invbool \$conf{USE_CD};
- if ($conf{USE_CD}) { $conf{USE_TAPE} = 0; $conf{USE_NET} = 0 };
- refresh_wizard_step2();
- });
- gtksignal_connect(gtkset_active($check_wizard_net, $conf{USE_NET}), toggled => sub {
- invbool \$conf{USE_NET};
- if ($conf{USE_NET}) { $conf{USE_TAPE} = 0; $conf{USE_CD} = 0 };
- refresh_wizard_step2();
- });
- gtksignal_connect(gtkset_active($check_wizard_tape, $conf{USE_TAPE}), toggled => sub {
- invbool \$conf{USE_TAPE};
- if ($conf{USE_TAPE}) { $conf{USE_CD} = 0; $conf{USE_NET} = 0 };
- refresh_wizard_step2();
- });
+ my @wheres = ($use_hd, $conf{USE_NET}, $conf{USE_CD}, $conf{USE_TAPE});
+ foreach my $i (0..3) {
+ $where_radio[$i]->set_active($wheres[$i]);
+ $where_radio[$i]->signal_connect(toggled => sub {
+ if ($where_radio[$i]->get_active) {
+ @wheres = (0, 0, 0, 0);
+ $wheres[$i] = 1;
+ ($use_hd, $conf{USE_NET}, $conf{USE_CD}, $conf{USE_TAPE}) = @wheres;
+ destroy_widget();
+ wizard_step2();
+ }
+ });
+ }
fonction_env(\$box2, \&wizard_step2, \&wizard, undef);
button_box_wizard();
$up_box->show_all;
}
-sub refresh_wizard_step2() {
- $use_hd = !($conf{USE_TAPE} || $conf{USE_CD} || $conf{USE_NET});
- destroy_widget();
- wizard_step2();
-}
-
sub wizard() {
my $user_string = N("Backup Users");
$user_string .= N(" (Default is all users)") if !$nonroot_user;
@@ -2380,21 +2383,21 @@ sub wizard() {
}
gtkpack($advanced_box,
- $box2 = gtkpack_(new Gtk2::HBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
- 1, gtkpack_(new Gtk2::VBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
+ $box2 = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
+ 1, gtkpack_(Gtk2::VBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
0, N("Please choose what you want to backup"),
- 0, my $check_wizard_sys = new Gtk2::CheckButton(N("Backup System")),
- 0, my $check_wizard_user = new Gtk2::CheckButton($user_string),
+ 0, my $check_wizard_sys = Gtk2::CheckButton->new(N("Backup System")),
+ 0, my $check_wizard_user = Gtk2::CheckButton->new($user_string),
0, gtksignal_connect(Gtk2::Button->new(N("Select user manually")), clicked => sub {
$manual_user = 1;
destroy_widget();
advanced_what_user(\&wizard);
}),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
);
foreach ([$check_wizard_sys, \$conf{NO_SYS_FILES}], [$check_wizard_user, \$conf{NO_USER_FILES}]) {
@@ -2411,7 +2414,7 @@ sub wizard() {
} else {
@user_list = ();
}
- })
+ });
}
if (!$conf{NO_SYS_FILES} || !$conf{NO_USER_FILES} && @user_list) {
fonction_env(\$box2, \&wizard, \&interactive_mode_box, \&wizard_step2);
@@ -2503,16 +2506,16 @@ sub system_state() {
}
#- tape and CDRW share some features
- my $erase_media = N("NO");
- $erase_media = N("YES") if $conf{MEDIA_ERASE} && ($conf{USE_CD} || $conf{USE_TAPE});
+ my $erase_media = $conf{MEDIA_ERASE} && ($conf{USE_CD} || $conf{USE_TAPE}) ? N("Yes") : N("No");
$conf{USE_CD} and $system_state .= N("\n- Burn to CD");
$conf{USE_CD} and $conf{CDRW} and $system_state .= N("RW");
$conf{USE_CD} and $system_state .= N(" on device: %s", $conf{CD_DEVICE});
- $conf{USE_CD} and $conf{MULTI_SESSION} and $system_state .= N(" (multi-session)");
+ $conf{USE_CD} && $conf{MULTI_SESSION} and $system_state .= N(" (multi-session)");
$conf{USE_TAPE} and $system_state .= N("\n- Save to Tape on device: %s", $conf{TAPE_DEVICE});
(($conf{USE_CD} || $conf{USE_TAPE}) && $conf{MEDIA_ERASE}) and $system_state .= N("\t\tErase=%s", $erase_media);
$conf{USE_CD} || $conf{USE_TAPE} and $system_state .= "\n";
-
+ $conf{USE_TAPE} && $conf{DIRECT_TAPE} and $system_state .= N("\tBackup directly to Tape\n");
+
$conf{USE_NET} and $system_state .= N("\n- Save via %s on host: %s\n", $conf{NET_PROTO}, $conf{HOST_NAME});
$conf{USE_NET} and $system_state .= N("\t\t user name: %s\n\t\t on path: %s \n", $conf{LOGIN}, $conf{HOST_PATH});
$system_state .= N("\n- Options:\n");
@@ -2563,10 +2566,8 @@ sub restore_state() {
sub select_most_recent_selected_of {
my ($user_name) = @_;
- my @list_tmp2;
- local $_;
my @tmp = sort @user_list_to_restore2;
- foreach (grep { /$user_name/ } sort @tmp) { push @list_tmp2 , $_ }
+ my @list_tmp2 = grep { /$user_name/ } sort @tmp;
return pop @list_tmp2;
}
@@ -2578,7 +2579,7 @@ sub select_user_data_to_restore() {
@user_list_to_restore = ();
local $_;
- -d $path_to_find_restore and my @list_backup_tmp2 = grep { /^backup/ } all($path_to_find_restore);
+ my @list_backup_tmp2 = -d $path_to_find_restore && grep { /^backup/ } all($path_to_find_restore);
@list_tmp2 = @list_backup_tmp2;
foreach (@list_backup_tmp2) {
s/_base//gi;
@@ -2688,23 +2689,23 @@ sub show_backup_details {
log::explanations("Running $command1");
$archive_file_detail = `$command1 2>&1` . "\n\n";
log::explanations("Running $command2");
- local *TMP;
- open TMP, "$command2 2>&1 |";
- while ($value = <TMP>) {
+ my $TMP;
+ open $TMP, "$command2 2>&1 |";
+ while ($value = <$TMP>) {
#- drop the permissions display for the sake of readability
$archive_file_detail .= substr($value, 11);
}
- close TMP;
+ close $TMP;
- my $text = new Gtk2::TextView;
+ my $text = Gtk2::TextView->new;
my $advanced_box_archive;
gtktext_insert(gtkset_editable($text, 0), $archive_file_detail);
gtkpack($advanced_box,
- $advanced_box_archive = gtkpack_(new Gtk2::VBox(0,10),
- 1, gtkpack_(new Gtk2::HBox(0,0),
+ $advanced_box_archive = gtkpack_(Gtk2::VBox->new(0,10),
+ 1, gtkpack_(Gtk2::HBox->new(0,0),
1, create_scrolled_window($text),
),
- 0, gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'spread'),
+ 0, gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'spread'),
gtksignal_connect(Gtk2::Button->new(N("Done")), clicked => sub {
destroy_widget();
$function->() }),
@@ -2732,7 +2733,7 @@ sub valid_backup_test {
sub restore_aff_backup_problems() {
my $do_restore;
- my $text = new Gtk2::TextView;
+ my $text = Gtk2::TextView->new;
my $restore_pbs_state = N("List of data corrupted:\n\n");
$restore_pbs_state .= "\t\t$_\n" foreach @files_corrupted;
$restore_pbs_state .= N("Please uncheck or remove it on next time.");
@@ -2740,15 +2741,15 @@ sub restore_aff_backup_problems() {
button_box_restore_main();
gtkpack($advanced_box,
- $do_restore = gtkpack_(new Gtk2::VBox(0,10),
- 0, new Gtk2::VBox(0,10),
- 1, gtkpack_(new Gtk2::HBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
+ $do_restore = gtkpack_(Gtk2::VBox->new(0,10),
+ 0, Gtk2::VBox->new(0,10),
+ 1, gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
0, gtkcreate_img('warning'),
0, N("Backup files are corrupted"),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
- 0, new Gtk2::VBox(0,10),
+ 0, Gtk2::VBox->new(0,10),
1, create_scrolled_window($text),
),
);
@@ -2759,16 +2760,16 @@ sub restore_aff_backup_problems() {
sub restore_aff_result() {
my $do_restore;
- my $text = new Gtk2::TextView;
+ my $text = Gtk2::TextView->new;
gtktext_insert($text, [ [ $restore_state ] ]);
button_box_restore_main();
gtkpack($advanced_box,
- $do_restore = gtkpack_(new Gtk2::VBox(0,10),
- 1, new Gtk2::VBox(0,10),
+ $do_restore = gtkpack_(Gtk2::VBox->new(0,10),
+ 1, Gtk2::VBox->new(0,10),
0, N(" All of your selected data have been "),
- 0, N(" Successfuly Restored on %s ", $restore_path),
- 1, new Gtk2::VBox(0,10),
+ 0, N(" Successfully Restored on %s ", $restore_path),
+ 1, Gtk2::VBox->new(0,10),
),
);
button_box_ok_only();
@@ -2880,13 +2881,13 @@ sub restore_do() {
sub restore_do2() {
destroy_widget();
my $do_restore;
- my $text = new Gtk2::TextView;
+ my $text = Gtk2::TextView->new;
restore_state();
gtktext_insert($text, [ [ $restore_state ] ]);
button_box_restore_main();
gtkpack($advanced_box,
- $do_restore = gtkpack_(new Gtk2::VBox(0,10),
+ $do_restore = gtkpack_(Gtk2::VBox->new(0,10),
0, N(" Restore Configuration "),
1, create_scrolled_window($text),
),
@@ -2898,7 +2899,7 @@ sub restore_do2() {
sub restore_step_other() {
my $retore_step_other;
- my $text = new Gtk2::TextView;
+ my $text = Gtk2::TextView->new;
my $untar_cmd = "tar tzf";
my $other_rest = "";
select_other_data_to_restore();
@@ -2912,11 +2913,11 @@ sub restore_step_other() {
}
gtktext_insert($text, [ [ $other_rest ] ]);
gtkpack($advanced_box,
- $retore_step_other = gtkpack_(new Gtk2::VBox(0,10),
- 1, new Gtk2::VBox(0,10),
+ $retore_step_other = gtkpack_(Gtk2::VBox->new(0,10),
+ 1, Gtk2::VBox->new(0,10),
1, create_scrolled_window($text),
- 0, my $check_restore_other_sure = new Gtk2::CheckButton(N("OK to restore the other files.")),
- 1, new Gtk2::VBox(0,10),
+ 0, my $check_restore_other_sure = Gtk2::CheckButton->new(N("OK to restore the other files.")),
+ 1, Gtk2::VBox->new(0,10),
),
);
check_list([$check_restore_other_sure, \$restore_other]);
@@ -2929,21 +2930,21 @@ sub restore_step_user() {
my @tmp_list = sort @user_backuped;
@user_backuped = @tmp_list;
gtkpack($advanced_box,
- $retore_step_user = gtkpack_(new Gtk2::VBox(0,10),
- 0, new Gtk2::VBox(0,10),
+ $retore_step_user = gtkpack_(Gtk2::VBox->new(0,10),
+ 0, Gtk2::VBox->new(0,10),
0, N("User list to restore (only the most recent date per user is important)"),
- 1, create_scrolled_window(gtkpack__(new Gtk2::VBox(0,0),
+ 1, create_scrolled_window(gtkpack__(Gtk2::VBox->new(0,0),
map { my $name;
my $var2;
my $name_complet = $_;
$name = (split(' ', $name_complet))[0];
my @user_list_tmp;
- my $restore_row = new Gtk2::HBox(0,5);
- my $b = new Gtk2::CheckButton($name_complet);
+ my $restore_row = Gtk2::HBox->new(0,5);
+ my $b = Gtk2::CheckButton->new($name_complet);
my $details = Gtk2::Button->new(N("Details"));
$restore_row->pack_start($b, 1, 1, 0);
- $restore_row->pack_end(new Gtk2::VBox(1,5), 0, 0, 0);
+ $restore_row->pack_end(Gtk2::VBox->new(1,5), 0, 0, 0);
$restore_row->pack_end($details, 0, 0, 0);
foreach (@user_list_to_restore2) {
@@ -2959,7 +2960,7 @@ sub restore_step_user() {
if (!$check_user_to_restore{$name_complet}[1]) {
$check_user_to_restore{$name_complet}[1] = 1;
if (!any { /$name/ } @user_list_to_restore2) {
- push @user_list_to_restore2, $name_complet
+ push @user_list_to_restore2, $name_complet;
}
} else {
$check_user_to_restore{$name_complet}[1] = 0;
@@ -2993,17 +2994,15 @@ sub restore_step_user() {
sub restore_step_sys() {
my $restore_step_sys;
- my $combo_restore_step_sys = Gtk2::ComboBox->new_text;
- $combo_restore_step_sys->set_popdown_strings(@sys_backuped);
- $combo_restore_step_sys->entry->set_text($restore_step_sys_date);
+ my $combo_restore_step_sys = Gtk2::ComboBox->new_with_strings(\@sys_backuped, $restore_step_sys_date);
gtkpack($advanced_box,
- $restore_step_sys = gtkpack_(new Gtk2::VBox(0,10),
+ $restore_step_sys = gtkpack_(Gtk2::VBox->new(0,10),
0, N("Please choose the date to restore:"),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 1, new Gtk2::HBox(0,10),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 1, Gtk2::HBox->new(0,10),
0, $combo_restore_step_sys,
0, my $details = Gtk2::Button->new(N("Details")),
- 1, new Gtk2::HBox(0,10),
+ 1, Gtk2::HBox->new(0,10),
),
),
);
@@ -3033,19 +3032,19 @@ sub restore_other_media() {
my $button;
gtkpack($advanced_box,
- $box_find_restore = gtkpack_(new Gtk2::VBox(0, 6),
- 0, new Gtk2::HSeparator,
- 0, my $check_other_media_hd = new Gtk2::CheckButton(N("Restore from Hard Disk.")),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, gtkset_sensitive(new Gtk2::Label(N("Enter the directory where backups are stored")), $other_media_hd),
- 1, new Gtk2::VBox(0, 6),
- 0, gtkset_size_request(gtkset_sensitive($restore_find_path_entry = new Gtk2::Entry(), $other_media_hd), 152, 20),
+ $box_find_restore = gtkpack_(Gtk2::VBox->new(0, 6),
+ 0, Gtk2::HSeparator->new,
+ 0, my $check_other_media_hd = Gtk2::CheckButton->new(N("Restore from Hard Disk.")),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, gtkset_sensitive(Gtk2::Label->new(N("Enter the directory where backups are stored")), $other_media_hd),
+ 1, Gtk2::VBox->new(0, 6),
+ 0, gtkset_size_request(gtkset_sensitive($restore_find_path_entry = Gtk2::Entry->new, $other_media_hd), 152, 20),
0, gtkset_sensitive($button = gtksignal_connect(Gtk2::Button->new, clicked => sub {
filedialog_generic(N("Directory with backups"), \$restore_find_path_entry);
}), $other_media_hd),
),
- 1, new Gtk2::VBox(0, 6),
- 0, new Gtk2::VBox(0, 6),
+ 1, Gtk2::VBox->new(0, 6),
+ 0, Gtk2::VBox->new(0, 6),
),
);
gtksignal_connect(gtkset_active($check_other_media_hd, $other_media_hd), toggled => sub {
@@ -3053,7 +3052,7 @@ sub restore_other_media() {
destroy_widget();
$current_widget->();
});
- $button->add(gtkpack(new Gtk2::HBox(0,10), gtkcreate_img("ic82-dossier-32")));
+ $button->add(gtkpack(Gtk2::HBox->new(0,10), gtkcreate_img("ic82-dossier-32")));
$restore_find_path_entry->set_text($path_to_find_restore);
$restore_find_path_entry->signal_connect('changed', sub { $path_to_find_restore = $restore_find_path_entry->get_text });
fonction_env(\$box_find_restore, \&restore_other_media, \&restore_step2, \&restore_do);
@@ -3084,39 +3083,39 @@ sub restore_step2() {
$sys_exist = 0; $restore_sys = 0;
}
if (any { /_user_/ } grep { /^$info_prefix/ } all("$restore_info_path/")) {
- $user_exist = 1
+ $user_exist = 1;
} else {
$user_exist = 0; $restore_user = 0;
}
- my $restore_path_entry = new Gtk2::Entry();
+ my $restore_path_entry = Gtk2::Entry->new;
gtkpack($advanced_box,
- $retore_step2 = gtkpack_(new Gtk2::VBox(0,10),
- 1, new Gtk2::VBox(0,10),
- 1, new Gtk2::VBox(0,10),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, my $check_restore_other_src = new Gtk2::CheckButton(N("Select another media to restore from")),
- 1, new Gtk2::HBox(0,10),
+ $retore_step2 = gtkpack_(Gtk2::VBox->new(0,10),
+ 1, Gtk2::VBox->new(0,10),
+ 1, Gtk2::VBox->new(0,10),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, my $check_restore_other_src = Gtk2::CheckButton->new(N("Select another media to restore from")),
+ 1, Gtk2::HBox->new(0,10),
0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("Other Media")), clicked => sub {
destroy_widget();
restore_other_media();
}), $restore_other_src),
),
- 0, gtkset_sensitive(my $check_restore_sys = new Gtk2::CheckButton(N("Restore system")), $sys_exist),
- 0, gtkset_sensitive(my $check_restore_user = new Gtk2::CheckButton(N("Restore Users")), $user_exist),
- 0, gtkset_sensitive(my $check_restore_other = new Gtk2::CheckButton(N("Restore Other")), $other_exist),
- 0, gtkpack_(new Gtk2::HBox(0,10),
- 0, my $check_restore_other_path = new Gtk2::CheckButton(N("Select path to restore (instead of /)")),
- 1, new Gtk2::HBox(0,10),
+ 0, gtkset_sensitive(my $check_restore_sys = Gtk2::CheckButton->new(N("Restore system")), $sys_exist),
+ 0, gtkset_sensitive(my $check_restore_user = Gtk2::CheckButton->new(N("Restore Users")), $user_exist),
+ 0, gtkset_sensitive(my $check_restore_other = Gtk2::CheckButton->new(N("Restore Other")), $other_exist),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
+ 0, my $check_restore_other_path = Gtk2::CheckButton->new(N("Select path to restore (instead of /)")),
+ 1, Gtk2::HBox->new(0,10),
0, gtkset_sensitive($restore_path_entry, $restore_other_path),
- 0, gtksignal_connect(my $button = new Gtk2::Button->new, clicked => sub {
+ 0, gtksignal_connect(my $button = Gtk2::Button->new->new, clicked => sub {
filedialog_generic(N("Path To Restore To"), \$restore_path_entry);
}),
),
- 0, gtkset_sensitive(my $check_backup_bef_restore = new Gtk2::CheckButton(N("Do new backup before restore (only for incremental backups.)")),
+ 0, gtkset_sensitive(my $check_backup_bef_restore = Gtk2::CheckButton->new(N("Do new backup before restore (only for incremental backups.)")),
$conf{SYS_INCREMENTAL_BACKUPS} || $conf{USER_INCREMENTAL_BACKUPS}),
- 0, gtkset_sensitive(my $check_remove_user_dir = new Gtk2::CheckButton(N("Remove user directories before restore.")), $user_exist),
- 1, new Gtk2::VBox(0,10),
+ 0, gtkset_sensitive(my $check_remove_user_dir = Gtk2::CheckButton->new(N("Remove user directories before restore.")), $user_exist),
+ 1, Gtk2::VBox->new(0,10),
),
);
@@ -3139,7 +3138,7 @@ sub restore_step2() {
} else {
$next_widget = \&restore_do;
}
- })
+ });
}
gtksignal_connect(gtkset_active($check_restore_other_path, $restore_other_path), toggled => sub {
$restore_other_path = $restore_other_path ? 0 : 1;
@@ -3164,7 +3163,7 @@ sub restore_step2() {
} else {
$next_widget = \&restore_do;
}
- $button->add(gtkpack(new Gtk2::HBox(0,10), gtkcreate_img("ic82-dossier-32")));
+ $button->add(gtkpack(Gtk2::HBox->new(0,10), gtkcreate_img("ic82-dossier-32")));
$restore_path_entry->set_text($restore_path);
$restore_path_entry->signal_connect('changed', sub {
$restore_path = $restore_path_entry->get_text;
@@ -3196,37 +3195,36 @@ sub find_files_to_restore() {
$valcolumn->set_visible(0);
my $unselected = gtkcreate_pixbuf('unselected');
my $selected = gtkcreate_pixbuf('selected');
- my $file_wildcard_entry = new Gtk2::Entry();
+ my $file_wildcard_entry = Gtk2::Entry->new;
gtkpack($advanced_box,
- $file_restore = gtkpack_(new Gtk2::VBox(0,10),
- 0, new Gtk2::Label(N("Filename text substring to search for (empty string matches all):")),
- 0, gtkpack_(new Gtk2::HBox(0,10),
+ $file_restore = gtkpack_(Gtk2::VBox->new(0,10),
+ 0, Gtk2::Label->new(N("Filename text substring to search for (empty string matches all):")),
+ 0, gtkpack_(Gtk2::HBox->new(0,10),
1, $file_wildcard_entry,
- 0, gtksignal_connect(new Gtk2::Button(N("Search Backups")), clicked => sub {
+ 0, gtksignal_connect(Gtk2::Button->new(N("Search Backups")), clicked => sub {
local $_ = $file_wildcard_entry->get_text;
- s|^\*|\\\*|g;
+ s|^\*|\\*|g;
my $wildcard = $_;
@possible_sources = glob "$conf{PATH_TO_SAVE}/list*";
$model->clear;
my $match = 0;
foreach my $list (@possible_sources) {
- my @listing = cat_($list);
- my @matches = grep { /$wildcard/ } @listing;
+ my @matches = grep { /$wildcard/ } cat_($list);
if (@matches) {
my $list_entry = $model->append_set(undef, [ 0 => $list, 2 => '' ]);
foreach (@matches) {
chop;
$model->append_set($list_entry, [ 0 => $_, 1 => $unselected, 2 => 0 ]);
}
- $match = 1
+ $match = 1;
}
}
show_warning("i", N("No matches found...")) if $match == 0;
}),
),
1, create_scrolled_window($file_list),
- 0, gtkset_sensitive(gtksignal_connect($start_restore = new Gtk2::Button(N("Restore Selected")), clicked => sub {
+ 0, gtkset_sensitive(gtksignal_connect($start_restore = Gtk2::Button->new(N("Restore Selected")), clicked => sub {
@files_to_restore = ();
my $last_entry = '';
my $catalog_entry;
@@ -3340,7 +3338,7 @@ sub catalog_restore {
foreach (@contents) {
chop;
my $s = $_;
- $lmodel->append_set(undef, $s);
+ $lmodel->append_set(0, $s);
}
}
gtkset_mousecursor_normal();
@@ -3359,14 +3357,14 @@ sub catalog_restore {
});
gtkpack($advanced_box,
- $catalog_box = gtkpack_(new Gtk2::HBox(0,10),
- 1, gtkpack_(new Gtk2::VBox(0,5),
+ $catalog_box = gtkpack_(Gtk2::HBox->new(0,10),
+ 1, gtkpack_(Gtk2::VBox->new(0,5),
0, N("Click date/time to see backup files.\nCtrl-Click files to select multiple files."),
- 1, gtkpack_(new Gtk2::VBox(0, 10),
+ 1, gtkpack_(Gtk2::VBox->new(0, 10),
1, create_scrolled_window($tree_catalog),
1, create_scrolled_window($tree_files),
),
- 0, gtkpack_(new Gtk2::HBox(1, 10),
+ 0, gtkpack_(Gtk2::HBox->new(1, 10),
1, gtksignal_connect(Gtk2::Button->new(N("Restore Selected\nCatalog Entry")), clicked => sub {
if ($cat_entry) {
my $media_check = restore_catalog_entry($cat_entry, ());
@@ -3388,17 +3386,17 @@ sub catalog_restore {
}
}
}),
- 1, gtkpack_(new Gtk2::VBox(0, 5),
- 0, new Gtk2::Label("Restore To Path"),
- 0, $restore_path_entry = new Gtk2::Entry(),
+ 1, gtkpack_(Gtk2::VBox->new(0, 5),
+ 0, Gtk2::Label->new("Restore To Path"),
+ 0, $restore_path_entry = Gtk2::Entry->new,
),
- 0, gtksignal_connect(my $button = new Gtk2::Button(), clicked => sub {
+ 0, gtksignal_connect(my $button = Gtk2::Button->new, clicked => sub {
filedialog_generic(N("Path To Restore To"), \$restore_path_entry);
}),
),
- 0, new Gtk2::VBox(0,10),
+ 0, Gtk2::VBox->new(0,10),
),
- 0, new Gtk2::VBox(0,10),
+ 0, Gtk2::VBox->new(0,10),
),
);
@@ -3407,9 +3405,9 @@ sub catalog_restore {
$restore_path = $restore_path_entry->get_text;
$untar_prefix = "tar -C $restore_path -x";
});
- $button->add(gtkpack(new Gtk2::HBox(0,10), gtkcreate_img("ic82-dossier-32")));
+ $button->add(gtkpack(Gtk2::HBox->new(0,10), gtkcreate_img("ic82-dossier-32")));
button_box_restore();
- fonction_env(\$catalog_box, \&catalog_restore, \&restore_find_media_box, \&catalog_restore) if $call_method eq "need media";;
+ fonction_env(\$catalog_box, \&catalog_restore, \&restore_find_media_box, \&catalog_restore) if $call_method eq "need media";
fonction_env(\$catalog_box, \&catalog_restore, \&restore_box, \&catalog_restore) if $call_method eq "button";
$central_widget = \$catalog_box;
$up_box->show_all;
@@ -3475,7 +3473,7 @@ sub restore_catalog_entry {
}
}
- if ($media eq 'Tape') {
+ if ($media =~ /^DirectTape|^Tape/) {
#- a little more complicated, we need to check if other backups
#- were done on this tape, and try to find the offset to this one
$in->ask_okcancel(N("Restore From Tape"), N("Insert the tape with volume label %s\n in the tape drive device %s", $vol_host, $dev_path) ,1) ? ($vol_name = get_tape_label($dev_path)) : return 0;
@@ -3483,7 +3481,7 @@ sub restore_catalog_entry {
show_warning("f", N("Not the correct tape label. Tape is labelled %s.", $vol_name));
return 0;
} else {
- $restore_result = restore_tape($cat_entry, $dev_path, @restore_files);
+ $restore_result = restore_tape($media, $cat_entry, $dev_path, @restore_files);
}
}
@@ -3574,15 +3572,28 @@ sub restore_hd_or_cd {
}
sub restore_tape {
- my ($cat_entry, $dev_path, @restore_files) = @_;
+ my ($media, $cat_entry, $dev_path, @restore_files) = @_;
my $indv_files = @restore_files;
my $wild_card = catalog_to_wildcard($cat_entry);
$dev_path =~ s|/st|/nst|;
+ my $command = "tar -C $restore_path -xf $dev_path";
+
+ if ($media eq "DirectTape") {
+ position_tape($cat_entry, $dev_path);
+ if ($indv_files != 0) {
+ foreach (@restore_files) {
+ $command .= " " . substr($_, 1);
+ }
+ }
+ spawn_progress($command, "Restoring files from $dev_path to $restore_path.");
+ return 0;
+ }
if ($indv_files == 0) {
#- full catalog specified
foreach (wildcard_to_tarfile($wild_card)) {
- get_file_from_tape($cat_entry, $dev_path);
+ position_tape($cat_entry, $dev_path);
+ get_tarfile_from_tape($dev_path);
return 1 if no_tarfile("$conf{PATH_TO_SAVE}/$_");
untar("$cfg_dir/restores/$conf{PATH_TO_SAVE}/$_", "all", $_, undef);
}
@@ -3590,7 +3601,10 @@ sub restore_tape {
#- individual files - pull from appropriate catalog
foreach (@restore_files) {
my ($restorefile, $tarfile) = file_to_tarfile($_, $wild_card);
- get_file_from_tape($cat_entry, $dev_path) if !-e "$cfg_dir/restores/$tarfile";
+ if (!-e "$cfg_dir/restores/$tarfile") {
+ position_tape($cat_entry, $dev_path);
+ get_tarfile_from_tape($dev_path);
+ }
return 1 if no_tarfile($tarfile);
untar("$cfg_dir/restores/$tarfile $restorefile", "files", $tarfile, $restorefile);
}
@@ -3724,11 +3738,15 @@ sub find_tape_offset {
}
}
-sub get_file_from_tape {
+sub position_tape {
my ($cat_entry, $dev_path) = @_;
my $offset = find_tape_offset($cat_entry);
spawn_progress("mt -f $dev_path rewind", "Rewinding tape on $dev_path.");
spawn_progress("mt -f $dev_path fsf $offset", "Moving forward $offset file records.");
+}
+
+sub get_tarfile_from_tape {
+ my ($dev_path) = @_;
spawn_progress("tar -C $cfg_dir/restores -xf $dev_path", "Untarring from $dev_path to work directory.");
}
@@ -3745,14 +3763,14 @@ sub restore_box() {
if (@other_backuped || @sys_backuped || @user_backuped) {
gtkpack($advanced_box,
- $box2 = gtkpack_(new Gtk2::HBox(0,1),
- 1, new Gtk2::VBox(0,10),
- 1, gtkpack_(new Gtk2::VBox(0,10),
- 1, new Gtk2::VBox(0,10),
- 1, new Gtk2::VBox(0,10),
+ $box2 = gtkpack_(Gtk2::HBox->new(0,1),
+ 1, Gtk2::VBox->new(0,10),
+ 1, gtkpack_(Gtk2::VBox->new(0,10),
+ 1, Gtk2::VBox->new(0,10),
+ 1, Gtk2::VBox->new(0,10),
1, gtksignal_connect(Gtk2::Button->new(N("Search for files to restore")), clicked => sub {
button_box_file_restore();
- find_files_to_restore()
+ find_files_to_restore();
}),
1, gtksignal_connect(Gtk2::Button->new(N("Restore all backups")), clicked => sub {
button_box_restore();
@@ -3760,7 +3778,7 @@ sub restore_box() {
$restore_sys = 1;
$restore_other = 1;
$restore_user = 1;
- restore_do()
+ restore_do();
}),
1, gtksignal_connect(Gtk2::Button->new(N("Custom Restore")), clicked => sub {
button_box_restore();
@@ -3769,15 +3787,15 @@ sub restore_box() {
1, gtksignal_connect(Gtk2::Button->new(N("Restore From Catalog")), clicked => sub {
catalog_restore("button");
}),
- 1, new Gtk2::VBox(0,10),
- 1, new Gtk2::VBox(0,10),
+ 1, Gtk2::VBox->new(0,10),
+ 1, Gtk2::VBox->new(0,10),
),
- 1, new Gtk2::HBox(0,10),
+ 1, Gtk2::HBox->new(0,10),
),
);
} else {
destroy_widget();
- restore_find_media_box(),
+ restore_find_media_box();
}
fonction_env(\$box2, \&restore_box, \&interactive_mode_box);
$central_widget = \$box2;
@@ -3797,21 +3815,21 @@ sub restore_find_media_box() {
$message .= ".";
gtkpack($advanced_box,
- $box2 = gtkpack_(new Gtk2::VBox(0, 5),
- 1, gtkpack(new Gtk2::HBox(0, 15),
- new Gtk2::VBox(0, 5),
+ $box2 = gtkpack_(Gtk2::VBox->new(0, 5),
+ 1, gtkpack(Gtk2::HBox->new(0, 15),
+ Gtk2::VBox->new(0, 5),
gtkcreate_img('warning'),
translate($message),
- new Gtk2::VBox(0, 5),
+ Gtk2::VBox->new(0, 5),
),
- 1, gtkpack(new Gtk2::HBox(0, 15),
- new Gtk2::VBox(0, 5),
- gtkpack(new Gtk2::VBox(0, 10),
+ 1, gtkpack(Gtk2::HBox->new(0, 15),
+ Gtk2::VBox->new(0, 5),
+ gtkpack(Gtk2::VBox->new(0, 10),
gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("CD in place - continue.")), clicked => sub {
$good_restore_path = 1;
interactive_mode_box("restore");
}), $mount_media),
- $new_path_entry = gtkset_sensitive(new Gtk2::Entry(), $mount_media),
+ $new_path_entry = gtkset_sensitive(Gtk2::Entry->new, $mount_media),
gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("Browse to new restore repository.")), clicked => sub {
filedialog_generic(N("Directory To Restore From"), \$new_path_entry);
}), $mount_media),
@@ -3822,12 +3840,12 @@ sub restore_find_media_box() {
gtksignal_connect(Gtk2::Button->new(N("Search for files to restore")), clicked => sub {
$box2->destroy;
button_box_file_restore();
- find_files_to_restore()
+ find_files_to_restore();
}),
),
- new Gtk2::VBox(0, 5),
+ Gtk2::VBox->new(0, 5),
),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
);
$new_path_entry->set_text($path_to_find_restore);
@@ -3839,11 +3857,11 @@ sub restore_find_media_box() {
sub restore_status() {
destroy_widget();
- $pbar3 = new Gtk2::ProgressBar;
- $stext = new Gtk2::Label("");
+ $pbar3 = Gtk2::ProgressBar->new;
+ $stext = Gtk2::Label->new("");
gtkpack($advanced_box,
- $table = gtkpack(new Gtk2::VBox(0, 5),
- new Gtk2::HBox(0,5),
+ $table = gtkpack(Gtk2::VBox->new(0, 5),
+ Gtk2::HBox->new(0,5),
create_packtable({ col_spacings => 10, row_spacings => 5 },
[""],
[""],
@@ -3855,7 +3873,7 @@ sub restore_status() {
[$pbar3],
[""],
[""],
- [$plabel3 = new Gtk2::Label(' ')],
+ [$plabel3 = Gtk2::Label->new(' ')],
[""],
),
$stext,
@@ -3893,13 +3911,13 @@ sub pbutton() {
}
sub hspace() {
- 1, new Gtk2::HBox(0, 1);
+ 1, Gtk2::HBox->new(0, 1);
}
sub button_box_adv() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
cbutton(),
hbutton(),
hspace(),
@@ -3921,7 +3939,7 @@ sub button_box_adv() {
sub button_box_restore_main() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
cbutton(),
hbutton(),
hspace(),
@@ -3934,7 +3952,7 @@ sub button_box_restore_main() {
sub button_box_file_restore() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
0, gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => \&restore_box),
hbutton(),
hspace(),
@@ -3945,7 +3963,7 @@ sub button_box_file_restore() {
sub button_box_ok_only() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
hspace(),
ibutton(N("Ok")),
),
@@ -3955,7 +3973,7 @@ sub button_box_ok_only() {
sub button_box_backup_end() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
cbutton(),
hbutton(),
hspace(),
@@ -3972,7 +3990,7 @@ sub button_box_backup_end() {
sub button_box_wizard_end() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
cbutton(),
hbutton(),
hspace(),
@@ -3988,7 +4006,7 @@ sub button_box_wizard_end() {
sub button_box_restore_end() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
cbuttonr(),
hbutton(),
hspace(),
@@ -4004,7 +4022,7 @@ sub button_box_restore_end() {
sub button_box_restore_pbs_end() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
hspace(),
hbutton(),
ibutton(N("Ok")),
@@ -4015,7 +4033,7 @@ sub button_box_restore_pbs_end() {
sub button_box_restore() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
cbuttonr(),
hbutton(),
hspace(),
@@ -4032,7 +4050,7 @@ sub button_box_find_media {
my ($mount_media) = @_;
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
cbutton(),
hbutton(),
hspace(),
@@ -4047,7 +4065,7 @@ sub button_box_find_media {
sub button_box_wizard() {
$button_box_tmp->destroy;
gtkpack($button_box,
- $button_box_tmp = gtkpack_(new Gtk2::HButtonBox,
+ $button_box_tmp = gtkpack_(Gtk2::HButtonBox->new,
cbutton(),
hbutton(),
hspace(),
@@ -4080,9 +4098,9 @@ sub install_rpm {
my ($calling_widget, $previous) = @_;
destroy_widget();
gtkpack($advanced_box,
- my $rpm_box = gtkpack_(new Gtk2::VBox(0, 15),
+ my $rpm_box = gtkpack_(Gtk2::VBox->new(0, 15),
0, N("The following packages need to be installed:\n") . join(' ', @list_of_rpm_to_install),
- 0, new Gtk2::HSeparator,
+ 0, Gtk2::HSeparator->new,
0, gtksignal_connect(Gtk2::Button->new(N("Install")), clicked => sub {
my $installed = system("/usr/sbin/urpmi --X @list_of_rpm_to_install");
if ($installed == 0) {
@@ -4103,15 +4121,15 @@ sub message_norestore_box() {
$box2->destroy;
gtkadd($advanced_box,
- $box2 = gtkpack_(new Gtk2::HBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
- 1, gtkpack(new Gtk2::HBox(0, 15),
- new Gtk2::VBox(0, 5),
+ $box2 = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
+ 1, gtkpack(Gtk2::HBox->new(0, 15),
+ Gtk2::VBox->new(0, 5),
gtkcreate_img('warning'),
N("Please select data to restore..."),
- new Gtk2::VBox(0, 5),
+ Gtk2::VBox->new(0, 5),
),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
);
button_box_restore_main();
@@ -4132,37 +4150,37 @@ sub progress {
}
sub build_backup_status() {
- $pbar = new Gtk2::ProgressBar;
- $pbar1 = new Gtk2::ProgressBar;
- $pbar2 = new Gtk2::ProgressBar;
- $pbar3 = new Gtk2::ProgressBar;
- $plabel = new Gtk2::Label(" ");
- $plabel1 = new Gtk2::Label(" ");
- $plabel2 = new Gtk2::Label(" ");
- $plabel3 = new Gtk2::Label(" ");
+ $pbar = Gtk2::ProgressBar->new;
+ $pbar1 = Gtk2::ProgressBar->new;
+ $pbar2 = Gtk2::ProgressBar->new;
+ $pbar3 = Gtk2::ProgressBar->new;
+ $plabel = Gtk2::Label->new(" ");
+ $plabel1 = Gtk2::Label->new(" ");
+ $plabel2 = Gtk2::Label->new(" ");
+ $plabel3 = Gtk2::Label->new(" ");
- $stext = new Gtk2::Label("");
+ $stext = Gtk2::Label->new("");
button_box_ok_only();
my $table = Gtk2::Table->new(10, 2, 1);
$table->set_row_spacings(5);
$table->set_col_spacings(10);
- $table->attach_defaults(new Gtk2::Label(N("Backup system files")), 0, 1, 0, 1);
+ $table->attach_defaults(Gtk2::Label->new(N("Backup system files")), 0, 1, 0, 1);
$table->attach_defaults($pbar, 0, 1, 1, 2);
$table->attach_defaults($plabel, 1, 2, 1, 2);
- $table->attach_defaults(new Gtk2::Label(N("Backup user files")), 0, 1, 2, 3);
+ $table->attach_defaults(Gtk2::Label->new(N("Backup user files")), 0, 1, 2, 3);
$table->attach_defaults($pbar1, 0, 1, 3, 4);
$table->attach_defaults($plabel1, 1, 2, 3, 4);
- $table->attach_defaults(new Gtk2::Label(N("Backup other files")), 0, 1, 4, 5);
+ $table->attach_defaults(Gtk2::Label->new(N("Backup other files")), 0, 1, 4, 5);
$table->attach_defaults($pbar2, 0, 1, 5, 6);
$table->attach_defaults($plabel2, 1, 2, 5, 6);
- $table->attach_defaults(new Gtk2::Label(N("Total Progress")), 0, 1, 6, 7);
+ $table->attach_defaults(Gtk2::Label->new(N("Total Progress")), 0, 1, 6, 7);
$table->attach_defaults($pbar3, 0, 1, 7, 8);
$table->attach_defaults($plabel3, 1, 2, 7, 8);
gtkpack($advanced_box,
- my $tbox = gtkpack(new Gtk2::VBox(0, 5),
+ my $tbox = gtkpack(Gtk2::VBox->new(0, 5),
$table,
$stext,
),
@@ -4174,28 +4192,28 @@ sub build_backup_status() {
}
sub build_backup_ftp_status() {
- $pbar = new Gtk2::ProgressBar;
- $pbar3 = new Gtk2::ProgressBar;
+ $pbar = Gtk2::ProgressBar->new;
+ $pbar3 = Gtk2::ProgressBar->new;
destroy_widget();
button_box_ok_only();
$pbar->set_fraction(0);
$pbar3->set_fraction(0);
gtkpack($advanced_box,
- $table = gtkpack_(new Gtk2::VBox(0, 15),
+ $table = gtkpack_(Gtk2::VBox->new(0, 15),
1, N("Sending files by FTP"),
- 1, new Gtk2::VBox(0, 15),
- 1, create_packtable ({ col_spacings => 10, row_spacings => 5 },
+ 1, Gtk2::VBox->new(0, 15),
+ 1, create_packtable({ col_spacings => 10, row_spacings => 5 },
[N("Sending files...")],
[""],
- [ $plabel = new Gtk2::Label(' ') ],
+ [ $plabel = Gtk2::Label->new(' ') ],
[ $pbar ],
[""],
[N("Total Progress")],
- [ $plabel3 = new Gtk2::Label(' ') ],
+ [ $plabel3 = Gtk2::Label->new(' ') ],
[$pbar3],
),
- 1, new Gtk2::VBox(0, 15),
+ 1, Gtk2::VBox->new(0, 15),
),
);
$central_widget = \$table;
@@ -4205,15 +4223,15 @@ sub build_backup_ftp_status() {
sub build_backup_box_see_conf {
my ($caller) = @_;
- my $text = new Gtk2::TextView;
+ my $text = Gtk2::TextView->new;
read_conf_file();
system_state();
gtktext_insert($text, [ [ $system_state ] ]);
button_box_restore_main();
gtkpack($advanced_box,
- $box2 = gtkpack_(new Gtk2::HBox(0, 15),
- 1, gtkpack_(new Gtk2::VBox(0,10),
+ $box2 = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, gtkpack_(Gtk2::VBox->new(0,10),
0, N("Drakbackup Configuration"),
1, create_scrolled_window($text),
),
@@ -4234,35 +4252,35 @@ sub build_backup_box() {
destroy_widget();
gtkadd($advanced_box,
- $box2 = gtkpack_(new Gtk2::HBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
- 1, gtkpack_(new Gtk2::VBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
+ $box2 = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
+ 1, gtkpack_(Gtk2::VBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
1, gtksignal_connect(my $button_from_conf_file = Gtk2::Button->new, clicked => sub {
destroy_widget();
build_backup_status();
build_backup_files();
}),
- 0, new Gtk2::VBox(0, 5),
+ 0, Gtk2::VBox->new(0, 5),
1, gtksignal_connect(my $button_see_conf = Gtk2::Button->new, clicked => sub {
destroy_widget();
- build_backup_box_see_conf();
+ build_backup_box_see_conf(undef);
}),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
);
- $button_from_conf_file->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_from_conf_file->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-discdurwhat-40"),
- new Gtk2::Label(N("Backup Now from configuration file")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("Backup Now from configuration file")),
+ Gtk2::HBox->new(0, 5)
));
- $button_see_conf->add(gtkpack(new Gtk2::HBox(0,10),
+ $button_see_conf->add(gtkpack(Gtk2::HBox->new(0,10),
gtkcreate_img("ic82-moreoption-40"),
- new Gtk2::Label(N("View Backup Configuration.")),
- new Gtk2::HBox(0, 5)
+ Gtk2::Label->new(N("View Backup Configuration.")),
+ Gtk2::HBox->new(0, 5)
));
button_box_restore_main();
@@ -4274,8 +4292,8 @@ sub build_backup_box() {
sub interactive_mode_box {
- my ($mode) = @_;
- if ($mode eq "restore") {
+ my ($o_mode) = @_;
+ if ($o_mode eq "restore") {
$central_widget = \$box2;
restore_box();
return 0;
@@ -4283,10 +4301,10 @@ sub interactive_mode_box {
destroy_widget();
gtkadd($advanced_box,
- $box2 = gtkpack_(new Gtk2::HBox(0, 15),
- 1, new Gtk2::VBox(0, 5),
- 1, gtkpack_(new Gtk2::VBox(0, 5),
- 1, new Gtk2::VBox(0, 5),
+ $box2 = gtkpack_(Gtk2::HBox->new(0, 15),
+ 1, Gtk2::VBox->new(0, 5),
+ 1, gtkpack_(Gtk2::VBox->new(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
0, gtksignal_connect(Gtk2::Button->new(N("Wizard Configuration")), clicked => sub {
destroy_widget();
read_conf_file();
@@ -4316,9 +4334,9 @@ sub interactive_mode_box {
0, gtksignal_connect(Gtk2::Button->new(N("Restore")), clicked => sub {
restore_box();
}),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
- 1, new Gtk2::VBox(0, 5),
+ 1, Gtk2::VBox->new(0, 5),
),
);
$central_widget = \$box2;
@@ -4340,15 +4358,15 @@ sub interactive_mode() {
read_conf_file();
gtkadd($window1,
- gtkpack(new Gtk2::VBox(0,0),
- gtkpack($up_box = new Gtk2::VBox(0, 5),
- gtkpack_(new Gtk2::VBox(0, 3),
- 1, gtkpack_(new Gtk2::HBox(0, 3),
- 1, $advanced_box = new Gtk2::HBox(0, 15),
+ gtkpack(Gtk2::VBox->new(0,0),
+ gtkpack($up_box = Gtk2::VBox->new(0, 5),
+ gtkpack_(Gtk2::VBox->new(0, 3),
+ 1, gtkpack_(Gtk2::HBox->new(0, 3),
+ 1, $advanced_box = Gtk2::HBox->new(0, 15),
),
- 0, new Gtk2::HSeparator,
- 0, $button_box = gtkpack(new Gtk2::VBox(0, 15),
- $button_box_tmp = gtkpack(new Gtk2::VBox(0, 0),),
+ 0, Gtk2::HSeparator->new,
+ 0, $button_box = gtkpack(Gtk2::VBox->new(0, 15),
+ $button_box_tmp = gtkpack(Gtk2::VBox->new(0, 0),),
),
),
),
diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot
index c9e5386f5..3f3330d82 100755
--- a/perl-install/standalone/drakboot
+++ b/perl-install/standalone/drakboot
@@ -43,8 +43,8 @@ my $in = 'interactive'->vnew('su');
my $all_hds = fsedit::get_hds();
fs::get_raw_hds('', $all_hds);
-fs::get_info_from_fstab($all_hds, '');
-my $fstab = [ fsedit::get_all_fstab($all_hds) ];
+fs::get_info_from_fstab($all_hds);
+my $fstab = [ fs::get::fstab($all_hds) ];
my $bootloader = bootloader::read($fstab);
if (!$in->isa('interactive::gtk') || any { /^--boot$/ } @ARGV) {
@@ -78,16 +78,21 @@ unless ($::isEmbedded) {
######### menus end
}
-my $user_combo = Gtk2::ComboBox->new_text;
-$user_combo->set_popdown_strings(list_users());
-$user_combo->entry->set_text($auto_mode->{autologin}) if $auto_mode->{autologin};
-my $desktop_combo = Gtk2::ComboBox->new_text;
-$desktop_combo->set_popdown_strings(split(' ', `/usr/sbin/chksession -l`));
-$desktop_combo->entry->set_text($auto_mode->{desktop}) if $auto_mode->{desktop};
+my @users = sort(list_users());
+my @sessions = sort(split(' ', `/usr/sbin/chksession -l`));
+
+my $user = member($auto_mode->{autologin}, @users) ? $auto_mode->{autologin} : $users[0];
+if (!$user) {
+ # no user, bad but add root anyway:
+ $user = "root";
+ push @users, $user;
+}
+my $user_combo = Gtk2::ComboBox->new_with_strings(\@users, $user);
+my $desktop_combo = Gtk2::ComboBox->new_with_strings(\@sessions, if_(member($auto_mode->{desktop}, @sessions), $auto_mode->{desktop}));
my %themes = ('path' => '/usr/share/bootsplash/themes/',
'sysconfig' => '/etc/sysconfig/bootsplash',
- 'default' => 'Mandrake',
+ 'default' => 'Mandrakelinux',
'def_thmb' => '/usr/share/libDrakX/pixmaps/nosplash_thumb.png',
'lilo' => {'file' => '/lilo/message',
'thumb' => '/lilo/thumb.png' },
@@ -97,7 +102,6 @@ my %themes = ('path' => '/usr/share/bootsplash/themes/',
);
my $kernel_release = `uname -r`;
chomp $kernel_release;
-my $initrd = "/boot/initrd-$kernel_release.img" if -f "/boot/initrd-$kernel_release.img";
require Xconfig::resolution_and_depth;
my $cur_res;
@@ -122,27 +126,28 @@ if (-r $themes{sysconfig}) {
}
}
-my @boot_thms = if_(!$themes{default}, qw(default));
+my @boot_thms;
chdir($themes{path}); #- we must change directory for correct @boot_thms assignement
-foreach (all('.')) {
+foreach (sort(all('.'))) {
if (-d "$themes{path}$_" && m/^[^.]/) {
-f "$themes{path}$_$themes{boot}{path}bootsplash-$cur_res.jpg" and push @boot_thms, $_;
}
}
-my %combo = ('thms' => '', 'lilo' => '', 'boot' => '');
+push @boot_thms, $themes{default} unless member($themes{default}, @boot_thms);
+
+my %combo = ('thms' => '', 'lilo' => '');
foreach (keys(%combo)) {
$combo{$_} = gtkset_size_request(Gtk2::ComboBox->new_text, 10, -1);
}
-$combo{boot}->set_popdown_strings(@boot_thms);
-$combo{boot}->entry->set_text($themes{default});
+$combo{boot} = gtkset_size_request(Gtk2::ComboBox->new_with_strings(\@boot_thms, $themes{default}), 10, -1);;
my $boot_pic = gtkcreate_img($themes{def_thmb});
change_image($boot_pic, $themes{default});
my $_thm_button = Gtk2::Button->new(N("Install themes"));
my $_B_create = gtksignal_connect(Gtk2::Button->new(N("Create new theme")), clicked => sub { system('/usr/sbin/draksplash ') });
-
+
#- ******** action to take on changing combos values
$combo{boot}->entry->signal_connect(changed => sub { change_image($boot_pic, $combo{boot}->entry->get_text) });
@@ -153,16 +158,15 @@ gtkadd($window,
gtkpack_(Gtk2::VBox->new(0,0),
($splash_working ?
(1, gtkpack_(gtkset_border_width(Gtk2::VBox->new(0, 5), 5),
- 0, gtksignal_connect(gtkset_active(Gtk2::CheckButton->new(N("Use graphical boot")), $splash_mode),
+ 0, gtksignal_connect(gtkset_active(Gtk2::CheckButton->new(N("Use graphical boot")), $splash_mode),
clicked => sub {
$splash_mode = !$splash_mode;
- if ($boot_warn && $no_bootsplash && $splash_mode) {
- if ($in->ask_yesorno(N("Warning"),
+ if ($boot_warn && $no_bootsplash && $splash_mode) {
+ if ($in->ask_yesorno(N("Warning"),
[ N("Your system bootloader is not in framebuffer mode. To activate graphical boot, select a graphic video mode from the bootloader configuration tool.") . "\n" .
- N("Do you want to configure it now ?") ])) {
- lilo_choice();
+ N("Do you want to configure it now?") ])) {
+ enable_framebuffer();
#- it would be nice to get available themes for new cur_res here
- $splash_mode = 1
};
$boot_warn = 0
}
@@ -193,19 +197,10 @@ gtkadd($window,
my @auto_buttons = gtkradio((N("No, I don't want autologin")) x 2,
N("Yes, I want autologin with this (user, desktop)")),
),
- gtkpack__(
- my $auto_box = Gtk2::HBox->new,
- gtkpack(
- Gtk2::VBox->new,
- Gtk2::Label->new(N("Default user")),
- Gtk2::Label->new(N("Default desktop")),
- ),
- gtkpack(
- Gtk2::VBox->new,
- $user_combo,
- $desktop_combo
- ),
- )
+ my $auto_box = create_packtable({ col_spacings => 5, row_spacings => 5, homogenous => 1 },
+ [ Gtk2::Label->new(N("Default user")), $user_combo ],
+ [ Gtk2::Label->new(N("Default desktop")), $desktop_combo ],
+ ),
)
)
),
@@ -214,7 +209,7 @@ gtkadd($window,
ok_clicked => sub {
Xconfig::various::runlevel($x_mode ? 5 : 3);
if ($splash_working) {
- $splash_mode and update_bootsplash($combo{boot}->entry->get_text, $splash_mode, $keep_logo);
+ update_bootsplash($combo{boot}->entry->get_text, $splash_mode, $keep_logo);
} else {
updateAutologin();
}
@@ -244,22 +239,13 @@ $in->exit(0);
sub lilo_choice() {
ask:
- eval {
- my $before = fs::fstab_to_string($all_hds);
- any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL});
- if ($before ne fs::fstab_to_string($all_hds)) {
- #- for /tmp using tmpfs when "clean /tmp" is chosen
- fs::write_fstab($all_hds);
- }
- };
- my $err = $@;
- if ($err && $err !~ /wizcancel/) {
- # BUG: note that the following message won't speak about the right bootloader if user is currently switching between
- # various bootloaders and if the error occured before boot sector get overwritten by bootloader installer
- $in->ask_warn(N("Error"),
- [ N("Installation of %s failed. The following error occured:", $bootloader->{method}), $err ]);
- goto ask;
+ my $before = fs::fstab_to_string($all_hds);
+ any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL}) or $in->exit;
+ if ($before ne fs::fstab_to_string($all_hds)) {
+ #- for /tmp using tmpfs when "clean /tmp" is chosen
+ fs::write_fstab($all_hds);
}
+ any::installBootloader($in, $bootloader, $all_hds) or goto ask;
}
@@ -288,14 +274,14 @@ sub update_bootsplash {
print "substInFile { s/^LOGO_CONSOLE=.*/LOGO_CONSOLE=$logo_console/ } $themes{sysconfig}\n";
print "system($switch_theme, $theme)\n";
} else {
- print "system($remove_theme, $theme)\n";
+ print "system($remove_theme)\n";
}
} else {
if ($splash_mode) {
substInFile { s/^LOGO_CONSOLE=.*/LOGO_CONSOLE=$logo_console/ } $themes{sysconfig};
system($switch_theme, $theme);
} else {
- system($remove_theme, $theme);
+ system($remove_theme);
}
}
}
@@ -303,9 +289,46 @@ sub update_bootsplash {
sub change_image {
my ($boot_pic, $val) = @_;
- my $img_file = $themes{path} . $val . $themes{boot}{path}."bootsplash-$cur_res.jpg";
+ my $img_file = $themes{path} . $val . $themes{boot}{path} . "bootsplash-$cur_res.jpg";
-f $img_file or return;
my $boot_pixbuf = gtkcreate_pixbuf($img_file);
$boot_pixbuf = $boot_pixbuf->scale_simple(300, 200, 'nearest');
$boot_pic->set_from_pixbuf($boot_pixbuf);
}
+sub enable_framebuffer() {
+ my $vga = Xconfig::resolution_and_depth::from_bios($bootloader->{default_vga});
+ my ($current_entry) = cat_('/proc/cmdline') =~ /^BOOT_IMAGE=(\S+)/;
+ my %entries = (
+ $current_entry => 1
+ );
+ local $::isWizard = 1;
+ local $::Wizard_no_previous = 1;
+ local $::Wizard_finished = 1;
+ $::Wizard_title = N("Boot Style Configuration");
+ eval {
+ $in->ask_from(N("Video mode"),
+ N("Please choose a video mode, it will be applied to each of the boot entries selected below.
+Be sure your video card supports the mode you choose."),
+ [
+ { label => N("Video mode"), val => \$vga,
+ list => [ '', Xconfig::resolution_and_depth::bios_vga_modes() ],
+ format => \&Xconfig::resolution_and_depth::to_string
+ },
+ map {
+ { text => $_->{label}, val => \$entries{$_->{label}}, type => 'bool' }
+ } grep { $_->{label} !~ /failsafe|floppy|memtest/ } @{$bootloader->{entries}}
+ ]);
+ if ($vga) {
+ $vga = $vga->{bios} if ref($vga);
+ while (my ($label, $e) = each %entries) {
+ $e or next;
+ my $entry = find { $_->{label} eq $label } @{$bootloader->{entries}};
+ $entry->{vga} = $vga;
+ }
+ bootloader::install($bootloader, $all_hds);
+ }
+ };
+ die if $@ && $@ !~ /^wizcancel/;
+ $::WizardWindow->destroy unless $::isEmbedded;
+ $vga;
+}
diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug
index 9db66a04f..ba4be622a 100755
--- a/perl-install/standalone/drakbug
+++ b/perl-install/standalone/drakbug
@@ -1,7 +1,8 @@
#!/usr/bin/perl
# Drak Bug Report
-# Copyright (C) 2002-2004 Mandrakesoft (daouda@mandrakesoft.com)
+# Copyright (C) 2002-2004 Mandrakesoft (daouda at mandrakesoft dot com)
+# Stew Benedict (sbenedict at mandrakesoft dot com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,36 +27,28 @@ use common;
use ugtk2 qw(:all);
use Config;
-my $bugzilla_url = "http://drakbug.mandrakesoft.com";
-my $help_url = "http://qa.mandrakesoft.com";
-my $version = "0.9.1";
+my ($bugzilla, $wizard_name);
my $prog;
my $incident = 0;
-my $stable_release = 0;
-my $wizard_name = "Bugzilla wizard";
-my $bugdesc;
-my $bugwrite;
-my $winwidth;
-my $winht;
-my $upload_info = N("To submit a bug report, click on the button report.\nThis will open a web browser window on %s\n where you'll find a form to fill in. The information displayed above will be \ntransferred to that server.", $bugzilla_url);
+my ($bugdesc, $table, $comb_app, $com_app, $button_pkg, $package);
foreach (@ARGV) {
next unless defined $_;
- /^--report$/ and $prog = shift @ARGV;
- /^--incident$/ and do { $incident = 1; $prog = shift @ARGV };
+ /^--report$/ && shift @ARGV and $prog = shift @ARGV;
+ /^--incident$/ && shift @ARGV and do { $incident = 1; $prog = shift @ARGV };
}
-my $window = ugtk2->new(N("Mandrake Bug Report Tool"), center => 1);
+my $window = ugtk2->new(N("Mandrakelinux Bug Report Tool"), center => 1);
$window->{rwindow}->set_border_width(5);
$window->{window}->signal_connect("delete_event", sub { ugtk2->exit(0) });
my $mdk_app = {
- N("Mandrake Control Center") => 'drakconf',
+ N("Mandrakelinux Control Center") => 'drakconf',
N("First Time Wizard") => 'drakfw',
N("Synchronization tool") => 'draksync',
- N("Standalone Tools") => ['adduserdrake', 'diskdrake', 'drakautoinst', 'drakbackup', 'drakboot', 'drakbug', 'drakfloppy', 'drakfont', 'drakgw', 'drakconnect', 'drakxservices', 'drakxtv', 'keyboardrake', 'logdrake', 'mousedrake', 'net_monitor', 'printerdrake', 'scannerdrake', 'drakfirewall', 'XFdrake'],
+ N("Standalone Tools") => ['adduserdrake', 'diskdrake', 'drakautoinst', 'drakbackup', 'drakboot', 'DrakBug', 'DrakClock', 'DrakConnect', 'drakfloppy', 'drakfirewall', 'drakfont', 'drakgw', 'DrakSec', 'draksplash', 'drakvpn', 'drakxservices', 'drakxtools', 'drakxtv', 'keyboardrake', 'logdrake', 'mousedrake', 'net_monitor', 'printerdrake', 'scannerdrake', 'XFdrake'],
N("HardDrake") => 'harddrake2',
- N("Mandrake Online") => 'mdkonline',
+ N("Mandrakeonline") => 'mdkonline',
N("Menudrake") => 'menudrake',
N("Msec") => 'msec',
N("Remote Control") => 'rfbdrake',
@@ -71,127 +64,78 @@ my @all_drakxtools = @{ $mdk_app->{N("Standalone Tools")} };
push(@generic_tool,@all_drakxtools);
my $kernel_release = chomp_(`uname -r`);
-my $mandrake_release = mandrake_release();
-if ($mandrake_release !~ /Cooker/) {
- my @release_list = split(' ', $mandrake_release);
- $mandrake_release = join(" ", $release_list[0], $release_list[1], $release_list[3]);
- $bugzilla_url = "http://bugs.mandrakelinux.com/drakbug.php?request=1";
- $help_url = "http://bugs.mandrakelinux.com/faq.php";
- $stable_release = 1;
- $wizard_name = "Anthill";
- $winwidth = 600;
- $winht = 460;
- $upload_info = N("To submit a bug report, click the report button, which will open your default browser\nto Anthill where you will be able to upload the above information as a bug report.");
-}
-
-my $table;
-my $app_box;
-my $comb_app;
-my $button_pkg;
-my $package;
-my $extra_data;
-my $extra_text;
-my $summary;
-my $textview;
-my $kversion;
-my $cpuinfo;
-my $lspci;
-
-if ($stable_release == 0) {
- $table = create_packtable({ col_spacings => 5, row_spacings => 10 },
- [ new Gtk2::Label(N("Application:")), $comb_app = Gtk2::ComboBox->new_text ],
- [ new Gtk2::Label(N("Package: ")), $package = Gtk2::Entry->new_with_text("...") ], # complain on gtk-perl@ml
- [ Gtk2::Label->new(N("Kernel:")), gtkset_editable(Gtk2::Entry->new_with_text($kernel_release), 0) ],
- [ Gtk2::Label->new(N("Release: ")), gtkset_editable(Gtk2::Entry->new_with_text($mandrake_release), 0) ]
- );
- $comb_app->set_popdown_strings("", sort(@generic_tool));
-} else {
- $table = create_packtable({ col_spacings => 5, row_spacings => 5 },
- [Gtk2::Label->new(N("Application Name\nor Full Path:")),
- gtkpack_(new Gtk2::HBox(0,5),
- 1, $comb_app = gtkset_editable(Gtk2::Entry->new, 1),
- 0, $button_pkg = Gtk2::Button->new(N("Find Package")),
- )],
- [ Gtk2::Label->new(N("Package: ")), $package = gtkset_editable(Gtk2::Entry->new_with_text("..."), 0) ],
- [ Gtk2::Label->new(N("Release: ")), gtkset_editable(Gtk2::Entry->new_with_text($mandrake_release), 0) ],
- [ Gtk2::Label->new(N("Summary: ")), $summary = gtkset_editable(Gtk2::Entry->new_with_text(""), 1) ]
- );
-
- $textview = new Gtk2::TextView;
- $textview->set_wrap_mode("GTK_WRAP_WORD");
- my $scrolled_window = Gtk2::ScrolledWindow->new(undef, undef);
- $scrolled_window->set_policy('automatic', 'automatic');
- $scrolled_window->set_border_width(10);
- $scrolled_window->add_with_viewport($textview);
- $scrolled_window->set_size_request($winwidth-50, 180);
- my $buffer = $textview->get_buffer;
- my $iter = $buffer->get_iter_at_offset(0);
- $buffer->insert($iter, N("YOUR TEXT HERE"));
-
- $extra_data = gtkpack_(new Gtk2::VBox(0,1),
- 0, Gtk2::Label->new(N("Bug Description/System Information")),
- 1, $scrolled_window,
- 0, gtkpack_(new Gtk2::HBox(0,20),
- 0, new Gtk2::HBox(0,0),
- 1, $kversion = new Gtk2::CheckButton(N("Submit kernel version")),
- 1, $cpuinfo = new Gtk2::CheckButton(N("Submit cpuinfo")),
- 1, $lspci = new Gtk2::CheckButton(N("Submit lspci")),
- ),
- 0, new Gtk2::HSeparator,
- );
- $kversion->set_active(1);
- $cpuinfo->set_active(1);
- $lspci->set_active(1);
-}
-
-gtkadd(
- $window->{window},
- gtkpack2__(my $vbx = new Gtk2::VBox(0,5),
- gtkadd($table),
- gtkadd($extra_data),
- gtkpack(new Gtk2::HBox(0,0),
- gtkpack(gtkset_justify(new Gtk2::Label($upload_info), "left")),
- ),
- gtkpack(new Gtk2::HSeparator),
- gtkpack_(Gtk2::HBox->new(0,0),
- 0, gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { system("drakhelp --id drakbug &") }),
- 1, Gtk2::Label->new(""),
- 0, gtksignal_connect(Gtk2::Button->new(N("Report")), clicked => sub {
- if ($stable_release == 0) {
- my $options = "mdkbugreport=1";
- $options .= "&incident=1" if $incident;
- my $p = $package->get_text;
- (my $r = parse_release()) =~ s/\s//;
- $options .= "&package=$p" if $p =~ /mdk/;
- $options .= "&kernel=$kernel_release";
- $options .= "&version=$r";
- print($bugzilla_url . "?" . $options . "\n");
- connect_bugzilla($bugzilla_url."?".$options);
- } else {
- # anthill variant - we'll create a text file, then connect to upload
- my $check = write_anthill_file();
- connect_bugzilla($bugzilla_url) if !$check;
- }
- }
- ),
- 0, gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { ugtk2->exit(0) }),
- ),
- ),
- );
+my $mandrake_release = chomp_(cat_('/etc/mandrakelinux-release'));
+#- unused for now
+#- (my $mandrake_version) = $mandrake_release =~ /(\d+\.\d+)/;
-if ($stable_release == 0) {
- if (defined $prog) {
- update_app($prog);
- $comb_app->entry->set_text($prog);
- };
- $comb_app->entry->signal_connect('changed', sub { update_app($comb_app->entry->get_text) });
+if ($mandrake_release =~ /(official|community)/i) {
+ $distrocode = $mandrake_release;
+ $distrocode =~ s/^.*?(\d+\.\d+) \((\w+)\).*$/$1-\l$2/;
} else {
- $window->{window}->set_size_request($winwidth, $winht);
- $button_pkg->signal_connect('clicked', sub {
- my $pkg_name = get_pkg_name($comb_app->get_text);
- $package->set_text($pkg_name);
- });
+ $distrocode = "cooker";
}
+$bugzilla = 'http://qa.mandrakesoft.com/enter_bug.cgi';
+$wizard_name = "Bugzilla";
+
+$table = create_packtable({ col_spacings => 5, row_spacings => 10 },
+ [ Gtk2::Label->new(N("Select Mandrakesoft Tool:")), $comb_app = Gtk2::ComboBox->new_text ],
+ [ Gtk2::Label->new(N("or Application Name\n(or Full Path):")),
+ gtkpack_(Gtk2::HBox->new(0,5),
+ 1, $com_app = gtkset_editable(Gtk2::Entry->new, 1),
+ 0, $button_pkg = Gtk2::Button->new(N("Find Package")),
+ )],
+ [ Gtk2::Label->new(N("Package: ")), $package = Gtk2::Entry->new_with_text("...") ], # complain on gtk-perl@ml
+ [ Gtk2::Label->new(N("Kernel:")), gtkset_editable(Gtk2::Entry->new_with_text($kernel_release), 0) ]
+ );
+$comb_app->set_popdown_strings("", sort(@generic_tool));
+
+gtkadd($window->{window},
+ gtkpack_(Gtk2::VBox->new(0,5),
+ 0, gtkpack(Gtk2::HBox->new(0,0),
+ gtkpack(gtkset_justify(Gtk2::WrappedLabel->new(formatAlaTeX(N("%s", $mandrake_release))), "left")),
+ ),
+ 0, gtkpack(Gtk2::HSeparator->new),
+ 0, gtkadd($table),
+ 0, gtkpack(Gtk2::HBox->new(0,0),
+ gtkpack(gtkset_justify(Gtk2::WrappedLabel->new(formatAlaTeX(N("To submit a bug report, click on the report button. \nThis will open a web browser window on %s where you'll find a form to fill in. The information displayed above will be transferred to that server. \nThings useful to include in your report are the output of lspci, kernel version, and /proc/cpuinfo.", $wizard_name))), "left")),
+ ),
+ 0, gtkpack(Gtk2::HSeparator->new),
+ 0, gtkpack_(Gtk2::HBox->new(0,0),
+ 0, gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { system("drakhelp --id drakbug &") }),
+ 1, Gtk2::Label->new(""),
+ 0, gtksignal_connect(Gtk2::Button->new(N("Report")), clicked => sub {
+ my $options = "mdkbugreport=1";
+ $options .= "&incident=1" if $incident;
+ my $p = $package->get_text;
+ my ($product, $version) = $p =~ /^(.*)-([^-]+-[^-]+mdk)$/;
+ my $app = $comb_app->entry->get_text;
+ my $component = if_(member($app, @all_drakxtools), $app) || $mdk_app->{$app};
+ $options .= "&product=$product" if $product;
+ # this could probably be cleaner but whatever, it works (vdanen)
+ if ($component eq "scannerdrake" && $product ne "drakxtools") {
+ $component = $product;
+ }
+ $options .= "&component=$component";
+ $options .= "&version=$version" if $version;
+ $options .= "&distro_code=$distrocode";
+ $options .= "&kernel=$kernel_release" if $kernel;
+ print($bugzilla . "?" . $options . "\n");
+ connect_bugzilla($bugzilla . "?" . $options);
+ }
+ ),
+ 0, gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { ugtk2->exit(0) }),
+ )));
+
+if (defined $prog) {
+ update_app($prog);
+ $comb_app->set_text($prog);
+};
+$comb_app->entry->signal_connect('changed', sub { update_app($comb_app->entry->get_text) });
+
+$button_pkg->signal_connect('clicked', sub {
+ my $pkg_name = get_package($com_app->get_text);
+ $package->set_text($pkg_name);
+ });
$window->{window}->show_all;
$window->main;
@@ -206,7 +150,7 @@ sub update_app {
} elsif (exists($mdk_app->{$text}) && $text ne N("Standalone Tools")) {
$app_choice = get_package($mdk_app->{$text});
} else {
- LOOP: while (my ($key, $value) = each %$mdk_app) {
+ LOOP: while (my ($key, $value) = each %$mdk_app) {
next if $key eq N("Standalone Tools");
if ($value eq $text) {
$app_choice = get_package($text);
@@ -234,31 +178,11 @@ sub get_package {
$rpm_package;
}
-sub get_pkg_name {
- my ($executable) = @_;
- my $which_app = chomp_(`which '$executable' 2> /dev/null`);
- my $rpm_package;
- if ($which_app eq "") {
- $rpm_package = chomp_(`rpm -q '$executable' --qf '%{NAME}' 2>&1`);
- } else {
- $rpm_package = chomp_(`rpm -qf '$which_app' --qf '%{NAME}' 2>&1`);
- }
- $rpm_package = chomp_(`rpm -qf '$executable' --qf '%{NAME}' 2>&1`) if $rpm_package =~ /not installed$/;
- $rpm_package = (split(/-2/, $rpm_package))[0] if $rpm_package =~ /^kernel/;
- $rpm_package ||= N("NOT FOUND");
- $rpm_package;
-}
-
-sub parse_release() {
- (mandrake_release() =~ /release\s(\S+\s\(.*\))/)[0];
-}
-
sub connect_bugzilla {
my ($url) = @_;
- if (!$stable_release) {
- my $_w = create_dialog(N("Please wait"), N("connecting to %s ...", $wizard_name));
- sleep(3);
- }
+# let's not force people to click ok in order to launch the browser (vdanen)
+# my $_w = create_dialog(N("Please wait"), N("connecting to %s...", $wizard_name));
+# sleep(3);
exec $ENV{BROWSER},$url if exists $ENV{BROWSER};
my @browser = qw(mozilla konqueror galeon);
foreach (@browser) {
@@ -267,62 +191,3 @@ sub connect_bugzilla {
create_dialog(N("Error"), N("No browser available! Please install one"));
}
-sub write_anthill_file() {
- my $buffer = $textview->get_buffer;
- my $siter = $buffer->get_start_iter;
- my $eiter = $buffer->get_end_iter;
- $bugdesc = $buffer->get_text($siter, $eiter, 0);
-
- #- create anthill upload file in specified format
- local *F;
- open(F, "> /tmp/drakbug.report") or return 1;
- print F "--- BEGIN DRAKBUG REPORT ---\n";
- print F "%product: $mandrake_release\n";
- my $version = arch();
- $version = "x86" if $version =~ /^i.86/;
- print F "%version: $version\n";
- my $pkg_name = $package->get_text;
- if ($pkg_name eq "..." || $pkg_name eq "") {
- my $_w = create_dialog(N("Error"), N("Please enter a package name."));
- return 1;
- }
- print F "%component: $pkg_name\n";
- my $summary_text = $summary->get_text;
- if ($summary_text eq "") {
- my $_w = create_dialog(N("Error"), N("Please enter summary text."));
- return 1;
- }
-
- print F "%summary: $summary_text\n";
- print F "%description:\n";
-
- #- gave me fits wanted to wrap what was wrapped in the GUI
- #- plus include user's \n
- my @buglist = split("\n", $bugdesc);
- foreach my $bugdesc (@buglist) {
- if (length($bugdesc) > 77) {
- $bugwrite = $bugdesc;
- select(F);
- local $~ = "PFORMAT";
- write F;
- select(STDOUT);
- $bugwrite = '';
- } else {
- print F " $bugdesc\n";
- }
- }
-
- print F "-" x 80 . "\n";
- print F "Kernel: $kernel_release\n" . "Uname: " . `uname -a` . "\n" if $kversion->get_active;
- print F "Cpuinfo: \n" . cat_("/proc/cpuinfo") if $cpuinfo->get_active;
- print F "Lspci Output:\n" . `lspci` if $lspci->get_active;
- print F "--- END DRAKBUG REPORT ---\n";
- close F or return 1;
- return 0
-}
-
-format PFORMAT =
-~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-$bugwrite
-.
-
diff --git a/perl-install/standalone/drakbug_report b/perl-install/standalone/drakbug_report
index ca947d4a3..632dafcf7 100755
--- a/perl-install/standalone/drakbug_report
+++ b/perl-install/standalone/drakbug_report
@@ -2,6 +2,7 @@
use lib qw(/usr/lib/libDrakX);
+use standalone;
use common;
use any;
diff --git a/perl-install/standalone/drakclock b/perl-install/standalone/drakclock
index a1dd5b5f5..a71e695ae 100755
--- a/perl-install/standalone/drakclock
+++ b/perl-install/standalone/drakclock
@@ -17,10 +17,11 @@ my $radius;
my ($dRadians_hour, $dRadians_min, $dRadians_sec);
my $Radian;
my $timer;
-my ($midx, $midy);
my $first = 1;
my $its_reset = 0;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/time-mdk.png";
+
#my $conffile = '/etc/sysconfig/ntpclock';
my $ntpfile = '/etc/ntp.conf';
my $ntpdlock = '/var/lock/subsys/ntpd';
@@ -66,16 +67,12 @@ my $mode = 0;
my (undef, undef, $h_old, $old_day, $old_month, $old_year) = localtime(time());
-my @image_size = (300, 300);
+my @image_size = (200, 200);
$my_win->{window}->add(gtkpack_(gtkset_border_width(Gtk2::VBox->new, $::isEmbedded ? 0 : 5),
1, gtkpack_(Gtk2::HBox->new,
1, gtkpack_(Gtk2::VBox->new,
0, $calendar,
- 0, gtkadd(gtkset_shadow_type(Gtk2::Frame->new(N("Timezone")), 'etched_in'),
- gtkpack__(gtkset_border_width(Gtk2::VBox->new, 5),
- $label_timezone,
- $button_time)),
1, gtkadd(gtkset_shadow_type(Gtk2::Frame->new(N("Network Time Protocol")), 'etched_in'),
gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5),
0, Gtk2::Label->new(N("Your computer can synchronize its clock\n with a remote time server using NTP")),
@@ -101,12 +98,17 @@ $my_win->{window}->add(gtkpack_(gtkset_border_width(Gtk2::VBox->new, $::isEmbedd
0, my $spinner_m = Gtk2::SpinButton->new($adjm, 0, 0),
0, my $spinner_s = Gtk2::SpinButton->new($adjs, 0, 0),
),
+ 1, gtkadd(gtkset_shadow_type(Gtk2::Frame->new(N("Timezone")), 'etched_in'),
+ gtkpack__(gtkset_border_width(Gtk2::VBox->new, 5),
+ $label_timezone,
+ $button_time)),
),
),
0, create_okcancel(my $w =
{
cancel_clicked => sub { ugtk2->exit(0) },
ok_clicked => sub {
+ my $need_date = 1;
if ($check_ntp->get_active) {
my $choosed_serv = $combo_ntpserver->entry->get_text;
$choosed_serv =~ s/(\S+)\s*(.*)$/$1/;
@@ -115,20 +117,28 @@ $my_win->{window}->add(gtkpack_(gtkset_border_width(Gtk2::VBox->new, $::isEmbedd
system("service ntpd stop");
#verify that we have a valid hostname (thx sam)
$choosed_serv =~ s/[^-a-zA-Z0-9.]//g;
- system("/usr/sbin/ntpdate", $choosed_serv);
- system("service ntpd start");
+ if (!system("/usr/sbin/ntpdate", $choosed_serv)) {
+ update_time(); #- get the new time before updating the hwclock
+ system("service ntpd start");
+ $need_date = 0
+ } else {
+ warn_dialog(N("Error"), N("Could not synchronize with %s.", $choosed_serv));
+ return
+ }
} else {
if (-e $ntpdlock) {
- system("service ntpd stop");
- system("/sbin/chkconfig --level 35 ntpd off");
- }
- }
- my ($year, $month, $day) = $calendar->get_date;
- $month++;
- my ($hour, $min, $sec) = ($adjh->get_value, $adjm->get_value, $adjs->get_value);
- system("date " .
- join('', map { print_it0($_) } ($month, $day, $hour, $min, $year)) . '.' . print_it0($sec));
- -e '/sbin/hwclock' and system('/sbin/hwclock --systohc');
+ system("service ntpd stop");
+ system("/sbin/chkconfig --level 35 ntpd off");
+ }
+ }
+ if ($need_date) {
+ my ($year, $month, $day) = $calendar->get_date;
+ $month++;
+ my ($hour, $min, $sec) = ($adjh->get_value, $adjm->get_value, $adjs->get_value);
+ system("date " .
+ join('', map { print_it0($_) } ($month, $day, $hour, $min, $year)) . '.' . print_it0($sec));
+ }
+ -e '/sbin/hwclock' and system('/sbin/hwclock --systohc');
system("dcop kicker Panel restart") if $ENV{DESKTOP} eq 'kde';
ugtk2->exit(0);
},
@@ -138,8 +148,6 @@ $my_win->{window}->add(gtkpack_(gtkset_border_width(Gtk2::VBox->new, $::isEmbedd
$its_reset = 1;
$timer = Glib::Timeout->add(120, \&update_time);
Repaint($drawing_area, 1);
- $calendar->select_month($old_month, $old_year);
- $calendar->select_day($old_day);
$button_reset->set_sensitive(0);
$its_reset = 0;
} ]
@@ -191,8 +199,6 @@ $spinner_s->signal_connect(activate => \&spinned);
$spinner_s->signal_connect(scroll_event => \&spinned);
$spinner_s->signal_connect(button_release_event => \&spinned);
-$my_win->{window}->show_all;
-
gtkflush();
my $is24 = $h_old > 12;
@@ -203,6 +209,8 @@ $button_reset->set_sensitive(0);
$timer = Glib::Timeout->add(120, \&update_time);
$drawing_area->show;
+$my_win->{window}->show_all;
+my ($midx, $midy) = ($drawing_area->allocation->width/2, $drawing_area->allocation->height/2);
$my_win->main;
ugtk2->exit(0);
@@ -216,7 +224,7 @@ sub install_ntp() {
$my_win->{window}->set_sensitive(0);
if (warn_dialog(N("Warning"), N("We need to install ntp package\n to enable Network Time Protocol
-Do you want to install ntp ?"))) {
+Do you want to install ntp?"))) {
$in->do_pkgs->install('ntp');
} else {
ntp_widget_state(0);
@@ -228,6 +236,13 @@ sub get_server() {
[ map { "$_ ($servs->{$_})" } sort keys %$servs ]
}
sub update_time() {
+ my (undef, undef, undef, $mday, $mon, $year) = localtime(time());
+ $year += 1900;
+ my $old_its_reset = $its_reset;
+ $its_reset = 1;
+ $calendar->select_day($mday);
+ $calendar->select_month($mon, $year);
+ $its_reset = $old_its_reset;
Repaint($drawing_area, 1);
};
@@ -308,7 +323,7 @@ sub time_to_rad {
sub Repaint {
my ($drawing_area, $o_update_time) = @_;
- my ($sec, $min, $hour) = localtime(time());
+ my ($sec,$min,$hour) = localtime(time());
time_to_rad($sec, $min, $hour) if $o_update_time;
my ($width, $height) = ($drawing_area->allocation->width, $drawing_area->allocation->height);
my $dRadians_hour_real = $dRadians_hour + $dRadians_min / 12;
@@ -352,7 +367,7 @@ sub DrawHour {
my ($pixmap, $gc, $midx, $midy, $dRadians, $dec) = @_;
$pixmap->draw_polygon($gc, 1, $midx+$dec - 5/100 * $radius * sin($dRadians), $midy+$dec + 5/100 * $radius * cos($dRadians),
$midx+$dec - 5/100 * $radius * sin($dRadians+$PI/2), $midy+$dec + 5/100 * $radius * cos($dRadians+$PI/2),
- $midx+$dec + 7/10 * $radius * sin($dRadians), $midy+$dec - 7/10 * $radius * cos($dRadians),
+ $midx+$dec + 6/10 * $radius * sin($dRadians), $midy+$dec - 6/10 * $radius * cos($dRadians),
$midx+$dec + 5/100 * $radius * sin($dRadians+$PI/2), $midy+$dec - 5/100 * $radius * cos($dRadians+$PI/2)
);
}
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
index 5922ca50e..90ef8419d 100755
--- a/perl-install/standalone/drakconnect
+++ b/perl-install/standalone/drakconnect
@@ -21,7 +21,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-use strict;
+use strict;
use lib qw(/usr/lib/libDrakX);
@@ -39,19 +39,23 @@ use modules;
use network::isdn;
use network::adsl;
use network::tools;
+use network::test;
use MDK::Common::Globals "network", qw($in);
use POSIX ":sys_wait_h";
-my ($netcnx, $netc, $intf) = ({}, {}, {});
-#my @conx_type = ('modem', 'isdn_internal', 'isdn_external', 'adsl', 'cable', 'lan');
-
$ugtk2::wm_icon = "drakconnect";
my $in = 'interactive'->vnew('su');
if ($in->isa('interactive::gtk')) {
require ugtk2;
ugtk2->import(qw(:create :dialogs :helpers :wrappers));
}
-network::tools::reread_net_conf($netcnx, $netc, $intf);
+
+my ($netcnx, $netc, $intf) = ({}, {}, {});
+network::netconnect::read_net_conf($netcnx, $netc, $intf);
+
+my $modules_conf = modules::any_conf->read;
+modules::load_category($modules_conf, 'net');
+
$::Wizard_title = N("Network & Internet Configuration");
$::Wizard_pix_up = "drakconnect.png";
@@ -85,25 +89,21 @@ $window1->{rwindow}->set_border_width(10);
my $warning_label1;
-my ($lan_button, $host_button, $button_apply);
+my $button_apply;
my $hostname = chomp_(`hostname`);
my $int_label = Gtk2::Label->new($netcnx->{type} eq 'lan' ? N("Gateway:") : N("Interface:"));
-my $interface_name = Gtk2::Label->new($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
+my $int_name = Gtk2::Label->new($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
my $isconnected = -1;
my $int_connect = Gtk2::Button->new(N("Wait please"));
$int_connect->set_sensitive(0);
$int_connect->signal_connect(clicked => sub {
if (!$isconnected) {
- if (cat_($network::tools::connect_prog) =~ m|/usr/bin/kppp| && -e '/usr/bin/kppp') {
- run_program::run("/usr/bin/kppp &");
- } else {
- connect_backend();
- }
+ connect_backend($netc);
} else {
- disconnect_backend();
+ disconnect_backend($netc);
}
});
@@ -115,14 +115,14 @@ each_index {
$col->set_sort_column_id($::i);
} (N("Interface"), N("IP address"), N("Protocol"), N("Driver"), N("State"));
-$list->signal_connect(button_press_event => sub {
+$list->signal_connect(button_press_event => sub {
my (undef, $event) = @_;
my (undef, $iter) = $list->get_selection->get_selected;
return unless $iter;
configure_lan() if $event->type eq '2button-press';
});
-update_list();
+update_list($modules_conf);
my ($label_host, $int_state);
@@ -132,32 +132,32 @@ $window1->{window}->add(
0, gtkpack(Gtk2::HBox->new,
Gtk2::Label->new(N("Hostname: ")),
$label_host = Gtk2::Label->new($hostname),
- $host_button = gtksignal_connect(Gtk2::Button->new(N("Configure hostname...")),
- clicked => sub {
- local ($::isWizard, $::Wizard_finished) = (1, 1);
- eval { # For wizcancel
- configureNetworkNet($in, $netc, $intf, map { $_->[0] } @all_cards);
- $button_apply->set_sensitive(1);
- update();
- };
- if ($@ =~ /wizcancel/) {}
- $::WizardWindow->destroy;
- undef $::WizardWindow;
- }
- ),
+ gtksignal_connect(Gtk2::Button->new(N("Configure hostname...")),
+ clicked => sub {
+ local ($::isWizard, $::Wizard_finished) = (1, 1);
+ eval { # For wizcancel
+ network::netconnect::main('', $netcnx, $in, $modules_conf, $netc, undef, $intf);
+ $button_apply->set_sensitive(1);
+ update();
+ };
+ if ($@ =~ /wizcancel/) {}
+ $::WizardWindow->destroy;
+ undef $::WizardWindow;
+ }
+ ),
),
1, gtkadd(gtkcreate_frame(N("LAN configuration")),
gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,0), 5),
0, $list,
0, Gtk2::HBox->new(0,0),
0, gtkpack_(Gtk2::HBox->new(0, 0),
- 0, $lan_button = gtksignal_connect(Gtk2::Button->new(N("Configure Local Area Network...")),
- clicked => \&configure_lan),
+ 0, gtksignal_connect(Gtk2::Button->new(N("Configure Local Area Network...")),
+ clicked => \&configure_lan),
),
)
),
0, gtkpack(Gtk2::HButtonBox->new,
- gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub {
+ gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub {
exec("drakhelp --id internet-connection") unless fork() }),
$button_apply = gtksignal_connect(gtkset_sensitive(Gtk2::Button->new(N("Apply")), 0),
clicked => \&apply),
@@ -169,7 +169,7 @@ $window1->{window}->add(
Gtk2::Label->new(N("Please Wait... Applying the configuration")));
$dialog->show_all;
gtkflush();
- apply();
+ apply($netc, $intf);
$dialog->destroy;
}
update();
@@ -200,17 +200,23 @@ sub manage {
my $notebook = Gtk2::Notebook->new;
$notebook->set_property('show-tabs', 0);
$notebook->set_property('show-border', 0);
-
- eval(cat_('/etc/sysconfig/drakconnect'));
- @all_cards = network::ethernet::get_eth_cards();
+ @all_cards = network::ethernet::get_eth_cards($modules_conf);
my %name = network::ethernet::get_eth_cards_names(@all_cards);
foreach (keys %name) {
- $p->{/eth|ath|wlan/ ? $name{$_} : $_} = { kind => $_ };
+ my $dev = /eth|ath|wlan/ ? $name{$_} : $_;
+ $p->{$dev} = {
+ name => $_ ,
+ intf => $intf->{$_}
+ };
}
- foreach (keys %$intf) {
- /^ippp/ and $p->{isdn} = { kind => $_ };
- /^ppp0/ and $p->{modem} = { kind => $_ };
+ while (my ($device, $interface) = each %$intf) {
+ exists $name{$device} and next;
+ my $type = network::tools::get_interface_type($interface);
+ $p->{"$type ($device)"} = {
+ name => $device,
+ intf => $interface
+ };
}
$window->{rwindow}->add(gtkpack_(Gtk2::VBox->new,
@@ -244,9 +250,9 @@ sub manage {
$apply_button = $oc->{buttons}{N("Apply")};
each_index {
- my ($name, $interface, $protocol) = ($_, $p->{$_}{kind}, $p->{$_}{protocol});
+ my ($name, $interface, $protocol) = ($_, $p->{$_}{name}, $p->{$_}{protocol});
$p->{$name}{gui}{index} = $::i;
- build_tree($netc, $p->{$name}{intf} = $intf->{$name =~ /eth|ath|wlan/ ? $interface : $name} || {}, $name, $interface, $protocol);
+ build_tree($netc, $p->{$name}{intf}, $name, $interface, $protocol);
build_notebook($netc, $p->{$name}{intf}, $p->{$name}{gui}, $apply_button, $name, $interface);
$notebook->append_page(gtkpack(Gtk2::VBox->new(0,0), $p->{$name}{gui}{notebook}));
} (sort keys %$p);
@@ -254,49 +260,34 @@ sub manage {
$interface_menu->set_popdown_strings(sort keys %$p);
$interface_menu->set_active(0);
$apply_button->set_sensitive(0);
-
+
$window->{rwindow}->show_all;
$window->main;
ugtk2->exit(0);
}
sub build_tree {
- my ($netc, $intf, $interface, $interface_kind, $protocol) = @_;
-
+ my ($netc, $intf, $interface, $interface_name, $protocol) = @_;
+
if ($interface eq 'adsl') {
$intf->{pages} = { 'TCP/IP' => 1, 'Account' => 1, 'Options' => 1, 'Information' => 1 };
- network::adsl::adsl_probe_info($intf, $netc, $protocol, $interface_kind);
- $intf->{save} = sub {
+ network::adsl::adsl_probe_info($intf, $netc, $protocol, $interface_name);
+ $intf->{save} = sub {
$netc->{internet_cnx_choice} = 'adsl';
$netc->{at_boot} = $intf->{ONBOOT} eq 'yes' ? 1 : 0;
- network::adsl::adsl_conf_backend($in, $intf, $netc, $interface_kind, $protocol)
+ network::adsl::adsl_conf_backend($in, $modules_conf, $netcnx, $netc, $intf, $interface_name, $protocol)
};
- }
+ }
elsif ($interface eq 'modem') {
$intf->{pages} = { 'TCP/IP' => 1, 'Account' => 1, 'Modem' => 1, 'Options' => 1 };
- # FIXME: code duplication, should be in network::modem::read_config
- $intf->{device} = $netc->{autodetect}{modem};
- my %l = getVarsFromSh("/usr/share/config/kppprc");
-
- $intf->{kppprc} = "/root/.kde/share/config/kppprc";
- my %m = getVarsFromSh($intf->{kppprc});
- $l{$_} = $m{$_} foreach keys %m;
-
- ($intf->{dns1}, $intf->{dns2}) = split(',', $l{DNS});
- $intf->{$_->[0]} = $l{$_->[1]} foreach [ 'connection' , 'Name' ], [ 'domain', 'Domain' ], [ 'login', 'Username' ],
- [ 'Timeout', 'Timeout' ], [ 'UseLockFile', 'UseLockFile' ], [ 'Enter', 'Enter' ],
- [ 'BusyWait', 'BusyWait' ], [ 'FlowControl', 'FlowControl' ], [ 'Speed', 'Speed' ],
- [ 'DialTone', 'DialTone' ], [ 'Volume', 'Volume' ];
- /.*ATDT(\d*)/ and $intf->{phone} = $1 foreach cat_("/etc/sysconfig/network-scripts/chat-ppp0");
- /NAME=(['"]?)(.*)\1/ and $intf->{login} ||= $2 foreach cat_("/etc/sysconfig/network-scripts/ifcfg-ppp0");
- $_->{login} eq $intf->{login} and $intf->{passwd} = $_->{passwd} foreach @{network::tools::read_secret_backend()};
+ put_in_hash($intf, network::modem::ppp_read_conf({}, $netc));
$intf->{save} = sub { network::modem::ppp_configure($in, $intf) };
- }
+ }
elsif ($interface eq 'isdn') {
$intf->{pages} = { 'TCP/IP' => 1, 'Account' => 1, 'Modem' => 1, 'Options' => 1 };
network::isdn::read_config($intf);
- $intf->{save} = sub { network::isdn::write_config($intf, $netc) };
- }
+ $intf->{save} = sub { network::isdn::write_config($intf) };
+ }
else {
#- ethernet is default
$intf->{pages} = { 'TCP/IP' => 1, if_($intf->{WIRELESS_MODE}, 'Wireless' => 1), 'Options' => 1, 'Information' => 1 };
@@ -304,24 +295,24 @@ sub build_tree {
}
sub build_notebook {
- my ($netc, $intf, $gui, $apply_button, $interface, $interface_kind) = @_;
-
+ my ($netc, $intf, $gui, $apply_button, $interface, $interface_name) = @_;
+
my $apply = sub { $apply_button->set_sensitive(1) };
my $is_ethernet = $interface =~ /eth|ath|wlan/;
if ($intf->{pages}{'TCP/IP'}) {
gtkpack($gui->{sheet}{'TCP/IP'} = Gtk2::HBox->new,
- gtkadd(gtkcreate_frame(N("IP configuration")),
+ gtkadd(gtkcreate_frame(N("IP configuration")),
gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,10), 5),
- if_($is_ethernet,
+ if_($is_ethernet,
0, gtkpack__(Gtk2::HBox->new,
Gtk2::Label->new(N("Protocol")),
$gui->{intf}{BOOTPROTO} = gtksignal_connect(Gtk2::ComboBox->new_text,
- changed => sub {
+ changed => sub {
return if !$_[0]->realized;
my $proto = $gui->{intf}{BOOTPROTO};
my $protocol = $intf->{BOOTPROTO} = { reverse %{$proto->{protocols}} }->{$proto->get_text};
-
+
foreach ($gui->{intf}{IPADDR}, $gui->{intf}{NETMASK}, $gui->{netc}{GATEWAY}) {
$_->set_sensitive($protocol eq "static" ? 1 : 0)
}; $apply->() },
@@ -330,7 +321,7 @@ sub build_notebook {
),
0, gtkpack(Gtk2::VBox->new(1,0),
gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("IP address"))),
- gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{intf}{IPADDR} = Gtk2::Entry->new,
+ gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{intf}{IPADDR} = Gtk2::Entry->new,
key_press_event => $apply)),
),
0, gtkpack(Gtk2::VBox->new(1,0),
@@ -348,7 +339,7 @@ sub build_notebook {
),
),
gtkpack_(Gtk2::VBox->new,
- 1, gtkadd(gtkcreate_frame(N("DNS servers")),
+ 1, gtkadd(gtkcreate_frame(N("DNS servers")),
gtkpack(Gtk2::VBox->new(0,0),
Gtk2::Label->new($intf->{dns1} || $netc->{dnsServer}),
if_($intf->{dns2} || $netc->{dnsServer2},
@@ -356,7 +347,7 @@ sub build_notebook {
if_($intf->{dns3} || $netc->{dnsServer3},
Gtk2::Label->new($intf->{dns3} || $netc->{dnsServer3}))),
),
- 1, gtkadd(gtkcreate_frame(N("Search Domain")),
+ 1, gtkadd(gtkcreate_frame(N("Search Domain")),
Gtk2::Label->new($intf->{domain} || $netc->{DOMAINNAME} || 'none'),
),
),
@@ -364,9 +355,9 @@ sub build_notebook {
if ($is_ethernet) {
my $proto = $gui->{intf}{BOOTPROTO};
- $proto->{protocols} = { static => N("static"), dhcp => N("DHCP") };
+ $proto->{protocols} = { none => N("none"), static => N("static"), dhcp => N("DHCP") };
$proto->set_popdown_strings(values %{$proto->{protocols}});
- $proto->set_text($proto->{protocols}{$intf->{BOOTPROTO}});
+ $proto->set_text($proto->{protocols}{$intf->{BOOTPROTO} || 'none'});
foreach ($gui->{intf}{IPADDR}, $gui->{intf}{NETMASK}, $gui->{netc}{GATEWAY}) {
$_->set_sensitive($intf->{BOOTPROTO} eq 'static' ? 1 : 0)
};
@@ -374,10 +365,10 @@ sub build_notebook {
$_->set_sensitive(0) foreach $gui->{intf}{IPADDR}, $gui->{intf}{NETMASK};
delete $gui->{intf}{BOOTPROTO};
}
- !$intf->{IPADDR} and ($intf->{IPADDR}, $gui->{active}, $intf->{NETMASK}) = get_intf_ip($interface_kind);
+ !$intf->{IPADDR} and ($intf->{IPADDR}, $gui->{active}, $intf->{NETMASK}) = get_intf_ip($interface_name);
$gui->{netc}{$_}->set_text($netc->{$_}) foreach keys %{$gui->{netc}};
}
-
+
if ($intf->{pages}{Wireless}) {
gtkpack(gtkset_border_width($gui->{sheet}{Wireless} = Gtk2::HBox->new(0,10), 5),
gtkpack_(Gtk2::VBox->new(0,0),
@@ -411,9 +402,9 @@ sub build_notebook {
),
);
}
-
+
if ($intf->{pages}{Options}) {
- gtkpack__(gtkset_border_width($gui->{sheet}{Options} = Gtk2::VBox->new(0,10), 5),
+ gtkpack__(gtkset_border_width($gui->{sheet}{Options} = Gtk2::VBox->new(0,10), 5),
$gui->{intf_bool}{ONBOOT} = gtksignal_connect(Gtk2::CheckButton->new(N("Start at boot")),
toggled => $apply),
if_($is_ethernet,
@@ -421,16 +412,16 @@ sub build_notebook {
toggled => $apply))
} ([ "HWADDR", N("Track network card id (useful for laptops)") ],
[ "MII_NOT_SUPPORTED", N("Network Hotplugging") ],
- ),
+ ),
),
if_($interface eq 'isdn',
gtkpack(Gtk2::HBox->new(0,0),
- gtkpack__(new Gtk2::VBox(0,0),
+ gtkpack__(Gtk2::VBox->new(0,0),
Gtk2::Label->new(N("Dialing mode")),
my @dialing_mode_radio = gtkradio(("auto") x 2, "manual"),
),
Gtk2::VSeparator->new,
- gtkpack__(new Gtk2::VBox(0,0),
+ gtkpack__(Gtk2::VBox->new(0,0),
Gtk2::Label->new(N("Connection speed")),
my @speed_radio = gtkradio(("64 Kb/s") x 2, "128 Kb/s"),
),
@@ -441,6 +432,11 @@ sub build_notebook {
key_press_event => $apply),
),
),
+ gtkpack__(Gtk2::HBox->new(0,5),
+ Gtk2::Label->new(N("Metric")),
+ gtksignal_connect(gtkset_text($gui->{intf}{METRIC} = Gtk2::Entry->new, $intf->{METRIC}),
+ key_press_event => $apply)),
+
);
$dialing_mode_radio[0]->signal_connect(toggled => sub { $gui->{intf_radio}{dialing_mode} = 'auto'; $apply->() });
$dialing_mode_radio[1]->signal_connect(toggled => sub { $gui->{intf_radio}{dialing_mode} = 'static'; $apply->() });
@@ -450,10 +446,10 @@ sub build_notebook {
$gui->{intf_bool}{MII_NOT_SUPPORTED}->set_active($intf->{MII_NOT_SUPPORTED} eq 'no' ? 1 : 0);
$gui->{intf_bool}{HWADDR}->set_active($intf->{HWADDR});
}
-
+
if ($intf->{pages}{Account}) {
- if ($interface_kind =~ /^speedtouch|sagem$/) {
- $gui->{description} = $interface_kind eq 'speedtouch' ? 'Alcatel|USB ADSL Modem (Speed Touch)' : 'Analog Devices Inc.|USB ADSL modem';
+ if ($interface_name =~ /^speedtouch|sagem$/) {
+ $gui->{description} = $interface_name eq 'speedtouch' ? 'Alcatel|USB ADSL Modem (Speed Touch)' : 'Analog Devices Inc.|USB ADSL modem';
}
gtkpack_(gtkset_border_width($gui->{sheet}{Account} = Gtk2::VBox->new(0,10), 5),
if_($interface eq 'modem',
@@ -474,12 +470,14 @@ sub build_notebook {
),
);
- my %auth_methods = map_index { $::i => $_ } N("PAP"), N("Terminal-based"), N("Script-based"), N("CHAP"), N("PAP/CHAP");
- $gui->{intf}{auth}->set_popdown_strings(sort values %auth_methods);
- $gui->{intf}{auth}->set_text($auth_methods{$intf->{Authentication}});
+ if ($interface eq 'modem') {
+ my %auth_methods = map_index { $::i => $_ } N("PAP"), N("Terminal-based"), N("Script-based"), N("CHAP"), N("PAP/CHAP");
+ $gui->{intf}{auth}->set_popdown_strings(sort values %auth_methods);
+ $gui->{intf}{auth}->set_text($auth_methods{$intf->{Authentication}});
+ }
$gui->{intf}{passwd}->set_visibility(0);
}
-
+
if ($intf->{pages}{Modem}) {
gtkpack(gtkset_border_width($gui->{sheet}{Modem} = Gtk2::HBox->new(0,10), 5),
if_($interface eq 'modem',
@@ -500,7 +498,7 @@ sub build_notebook {
# ),
),
Gtk2::VSeparator->new,
- gtkpack__(new Gtk2::VBox(0,10),
+ gtkpack__(Gtk2::VBox->new(0,10),
gtkpack__(Gtk2::HBox->new(0,5),
Gtk2::Label->new(N("Modem timeout")),
$gui->{intf}{Timeout} = gtksignal_connect(Gtk2::SpinButton->new(Gtk2::Adjustment->new($intf->{Timeout}, 0, 120, 1, 5, 0), 0, 0),
@@ -536,9 +534,9 @@ sub build_notebook {
),
),
Gtk2::VSeparator->new,
- gtkpack__(new Gtk2::VBox(0,0),
+ gtkpack__(Gtk2::VBox->new(0,0),
Gtk2::Label->new(N("Protocol")),
- my @protocol_radio = gtkradio('', N("European protocol (EDSS1)"),
+ my @protocol_radio = gtkradio('', N("European protocol (EDSS1)"),
N("Protocol for the rest of the world\nNo D-Channel (leased lines)")),
),
),
@@ -551,17 +549,17 @@ sub build_notebook {
$gui->{intf}{Enter}->set_popdown_strings('CR', 'CF', 'CR/LF');
$gui->{intf}{Speed}->set_popdown_strings('2400', '9600', '19200', '38400', '57600', '115200');
}
-
+
if ($intf->{pages}{Information}) {
- my ($info) = $gui->{description} ?
- find { $_->{description} eq $gui->{description} } detect_devices::probeall : network::ethernet::mapIntfToDevice($interface_kind);
- if (is_empty_hash_ref($info) and my @intfs = grep { $interface_kind eq $_->[0] } @all_cards) {
- my $driver;
- if ($#intfs == 0 and $driver = $intfs[0][1] and my @cards = grep { $_->{driver} eq $driver } detect_devices::probeall()) {
- $info = $cards[0] if $#cards == 0;
- }
+ my ($info) = $gui->{description} ?
+ find { $_->{description} eq $gui->{description} } detect_devices::probeall : network::ethernet::mapIntfToDevice($interface_name);
+ my @intfs = grep { $interface_name eq $_->[0] } @all_cards;
+ if (is_empty_hash_ref($info) && @intfs == 1) {
+ my $driver = $intfs[0][1];
+ my @cards = grep { $_->{driver} eq $driver } detect_devices::probeall();
+ @cards == 1 and $info = $cards[0];
}
-
+
gtkpack(gtkset_border_width($gui->{sheet}{Information} = Gtk2::VBox->new(0,10), 5),
gtktext_insert(Gtk2::TextView->new,
join('',
@@ -569,8 +567,8 @@ sub build_notebook {
[ N("Vendor"), split('\|', $info->{description}) ],
[ N("Description"), reverse split('\|', $info->{description}) ],
[ N("Media class"), $info->{media_type} || '-' ],
- [ N("Module name"), $info->{driver} || '-' ],
- [ N("Mac Address"), c::get_hw_address($interface_kind) || '-' ],
+ [ N("Module name"), $info->{driver} || '-' ],
+ [ N("Mac Address"), c::get_hw_address($interface_name) || '-' ],
[ N("Bus"), $info->{bus} || '-' ],
[ N("Location on the bus"), $info->{pci_bus} || '-' ],
)
@@ -579,7 +577,22 @@ sub build_notebook {
);
}
- $gui->{intf}{$_}->set_text($intf->{$_}) foreach keys %{$gui->{intf}};
+ foreach (keys %{$gui->{intf}}) {
+ next if ref($gui->{intf}{$_}) !~ /Gtk2::(ComboBox|Entry)/;
+ # skip unset fields:
+ next if !$intf->{$_};
+ # special case b/c of translation:
+ next if member($_, qw(BOOTPROTO ));
+ if ($_ eq "FlowControl") {
+ # kppp is writing translated strings :-( (eg: s/Software/Logiciel/):
+ # (let's hope that all translations use 'CRTSCTS' and 'XON/OFF' as substring)
+ $gui->{intf}{$_}->set_text('Hardware [CRTSCTS]') if $intf->{$_} =~ /CRTSCTS/;
+ $gui->{intf}{$_}->set_text('Software [XON/XOFF]') if $intf->{$_} =~ m!XON/XOFF!;
+ } else {
+ $gui->{intf}{$_}->set_text($intf->{$_});
+ }
+ }
+
$gui->{notebook} = Gtk2::Notebook->new;
populate_notebook($gui->{notebook}, $gui);
}
@@ -595,18 +608,32 @@ sub populate_notebook {
sub save {
my ($netc, $p, $apply_button) = @_;
- foreach (keys %$p) {
- save_notebook($netc, $p->{$_}{intf}, $p->{$_}{gui}) or return;
- $p->{$_}{intf}{save} ? $p->{$_}{intf}{save}->() : apply($netc, $p->{$_}{intf});
- }
+ my $dialog = _create_dialog(N("Please wait"));
+ gtkpack($dialog->vbox,
+ gtkshow(Gtk2::Label->new(N("Please Wait... Applying the configuration"))));
+ $dialog->show_all;
+ gtkset_mousecursor_wait();
+
+ Glib::Timeout->add(200, sub {
+ gtkflush();
+ foreach (keys %$p) {
+ save_notebook($netc, $p->{$_}{intf}, $p->{$_}{gui}) or return;
+ $p->{$_}{intf}{save} ? $p->{$_}{intf}{save}->() : apply($netc, $p->{$_}{intf});
+ }
+
+ system("/etc/rc.d/init.d/network restart");
+ $dialog->response(0);
+ });
+ $dialog->run;
- system("/etc/rc.d/init.d/network restart");
$apply_button->set_sensitive(0);
+ gtkset_mousecursor_normal();
+ $dialog->destroy;
}
sub save_notebook {
my ($netc, $intf, $gui) = @_;
-
+
$netc->{$_} = $gui->{netc}{$_}->get_text foreach keys %{$gui->{netc}};
$gui->{intf}{$_} and $intf->{$_} = $gui->{intf}{$_}->get_text foreach keys %{$gui->{intf}};
$gui->{intf_radio}{$_} and $intf->{$_} = $gui->{intf_radio}{$_} foreach keys %{$gui->{intf_radio}};
@@ -617,7 +644,7 @@ sub save_notebook {
if (my $proto = $gui->{intf}{BOOTPROTO}) {
$intf->{BOOTPROTO} = { reverse %{$proto->{protocols}} }->{$proto->get_text};
}
- if ($intf->{BOOTPROTO} eq 'static') {
+ if ($intf->{BOOTPROTO} eq 'static') {
check_field($intf, 'IPADDR', 'NETMASK') or $in->ask_warn(N("Error"), N("IP address should be in format 1.2.3.4")) and return 0;
}
if ($netc->{GATEWAY}) {
@@ -633,9 +660,7 @@ sub check_field {
sub add_intf() {
$::isWizard = 1;
- network::netconnect::load_conf($netcnx, $netc, $intf);
- # network::netconnect::add_interface($in, $netcnx);
- network::netconnect::main('', $netcnx, $in, $netc, undef, $intf);
+ network::netconnect::main('', $netcnx, $in, $modules_conf, $netc, undef, $intf);
$in->exit(0);
}
@@ -645,6 +670,8 @@ sub del_intf() {
$in->ask_warn(N("Error"), N("No ethernet network adapter has been detected on your system. Please run the hardware configuration tool."));
$in->exit(0);
}
+ @all_cards = network::ethernet::get_eth_cards($modules_conf);
+ my %ethernet_names = network::ethernet::get_eth_cards_names(@all_cards);
my $wiz =
{
defaultimage => "drakconnect.png",
@@ -654,19 +681,27 @@ sub del_intf() {
no_back => 1,
name => N("Select the network interface to remove:"),
data => [ { label => N("Net Device"), val => \$intf2delete, allow_empty_list => 1,
- list => [ keys %$intf, grep { -f "/etc/ppp/peers/$_" } qw(adsl isdn) ], } ],
+ list => [ keys %$intf ],
+ format => sub {
+ my $type = network::tools::get_interface_type($intf->{$_[0]});
+ $ethernet_names{$_[0]} || ($type ? "$type ($_[0])" : $_[0])
+ }
+ }
+ ],
post => sub {
!$::testing and eval {
- if (member($intf2delete, qw(adsl isdn))) {
- system("service internet stop");
- # system("ifdown " . $intf2delete eq "isdn" : "ippp0" : "ppp0");
- rm_rf("/etc/ppp/peers/$intf2delete");
- if (any { /$intf2delete/ } cat_("/etc/sysconfig/network-scripts/net_cnx_up")) {
- unlink "/etc/sysconfig/network-scripts/net_cnx_$_" foreach qw(up down);
- }
+ if (member($intf2delete, qw(adsl modem))) {
+ eval { rm_rf("/etc/ppp/peers/ppp0") };
+ eval { rm_rf("/etc/sysconfig/network-scripts/ifcfg-ppp0") };
+ }
+ if ($intf2delete eq 'adsl') {
+ eval { rm_rf("/etc/sysconfig/network-scripts/ifcfg-sagem") };
+ } elsif ($intf2delete eq 'isdn') {
+ eval { rm_rf("/etc/sysconfig/network-scripts/ifcfg-ippp0") };
} else {
system("ifdown $intf2delete");
- rm_rf("/etc/sysconfig/network-scripts/ifcfg-$intf2delete");
+ eval { rm_rf("/etc/sysconfig/network-scripts/$intf2delete") };
+ eval { rm_rf("/etc/sysconfig/network-scripts/ifcfg-$intf2delete") };
}
};
$faillure = $@;
@@ -675,10 +710,10 @@ sub del_intf() {
},
end => {
name => sub {
- ($faillure ?
- N("An error occured while deleting the \"%s\" network interface:\n\n%s",
+ ($faillure ?
+ N("An error occurred while deleting the \"%s\" network interface:\n\n%s",
$intf2delete, $faillure) :
- N("Congratulations, the \"%s\" network interface has been succesfully deleted", $intf2delete)
+ N("Congratulations, the \"%s\" network interface has been successfully deleted", $intf2delete)
)
},
end => 1,
@@ -695,7 +730,7 @@ sub get_intf_ip {
my ($ip, $state, $mask);
if (-x "/sbin/ifconfig") {
local $_ = `LC_ALL=C LANGUAGE=C /sbin/ifconfig $interface`;
- $ip = /inet addr:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/mso ? $1 : N("No Ip");
+ $ip = /inet addr:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/mso ? $1 : N("No IP");
$mask = /Mask:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/mso ? $1 : N("No Mask");
$state = /inet/ ? N("up") : N("down");
} else {
@@ -707,8 +742,9 @@ sub get_intf_ip {
my %intf;
-sub update_list() {
- @all_cards = network::ethernet::get_eth_cards();
+sub update_list {
+ my ($modules_conf) = @_;
+ @all_cards = network::ethernet::get_eth_cards($modules_conf);
my %new_intf = map { @$_ } @all_cards;
my @new_intf = sort keys %new_intf;
foreach my $interface (difference2(\@new_intf, [ keys %intf ])) {
@@ -728,9 +764,10 @@ sub apply {
my ($netc, $intf) = @_;
my $dyn = $intf->{BOOTPROTO} ne 'static';
my $lintf = $intf;
- $dyn and $lintf->{$_} = undef foreach qw(NETMASK NETWORK IPADDR);
+ #- always delete NETWORK and BROADCAST fields so that they get automatically recomputed by write_interface_conf
+ delete $lintf->{$_} foreach qw(NETWORK BROADCAST), if_($dyn, qw(IPADDR NETMASK));
network::network::sethostname($netc) if $dyn;
- network::network::configureNetwork2($in, '', $netc, { $lintf->{DEVICE} => $lintf });
+ network::network::configureNetwork2($in, $modules_conf, '', $netc, { $lintf->{DEVICE} => $lintf });
}
sub ethisup { `LC_ALL=C LANGUAGE=C /sbin/ifconfig $_[0]` =~ /inet/ }
@@ -749,8 +786,8 @@ sub update() {
my $h = chomp_(`hostname`);
$label_host->set_label($h);
$int_label->set($netcnx->{type} eq 'lan' ? N("Gateway:") : N("Interface:"));
- $interface_name->set($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
- update_list();
+ $int_name->set($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
+ update_list($modules_conf);
update_intbutt() if $isconnected != -1;
1;
}
@@ -779,6 +816,21 @@ sub update2() {
1;
}
+
+my $net_test;
+sub update_network_status() {
+ unless ($net_test) {
+ $net_test = network::test->new;
+ $net_test->start;
+ }
+ if ($net_test->is_done) {
+ $isconnected = $net_test->is_connected;
+ update_intbutt();
+ $net_test->start;
+ }
+ 1;
+}
+
sub quit_global() {
ugtk2->exit(0);
}
@@ -865,7 +917,7 @@ Configure them first by clicking on 'Configure'")));
update();
});
} else {
- $widget_temp = N("This interface has not been configured yet.\nRun the \"Add an interface\" assistant from the Mandrake Control Center");
+ $widget_temp = N("This interface has not been configured yet.\nRun the \"Add an interface\" assistant from the Mandrakelinux Control Center");
}
$vbox_local->pack_start(gtkpack__(Gtk2::HBox->new(0,0),
$widget_temp
@@ -902,7 +954,7 @@ Configure them first by clicking on 'Configure'")));
$exit_dialogsub->();
}),
);
-
+
$window->show_all;
foreach (0..$#all_cards) {
my @infos = @{$card_tab[2*$_]};
@@ -918,10 +970,10 @@ sub configure_net {
my $exit_dialogsub = sub { Gtk2->main_quit };
if (!$netcnx->{type}) {
$in->ask_warn(
- N("Warning"),
- #-PO: here "Internet access" should be translated the same was as in control-center
+ N("Warning"),
+ #-PO: here "Add Connection" should be translated the same was as in control-center
N("You don't have any configured Internet connection.
-Please run \"Internet access\" in control center."));
+Run the \"Add Connection\" assistant from the Mandrakelinux Control Center"));
$in->exit;
}
my $cnx = {};
@@ -971,10 +1023,10 @@ Please run \"Internet access\" in control center."));
0, Gtk2::Label->new(N("Internet Connection Configuration")),
1, gtkadd(gtkcreate_frame(N("Internet access")),
gtkset_border_width(create_packtable({ col_spacings => 5, row_spacings => 5, homogenous => 1 },
- [ Gtk2::Label->new(N("Connection type: ")),
+ [ Gtk2::Label->new(N("Connection type: ")),
Gtk2::Label->new(translate($netcnx->{type})) ],
- [ $int_label, $interface_name ],
- [ Gtk2::Label->new(N("Status:")),
+ [ $int_label, $int_name ],
+ [ Gtk2::Label->new(N("Status:")),
$int_state = Gtk2::Label->new(N("Testing your connection...")) ]
),
5),
@@ -991,7 +1043,7 @@ Please run \"Internet access\" in control center."));
update();
$button_apply->set_sensitive(1);
} else {
- configureNetwork2($in, '', $netc, $intf);
+ configureNetwork2($in, $modules_conf, '', $netc, $intf);
write_resolv_conf("/etc/resolv.conf", $netc);
}
$exit_dialogsub->();
@@ -1001,7 +1053,8 @@ Please run \"Internet access\" in control center."));
);
$dialog->{rwindow}->show_all;
- Glib::Timeout->add(200, \&update_intbutt);
+ update_network_status();
+ Glib::Timeout->add(2000, \&update_network_status);
$dialog->main;
ugtk2->exit(0);
}
diff --git a/perl-install/standalone/drakedm b/perl-install/standalone/drakedm
index a4f44417b..b5fb82ae4 100644
--- a/perl-install/standalone/drakedm
+++ b/perl-install/standalone/drakedm
@@ -25,14 +25,16 @@ use any;
use interactive;
use services;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/drakedm-mdk.png";
+
my $in = 'interactive'->vnew('su');
my $cfg_file = '/etc/sysconfig/desktop';
-my %dm = ('GNOME' => [ 'GDM (GNOME Display Manager)', '/usr/bin/gdm', 'gdm' ],
- 'KDM' => [ 'KDM (KDE Display Manager)', '/usr/bin/kdm', 'kdebase-kdm' ],
- 'KDE' => [ 'MdkKDM (Mandrake Display Manager)', '/usr/bin/mdkkdm', 'mdkkdm' ],
- 'XDM' => [ 'XDM (X Display Manager)', '/usr/bin/X11/xdm', 'xorg-x11' ],
+my %dm = ('GNOME' => [ N("GDM (GNOME Display Manager)"), '/usr/bin/gdm', 'gdm' ],
+ 'KDM' => [ N("KDM (KDE Display Manager)"), '/usr/bin/kdm', 'kdebase-kdm' ],
+ 'KDE' => [ N("MdkKDM (Mandrakelinux Display Manager)"), '/usr/bin/mdkkdm', 'mdkkdm' ],
+ 'XDM' => [ N("XDM (X Display Manager)"), '/usr/bin/X11/xdm', 'xorg-x11' ],
);
my $dm;
@@ -74,9 +76,9 @@ several different X sessions on your local machine at the same time.")),
} $cfg_file;
log::explanations(qq(Switching to "$dm" display manager));
if (any::running_window_manager()) {
- $in->ask_yesorno('', N("The change is done, do you want to restart the dm service ?"), 1) and
- $in->ask_yesorno('', N("You are going to close all running programs and lose your current session. Are you really sure that you want to restart the dm service ?"), 1) and
- run_program::rooted($::prefix, "nohup", "/etc/rc.d/init.d/dm", "restart");
+ $in->ask_yesorno('', N("The change is done, do you want to restart the dm service?"), 1) and
+ $in->ask_yesorno('', N("You are going to close all running programs and lose your current session. Are you really sure that you want to restart the dm service?"), 1) and
+ run_program::run("nohup", "/etc/rc.d/init.d/dm", "restart");
}
}
diff --git a/perl-install/standalone/drakfirewall b/perl-install/standalone/drakfirewall
index 8f0f0b3da..afd5abd13 100755
--- a/perl-install/standalone/drakfirewall
+++ b/perl-install/standalone/drakfirewall
@@ -23,6 +23,8 @@ use standalone; #- warning, standalone must be loaded very first, for 'expla
use interactive;
use network::drakfirewall;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/firewall-mdk.png";
+
my $in = 'interactive'->vnew('su');
network::drakfirewall::main($in, undef);
diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy
index d8f2e11b6..e94ee0225 100755
--- a/perl-install/standalone/drakfloppy
+++ b/perl-install/standalone/drakfloppy
@@ -32,6 +32,7 @@ use common;
use ugtk2 qw(:create :dialogs :helpers :wrappers);
use detect_devices;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/drakfloppy-mdk.png";
require_root_capability();
my $window = ugtk2->new('drakfloppy');
@@ -62,34 +63,28 @@ eval { %options = getVarsFromSh($conffile) };
######## up part
# device part
-my $device_combo = Gtk2::ComboBox->new_text;
-$device_combo->set_popdown_strings(map { "/dev/" . $_->{device} } detect_devices::floppies());
+my $device_combo = Gtk2::ComboBox->new_with_strings([ map { "/dev/" . $_->{device} } detect_devices::floppies() ]);
$device_combo->set_active(0);
-
# kernel part
-my $kernel_combo = Gtk2::ComboBox->new_text;
-$kernel_combo->set_popdown_strings(sort grep { !/^\.\.?$/ } sort(all("/lib/modules")));
-$kernel_combo->entry->set_text(chomp_(`uname -r`));
+my $kernel_combo = Gtk2::ComboBox->new_with_strings([ sort grep { !/^\.\.?$/ } sort(all("/lib/modules")) ], chomp_(`uname -r`));
##########################################################
-my $tips = new Gtk2::Tooltips;
-
### main window
$window->{window}->add(
gtkpack_(Gtk2::VBox->new,
- if_($::isEmbedded, 0, new Gtk2::Label(N("Boot disk creation"))),
+ if_($::isEmbedded, 0, Gtk2::Label->new(N("Boot disk creation"))),
0, gtkadd(Gtk2::Frame->new(N("General")),
- gtkpack__(new Gtk2::VBox(0, 0),
- gtkpack__(new Gtk2::HBox(1, 0),
+ gtkpack__(Gtk2::VBox->new(0, 0),
+ gtkpack__(Gtk2::HBox->new(1, 0),
Gtk2::Label->new(N("Device")),
$device_combo,
gtksignal_connect(Gtk2::Button->new(N("Default")),
clicked => sub { $device_combo->entry->set_text("/dev/fd0") }),
),
- gtkpack__(new Gtk2::HBox(1, 0),
+ gtkpack__(Gtk2::HBox->new(1, 0),
Gtk2::Label->new(N("Kernel version")),
$kernel_combo,
gtksignal_connect(Gtk2::Button->new(N("Default")),
@@ -143,10 +138,10 @@ sub pref_dialog() {
gtkpack_($dialog->vbox,
0, gtkadd(Gtk2::Frame->new(N("Mkinitrd optional arguments")),
gtkpack__(Gtk2::VBox->new(0, 5),
- $buttons{force} = new Gtk2::CheckButton(N("force")),
- $buttons{raid} = new Gtk2::CheckButton(N("omit raid modules")),
- $buttons{needed} = new Gtk2::CheckButton(N("if needed")),
- $buttons{scsi} = new Gtk2::CheckButton(N("omit scsi modules")),
+ $buttons{force} = Gtk2::CheckButton->new(N("force")),
+ $buttons{raid} = Gtk2::CheckButton->new(N("omit raid modules")),
+ $buttons{needed} = Gtk2::CheckButton->new(N("if needed")),
+ $buttons{scsi} = Gtk2::CheckButton->new(N("omit scsi modules")),
),
),
1, gtkadd(Gtk2::Frame->new(N("Add a module")),
diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont
index 89c3c3bb5..93f375280 100755
--- a/perl-install/standalone/drakfont
+++ b/perl-install/standalone/drakfont
@@ -457,7 +457,7 @@ sub backend_mod() {
print "\nUninstall Specifics Fonts.........\n";
search_installed_fonts_full_path();
if ($interactive) { search_dir_font_uninstall_gi() }
- else { search_dir_font_uninstall() foreach @uninstall }
+ else { search_dir_font_uninstall($_) foreach @uninstall }
remove_fonts();
print "\nThe End............................\n";
}
@@ -509,7 +509,9 @@ sub interactive_mode() {
$list_all_font_path || $xlsfonts || $windows || @install || @uninstall ? backend_mod() : interactive_mode();
sub help() {
- ugtk2::create_dialog(N("Help"), formatAlaTeX(N("Copyright (C) 2001-2002 by Mandrakesoft
+ ugtk2::create_dialog(N("Help"), formatAlaTeX(
+ #-PO: keep the double empty lines between sections, this is formatted a la LaTeX
+ N("Copyright (C) 2001-2002 by Mandrakesoft
DUPONT Sebastien (original version)
@@ -572,7 +574,7 @@ sub appli_choice() {
),
],
[
- gtksignal_connect(Gtk2::Button->new(N("OK")),
+ gtksignal_connect(Gtk2::Button->new(N("Ok")),
clicked => \&exitdialog,
),
],
@@ -585,12 +587,14 @@ sub font_choice() {
my $file_dialog;
$select_font_msg = N("Select the font file or directory and click on 'Add'");
$file_dialog = Gtk2::FileSelection->new(N("File Selection"));
+ $file_dialog->signal_connect(delete_event => sub { $file_dialog->response('close') });
$file_dialog->ok_button->signal_connect(clicked => \&file_ok_sel, $file_dialog);
$file_dialog->ok_button->set_label(N("Add"));
- $file_dialog->cancel_button->signal_connect(clicked => sub { $file_dialog->destroy });
+ $file_dialog->cancel_button->signal_connect(clicked => sub { $file_dialog->response('cancel') });
$file_dialog->cancel_button->set_label(N("Close"));
$file_dialog->show;
$file_dialog->run;
+ $file_dialog->destroy;
}
sub file_ok_sel {
@@ -605,7 +609,7 @@ sub file_ok_sel {
$model->append_set(undef, [ 0 => $file_name ]);
}
}
- Gtk2->main;
+ $file_selection->response('ok')
}
sub list_remove() { #- TODO : multi-selection
diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw
index cd0fdc7e3..4cf70cc1f 100755
--- a/perl-install/standalone/drakgw
+++ b/perl-install/standalone/drakgw
@@ -62,8 +62,9 @@ $in->isa('interactive::gtk') and $::isWizard = 1;
sub sys { system(@_) == 0 or log::l("[drakgw] Warning, sys failed for $_[0]") }
sub outpend {
- log::explanations("modified file $_[0]");
- my $f = shift; local *F; open F, ">>$f" or die "outpend in file $f failed: $!\n"; print F foreach @_;
+ my $f = shift;
+ log::explanations("modified file $f");
+ append_to_file($f, @_);
}
sub start_daemons () {
@@ -139,7 +140,7 @@ What would you like to do?"),
substInFile {
s/#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE/REDIRECT\tloc\t$squid_port\ttcp\twww\t-\nACCEPT\tfw\tnet\ttcp\twww\n#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE/;
} "/etc/shorewall/rules";
- run_program::rooted($::prefix, 'chkconfig', '--add', 'shorewall');
+ run_program::run('chkconfig', '--add', 'shorewall');
run_program::run('service', '>', '/dev/null', 'shorewall', 'restart') if $::isStandalone;
}
log::l("[drakgw] Enabled");
@@ -210,7 +211,8 @@ my %aliased_devices;
my $card_netconnect = network::netconnect::get_net_device() || "eth0";
defined $card_netconnect and log::l("[drakgw] Information from netconnect: ignore card $card_netconnect");
-my @all_cards = network::ethernet::get_eth_cards();
+my $modules_conf = modules::any_conf->read;
+my @all_cards = network::ethernet::get_eth_cards($modules_conf);
my %net_devices = network::ethernet::get_eth_cards_names(@all_cards);
put_in_hash(\%net_devices, { 'ppp+' => 'ppp+', 'ippp+' => 'ippp+' });
@@ -585,7 +587,7 @@ print "add rules entries\n";
substInFile {
s/#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE/REDIRECT\tloc\t$squid_port\ttcp\twww\t-\nACCEPT\tfw\tnet\ttcp\twww\n#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE/;
} "/etc/shorewall/rules";
-run_program::rooted($::prefix, 'chkconfig', '--add', 'shorewall');
+run_program::run('chkconfig', '--add', 'shorewall');
run_program::run('service', '>', '/dev/null', 'shorewall', 'restart') if $::isStandalone;
#- bye-bye message
diff --git a/perl-install/standalone/drakhelp b/perl-install/standalone/drakhelp
index b6040a291..d76ce8939 100644
--- a/perl-install/standalone/drakhelp
+++ b/perl-install/standalone/drakhelp
@@ -13,7 +13,7 @@ use ctxhelp;
use log;
-sub usage {
+sub usage() {
print STDERR N(" drakhelp 0.1
Copyright (C) 2003-2004 Mandrakesoft.
This is free software and may be redistributed under the terms of the GNU GPL.
@@ -28,17 +28,18 @@ Usage:
my ($opt, $idlabel) = @ARGV;
@ARGV == 2 && ($opt eq '--id' || $opt eq '--doc' || $opt eq '--help') or usage();
+$ugtk2::wm_icon = "help";
my $in = interactive->vnew;
-my ($lg, $instpath, $ancpath, $package) = ctxhelp::path2help($opt, $idlabel);
+my ($instpath, $ancpath, $package) = ctxhelp::path2help($opt, $idlabel);
-e $instpath or system("/usr/sbin/drakhelp_inst $package");
--e $instpath or $in->ask_warn('Mandrake Help Center', N("%s cannot be displayed \n. No Help entry of this type\n", $instpath));
+-e $instpath or $in->ask_warn(N("Mandrakelinux Help Center"), N("%s cannot be displayed \n. No Help entry of this type\n", $instpath));
my $wm = any::running_window_manager();
my %launchhelp = (
- 'kwin' => sub { system("konqueror " . $ancpath . "&") },
+ 'kwin' => sub { system("webclient-kde " . $ancpath . "&") },
'gnome-session' => sub { system("yelp ghelp://" . $ancpath . "&") },
- 'other' => sub { my $browser = $ENV{BROWSER} || find { -x "/usr/bin/$_" } qw(mozilla konqueror galeon) or $in->ask_warn('drakhelp', N("No browser is installed on your system, Please install one if you want to browse the help system"));
+ 'other' => sub { my $browser = $ENV{BROWSER} || find { -x "/usr/bin/$_" } qw(mozilla konqueror epiphany galeon) or $in->ask_warn('drakhelp', N("No browser is installed on your system, Please install one if you want to browse the help system"));
log::explanations("Loading help system : $ancpath");
system("$browser " . $ancpath . "&")
}
diff --git a/perl-install/standalone/drakperm b/perl-install/standalone/drakperm
index 234228edb..39579af91 100755
--- a/perl-install/standalone/drakperm
+++ b/perl-install/standalone/drakperm
@@ -8,12 +8,13 @@ use standalone;
use common;
use ugtk2 qw(:helpers :wrappers :create);
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/drakperm-mdk.png";
require_root_capability();
local $_ = join '', @ARGV;
#- vars declaration
my ($level) = chomp_(`cat /etc/sysconfig/msec | grep SECURE_LEVEL= |cut -d= -f2`);
-my ($default_perm_level) = "level " . $level;
+my $default_perm_level = "level " . $level;
my %perm_files = ($default_perm_level => '/usr/share/msec/perm.' . $level,
'editable' => '/etc/security/msec/perm.local',
);
@@ -51,8 +52,7 @@ my $index = 0;
load_perms();
#- widgets settings
-my $combo_perm = Gtk2::ComboBox->new_text;
-$combo_perm->set_popdown_strings(sort(values %perm_l10n));
+my $combo_perm = Gtk2::ComboBox->new_with_strings([ sort(values %perm_l10n) ]);
sub add_callback() {
row_setting_dialog();
@@ -101,7 +101,7 @@ $permList->signal_connect(button_press_event => sub {
});
-my $tips = new Gtk2::Tooltips;
+my $tips = Gtk2::Tooltips->new;
$W->add(gtkpack_(Gtk2::VBox->new(0,5),
0, Gtk2::WrappedLabel->new(N("Here you can see files to use in order to fix permissions, owners, and groups via msec.\nYou can also edit your own rules which will owerwrite the default rules."), 0.5),
@@ -198,16 +198,16 @@ sub display_perm {
sub save_perm() {
my $val;
if ($modified) {
- local *F;
- open F, '>' . $perm_files{editable} or die(qq(Impossible to process "$perm_files{editable}"));
+ my $F;
+ open $F, '>' . $perm_files{editable} or die(qq(Impossible to process "$perm_files{editable}"));
$model->foreach(sub {
my ($model, $_path, $iter) = @_;
return 0 if $model->get($iter, 0);
my $line = $model->get($iter, 1) . "\t" . $model->get($iter, 2) . ($model->get($iter, 3) ? "." . $model->get($iter, 3) : "") . "\t" . $model->get($iter, 4) . "\n";
- print F $line;
+ print $F $line;
return 0;
}, $val);
- close F;
+ close $F;
}
$modified = 0;
ugtk2->exit;
@@ -215,12 +215,9 @@ sub save_perm() {
sub load_perms() {
foreach my $file (@perm_files{($default_perm_level, 'editable')}) {
- local *F;
- open F, $file;
-
my @editable = if_($file ne $perm_files{editable}, editable => $pixbuf);
local $_;
- while (<F>) {
+ foreach (cat_($file)) {
next if /^#/;
# Editable, Path, User, Group, Permissions
if (m/^(\S+)\s+([^.\s]+)\.(\S+)?\s+(\d+)/) {
@@ -232,37 +229,45 @@ sub load_perms() {
}
$index++;
}
- close F;
}
}
sub row_setting_dialog {
my ($iter) = @_;
- my $dlg = new Gtk2::Dialog();
+ my $dlg = Gtk2::Dialog->new;
$dlg->set_transient_for($w->{rwindow}) unless $::isEmbedded;
$dlg->set_modal(1);
# $dlg->set_resizable(0);
- my $browse = new Gtk2::Button(N("browse"));
- my $file = new Gtk2::Entry;
+ my $browse = Gtk2::Button->new(N("browse"));
+ my $file = Gtk2::Entry->new;
my ($other, $group, $user, $s) = reverse(split(//, $model->get($iter, 4))) if $iter;
my @bits = qw(sticky gid suid);
my @rights = qw(read write execute);
- my @owners = qw(user group other);
+ my @owners = (N_("user"), N_("group"), N_("other"));
my %rights = (user => $user, group => $group, other => $other);
my %rights_labels = (user => N("User"), group => N("Group"), other => N("Other"));
my %checks = ('read' => {
label => N("Read"),
- tip => { map { $_ => N("Enable \"%s\" to read the file", $_) } keys %rights },
+ tip => { map { $_ =>
+ #-PO: here %s will be either "user", "group" or "other"
+ N("Enable \"%s\" to read the file", translate($_))
+ } keys %rights },
},
'write' => {
label => N("Write"),
- tip => { map { $_ => N("Enable \"%s\" to write the file", $_) } keys %rights },
+ tip => { map { $_ =>
+ #-PO: here %s will be either "user", "group" or "other"
+ N("Enable \"%s\" to write the file", translate($_))
+ } keys %rights },
},
'execute' => {
label => N("Execute"),
- tip => { map { $_ => N("Enable \"%s\" to execute the file", $_) } keys %rights },
+ tip => { map { $_ =>
+ #-PO: here %s will be either "user", "group" or "other"
+ N("Enable \"%s\" to execute the file", translate($_))
+ } keys %rights },
},
sticky => { label => N("Sticky-bit"), tip => N("Used for directory:\n only owner of directory or file in this directory can delete it") },
suid => { label => N("Set-UID"), tip => N("Use owner id for execution") },
@@ -275,18 +280,16 @@ sub row_setting_dialog {
my $alrd_exsts = defined $iter;
$file->set_text($model->get($iter, 1)) if $iter;
- my $users = Gtk2::ComboBox->new_text;
- $users->set_popdown_strings(&get_user_or_group('users'));
+ my $users = Gtk2::ComboBox->new_with_strings([ get_user_or_group('users') ]);
$users->entry->set_text($model->get($iter, 2)) if $iter;
- my $groups = Gtk2::ComboBox->new_text;
- $groups->set_popdown_strings(&get_user_or_group);
+ my $groups = Gtk2::ComboBox->new_with_strings([ get_user_or_group() ]);
$groups->entry->set_text($model->get($iter, 3)) if $iter;
my $id_box = gtkadd(Gtk2::HBox->new,
- Gtk2::Label->new(N("User :")),
+ Gtk2::Label->new(N("User:")),
$users,
- Gtk2::Label->new(N("Group :")),
+ Gtk2::Label->new(N("Group:")),
$groups,
);
@@ -301,7 +304,7 @@ sub row_setting_dialog {
$browse->signal_connect(clicked => sub {
- my $file_dlg = new Gtk2::FileSelection(N("Path selection"));
+ my $file_dlg = Gtk2::FileSelection->new(N("Path selection"));
$file_dlg->set_modal(1);
$file_dlg->set_transient_for($dlg);
$file_dlg->show;
@@ -331,7 +334,7 @@ sub row_setting_dialog {
gtkpack(gtkset_border_width(Gtk2::HBox->new, 3),
gtkadd(Gtk2::VBox->new,
Gtk2::Label->new(""),
- map { gtkset_tip($tips, Gtk2::Label->new($checks{$_}{label}), $checks{$_}{tip}) } @rights,
+ map { Gtk2::Label->new($checks{$_}{label}) } @rights,
),
(map {
my $owner = $_;
@@ -403,17 +406,14 @@ sub row_setting_dialog {
}
sub get_user_or_group {
- my $what = @_;
+ my ($what) = @_;
my @users;
- local *F;
- open F, $what eq 'users' ? '/etc/passwd' : '/etc/group';
local $_;
- while (<F>) {
+ foreach (cat_($what eq 'users' ? '/etc/passwd' : '/etc/group')) {
m/^([^#:]+):[^:]+:[^:]+:/ or next;
push @users, $1;
}
- close F;
return sort(@users);
}
diff --git a/perl-install/standalone/drakproxy b/perl-install/standalone/drakproxy
index aa48ae272..622c61859 100755
--- a/perl-install/standalone/drakproxy
+++ b/perl-install/standalone/drakproxy
@@ -26,6 +26,7 @@ use network::network;
use any;
use common;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/drakproxy-mdk.png";
my $u = { getVarsFromSh('/etc/profile.d/proxy.sh') };
my $in = 'interactive'->vnew('su');
network::network::miscellaneous_choose($in, $u);
diff --git a/perl-install/standalone/drakpxe b/perl-install/standalone/drakpxe
index 97b5a3e07..5e374faff 100755
--- a/perl-install/standalone/drakpxe
+++ b/perl-install/standalone/drakpxe
@@ -170,7 +170,7 @@ $in->ask_from('DHCP Server Configuration',
The network address is %s using a netmask of %s.
-", @{$intf[0]}{qw(NETWORK NETMASK)}), [ { label => N("The DHCP start ip"), val => \$start_ip, type => 'entry' },
+", $intf[0]{NETWORK}, $intf[0]{NETMASK}), [ { label => N("The DHCP start ip"), val => \$start_ip, type => 'entry' },
{ label => N("The DHCP end ip"), val => \$end_ip, type => 'entry' }, ])
or goto begin;
@@ -192,7 +192,7 @@ If you do not have an existing directory, please copy the CD or DVD contents.
[ { label => N("Installation image directory"), val => \$dir, type => 'entry' }, ])
or goto step_ip_range;
-unless (-d $dir && -e "$dir/VERSION" && -d "$dir/isolinux" && -d "$dir/Mandrake/base") {
+unless (-d $dir && -e "$dir/VERSION" && -d "$dir/install/isolinux" && -d "$dir/install/stage2") {
$in->ask_warn(N("No image found"),
N("No CD or DVD image found, please copy the installation program and rpm files."));
goto step_install_dir;
@@ -203,7 +203,7 @@ unless (-d $dir && -e "$dir/VERSION" && -d "$dir/isolinux" && -d "$dir/Mandrake/
step_auto_install:
-my $auto_inst_cfg = "Mandrake/base/auto_inst.cfg"; #- TODO change according configuration?
+my $auto_inst_cfg = "install/auto_inst.cfg"; #- TODO change according configuration?
-e "$dir/$auto_inst_cfg" or $auto_inst_cfg = '';
$in->ask_from('Choose auto installation',
@@ -246,7 +246,7 @@ build_dhcpd_conf($dhcpd_conf, "/etc/dhcpd.conf");
#- make kernel and initrd available for initrd.
mkdir "/var/lib/tftpboot/PXEClient/images";
-sys("cp", "-af", "$dir/isolinux/alt0", "/var/lib/tftpboot/PXEClient/images/");
+sys("cp", "-af", "$dir/install/isolinux/alt0", "/var/lib/tftpboot/PXEClient/images/");
my $pxelinux_cfg = parse_pxelinux_cfg("/var/lib/tftpboot/PXEClient/pxelinux.cfg/default");
my $label;
@@ -364,7 +364,7 @@ class "Etherboot" {
match if substring (option vendor-class-identifier, 0, 9) = "Etherboot";
# filename define the file retrieve by the client, there nbgrub
-# our tftp is chrooted so is just the path to the file
+# our TFTP is chrooted so is just the path to the file
filename "/etherboot/nbgrub";
#Used by etherboot to detect a valid pxe dhcp server
@@ -388,7 +388,7 @@ class "PXE" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
# filename define the file retrieve by the client, there pxelinux.0
-# our tftp is chrooted so is just the path to the file
+# our TFTP is chrooted so is just the path to the file
# If you prefer use grub, use pxegrub compiled for your ethernet card.
#filename "/PXEClient/pxegrub";
filename "/PXEClient/pxelinux.0";
diff --git a/perl-install/standalone/drakroam b/perl-install/standalone/drakroam
new file mode 100755
index 000000000..bdb25e61c
--- /dev/null
+++ b/perl-install/standalone/drakroam
@@ -0,0 +1,397 @@
+#!/usr/bin/perl
+
+# drakroam: wireless network roaming GUI
+# beta version uses wlandetect as backend
+# Austin Acton, 2004
+# <austin@mandrake.org>
+# Licensed under the GPL
+
+# problems
+# - deletes comments in config file
+# - expects an ifcfg file for static IP configurations (not uncommon)
+# - roaming status fails (no idea why)
+# maybe same reason bash-completion killall can't see wlandetect?
+
+# todo (wlandetect version)
+# - make known and available lists have more rows by default (why so small?)
+# - refresh status every x seconds
+# - find a good way to drop the access point and resume roaming
+# - make 'key' column wider by default
+# todo (waproamd version)
+# - listen to dbus for pings from waproamd; update all on receiving a dbus ping
+# - setup static network configurations
+# - handle keys (can key file be named after ESSID?)
+# - should files be named as MAC or as essid:ESSID ?
+
+use lib qw(/usr/lib/libDrakX);
+
+use standalone;
+use common;
+use run_program;
+
+require ugtk2;
+ugtk2->import(qw(:wrappers :create));
+use Gtk2::SimpleList;
+
+require_root_capability();
+
+# global settings
+my $route = '/sbin/route';
+my $AboutFile = 'ABOUT';
+my $HelpFile = 'README';
+my $IWList = '/sbin/iwlist';
+my $IWConfig = '/sbin/iwconfig';
+my $IFConfig = '/sbin/ifconfig';
+my $IFUp = '/sbin/ifup';
+my $IFDown = '/sbin/ifdown';
+my $DHClient = '/sbin/dhclient';
+
+# initialize variables
+my $ScanInterval = 30; # tell deamon to search for new nets every x seconds
+
+my ($KnownList, $AvailableList);
+my $device;
+
+my %available_roaming_daemons = (
+ wlandetect => {
+ config_location => '/etc/wlandetect.conf',
+ binary => '/usr/sbin/wlandetect',
+ start_options => sub {
+ my ($interval, $device) = @_;
+ "-d -t $interval";
+ },
+ read_config => sub {
+ my ($config) = @_;
+ each_index {
+ /^#/ || /^\n/ and next; #ignore comments and blank lines
+ if (/^(\S+)\s+(.*)$/) {
+ my ($essid, $mode, $channel, $dhcp, $key);
+ my $command = $2;
+ # setup new network entry
+ $essid = $1;
+ ($mode) = $command =~ /mode\s([^\s;]+)/;
+ ($channel) = $command =~ /channel\s([^\s;]+)/;
+ ($key) = $command =~ /key\s([^\s;]+)/;
+ $dhcp = $command =~ /dhclient/;
+ &AddNet($essid, $mode, $channel, $dhcp, $key);
+ }
+ else { die "Line $::i of configuration file is not parseable.\n" }
+ } cat_($config)
+ },
+ write_config => sub {
+ my ($config) = @_;
+ my @contents = (
+ "#wlandetect configuration file\n",
+ "#format: essid<tab><tab>commands\n",
+ "#use \@DEV\@ for device name\n"
+ );
+ foreach my $row (@{$KnownList->{data}}) { # again, lame
+ my $essid = $row->[0];
+ my $iwc = join(' ', $IWConfig, "essid $essid",
+ if_($row->[1], "mode $row->[1]"),
+ if_($row->[2], "channel $row->[2]"),
+ if_($row->[4], "key $row->[4]"));
+ my $ifc = $row->[3] ? "$IFConfig \@DEV\@ up; $DHClient \@DEV\@" : "$IFUp \@DEV\@";
+ push @contents, "$essid\t\t$iwc; $ifc\n";
+ }
+ output_p($config, @contents);
+ },
+ add_net => sub {},
+ remove_net => sub {},
+ },
+ waproamd => {
+ config_location => '/etc/waproamd/scripts',
+ binary => '/usr/sbin/waproamd',
+ start_options => sub {
+ my ($interval, $device) = @_;
+ "-i $device -t $interval";
+ },
+ read_config => sub {
+ my ($config) = @_;
+ foreach my $net (all($config)) {
+ $net eq "default" or next;
+ print "Adding net $net\n";
+ push @{$KnownList->{data}}, [$net];
+ }
+ },
+ write_config => sub {},
+ add_net => sub {
+ my ($config, $essid) = @_;
+ output_p("$config/$essid", qq(# essid specific config file));
+ },
+ remove_net => sub {
+ my ($config, $essid) = @_;
+ system("rm -f $config/$essid");
+ },
+ },
+);
+
+my $roaming_daemon = $available_roaming_daemons{wlandetect};
+
+my $ScanEntry = Gtk2::Entry->new;
+$ScanEntry->set_width_chars(4);
+$ScanEntry->set_text($ScanInterval);
+
+$KnownList = Gtk2::SimpleList->new(
+ "ESSID" => "text",
+ "Mode" => "text",
+ "Channel" => "text",
+ "DHCP" => "bool",
+ "Key" => "text"
+ );
+$KnownList->get_selection->set_mode('single');
+$KnownList->set_reorderable(1);
+$KnownList->set_column_editable(1, TRUE); # allow to change mode
+$KnownList->set_column_editable(2, TRUE); # allow to change channel
+$KnownList->set_column_editable(4, TRUE); # allow to change key
+
+$AvailableList = Gtk2::SimpleList->new(
+ "ESSID" => "text",
+ "Type" => "text",
+ "Encryption" => "text",
+ "Signal (%)" => "int"
+ );
+$AvailableList->get_selection->set_mode('single');
+
+my $NetLabel = Gtk2::Label->new;
+my $IpLabel = Gtk2::Label->new;
+my $GwLabel = Gtk2::Label->new;
+my $ModeLabel = Gtk2::Label->new;
+my $WepLabel = Gtk2::Label->new;
+my $SignalLabel = Gtk2::Label->new;
+
+my $w = ugtk2->new('Drakroam');
+gtkadd(gtkset_border_width($w->{window}, 2),
+ gtkpack_(Gtk2::VBox->new,
+ 0, gtkadd(gtkset_border_width(Gtk2::Frame->new("Status"), 2),
+ gtkpack(Gtk2::VBox->new,
+ create_packtable({ col_spacings => 5, row_spacings => 5, homogenous => 1 },
+ [ $NetLabel, $IpLabel, $GwLabel ],
+ [ $ModeLabel, $WepLabel, $SignalLabel ],
+ ),
+ gtkpack(create_hbox(),
+ gtksignal_connect(Gtk2::Button->new("Disconnect"), clicked => sub { &Disconnect }),
+ gtksignal_connect(Gtk2::Button->new("Refresh"), clicked => sub { &UpdateStatus })
+ )
+ )
+ ),
+ 0, gtkadd(gtkset_border_width(Gtk2::Frame->new("Roaming"), 2),
+ gtkpack(create_hbox(),
+ gtkpack(Gtk2::VBox->new,
+ my $RoamStatus = Gtk2::Label->new("Roaming: off"),
+ gtkpack(create_hbox(),
+ gtksignal_connect(Gtk2::Button->new("Start"), clicked => sub { &StartRoam }),
+ gtksignal_connect(Gtk2::Button->new("Stop"), clicked => sub { &StopRoam })
+ )
+ ),
+ gtkpack(Gtk2::VBox->new,
+ Gtk2::Label->new("Scan interval (sec): "),
+ gtkpack(Gtk2::HBox->new,
+ $ScanEntry,
+ gtksignal_connect(Gtk2::Button->new("Set"), clicked => sub { &SetInterval })
+ )
+ )
+ )
+ ),
+ 1, gtkadd(gtkset_border_width(Gtk2::Frame->new("Known Networks (Drag up/down or edit)"), 2),
+ gtkpack_(Gtk2::VBox->new,
+ 1, create_scrolled_window($KnownList),
+ 0, gtkpack(create_hbox(),
+ gtksignal_connect(Gtk2::Button->new("Remove"), clicked => sub {
+ my ($selected) = $KnownList->get_selected_indices;
+ &RemoveNet($selected);
+ }),
+ gtksignal_connect(Gtk2::Button->new("Connect"), clicked => sub {
+ my ($selected) = $KnownList->get_selected_indices;
+ &ConnectNow($selected);
+ }),
+ gtksignal_connect(Gtk2::Button->new("Save"), clicked => sub { &WriteConfig })
+ )
+ )
+ ),
+ 1, gtkadd(gtkset_border_width(Gtk2::Frame->new("Available Networks"), 2),
+ gtkpack_(Gtk2::VBox->new,
+ 1, create_scrolled_window($AvailableList),
+ 0, gtkpack(create_hbox(),
+ gtksignal_connect(Gtk2::Button->new("Add"), clicked => sub {
+ my @selected = $AvailableList->get_selected_indices;
+ my ($mode, $channel, $key);
+ my $essid = $AvailableList->{data}["@selected"][0];
+ my $dhcp = 1; # assume dhcp for new networks
+ &AddNet($essid, $mode, $channel, $dhcp, $key);
+ }),
+ gtksignal_connect(Gtk2::Button->new("Rescan"), clicked => sub { &UpdateAvailable })
+ )
+ )
+ ),
+ 0, gtkpack(create_hbox(),
+ gtksignal_connect(Gtk2::Button->new("Help"), clicked => sub { &Dialog($HelpFile) }),
+ gtksignal_connect(Gtk2::Button->new("About"), clicked => sub { &Dialog($AboutFile) }),
+ gtksignal_connect(Gtk2::Button->new("Save and close"), clicked => sub {
+ &WriteConfig;
+ Gtk2->main_quit;
+ })
+ )
+ )
+ );
+
+# fill the GUI
+&ReadConfig;
+&UpdateAll;
+
+sub UpdateAll {
+ &UpdateAvailable; #must go first as it defines the device name
+ &UpdateStatus;
+ &UpdateRoaming;
+}
+
+sub isRoamingRunning() {
+ my $name = basename($roaming_daemon->{binary});
+ any { /\Q$name\E$/ } run_program::get_stdout("ps", "-A");
+}
+
+sub UpdateRoaming() {
+ my $status = isRoamingRunning() ? "on" : "off";
+ $RoamStatus->set_text("Roaming: $status");
+ return FALSE; #- do not update again if launched on timeout
+}
+
+sub UpdateStatus() {
+ my $CurrentNet = "-";
+ my $CurrentIP = "---.---.---.---";
+ my $CurrentGW = "---.---.---.---";
+ my $CurrentMode = "";
+ my $CurrentWEP = "";
+ my $CurrentSignal = "-";
+ print("Updating\n");
+ foreach (run_program::get_stdout($IWConfig, $device)) {
+ /ESSID:"(\S*)"/ and $CurrentNet = $1;
+ /Mode:(\S*)\s/ and $CurrentMode = $1;
+ /key:(\S*)\s/ and $CurrentWEP = $1;
+ m!Quality:(\S*)/! and $CurrentSignal = $1;
+ }
+ foreach (run_program::get_stdout($IFConfig, $device)) {
+ if (/inet addr:(\S*)\s/) { $CurrentIP = $1 }
+ }
+ foreach (run_program::get_stdout($route)) {
+ if (/default\s*(\S*)\s/) { $CurrentGW = $1 }
+ else { $CurrentGW = "---.---.---.---" }
+ }
+ $NetLabel->set_text("Net: $CurrentNet");
+ $ModeLabel->set_text("Mode: $CurrentMode");
+ $IpLabel->set_text("IP: $CurrentIP");
+ $WepLabel->set_text("Encryption: $CurrentWEP");
+ $GwLabel->set_text("Gateway: $CurrentGW");
+ $SignalLabel->set_text("Signal: $CurrentSignal");
+}
+
+sub UpdateAvailable() {
+ my ($essid, $mode, $wep, $signal);
+ print("Running iwlist\n");
+ @{$AvailableList->{data}} = ();
+ foreach (run_program::get_stdout($IWList, "scan")) {
+ /([^ ]+)([ \t]+)Scan completed :/ and $device = $1;
+ /([^ ]+)([ \t]+)No scan results/ and $device = $1;
+ /ESSID:"(\S*)"/ and $essid = $1;
+ /Mode:(\S*)/ and $mode = $1;
+ m!Quality:(\S*)/! and $signal = $1;
+ if (/key:(\S*)\s/) {
+ $wep = $1;
+ print("ESSID: $essid, Mode: $mode, WEP: $wep, Signal: $signal\n");
+ push @{$AvailableList->{data}}, [$essid, $mode, $wep, $signal];
+ }
+ }
+}
+
+sub AddNet {
+ my ($essid, $mode, $channel, $dhcp, $key) = @_;
+ print "Adding net $essid\n";
+ push @{$KnownList->{data}}, [ $essid, $mode, $channel, $dhcp, $key ];
+ $_->{add_net}($_->{config_location}, $essid) foreach values %available_roaming_daemons;
+}
+
+sub RemoveNet {
+ my ($selected) = @_;
+ my $essid = $KnownList->{data}[$selected][0];
+ print "Removing net $essid\n";
+ splice @{$KnownList->{data}}, $selected, 1;
+ $_->{remove_net}($_->{config_location}, $essid) foreach values %available_roaming_daemons;
+}
+
+sub ReadConfig() {
+ $_->{read_config}($_->{config_location}) foreach values %available_roaming_daemons;
+}
+
+sub WriteConfig() {
+ $_->{write_config}($_->{config_location}) foreach values %available_roaming_daemons;
+}
+
+sub StartRoam() {
+ my $options = $roaming_daemon->{start_options}($ScanInterval, $device);
+ my $name = basename($roaming_daemon->{binary});
+ system("killall $name; $roaming_daemon->{binary} $options &");
+ Glib::Timeout->add(1000, \&UpdateRoaming);
+}
+
+sub StopRoam() {
+ my $name = basename($roaming_daemon->{binary});
+ system("killall $name");
+ Glib::Timeout->add(1000, \&UpdateRoaming);
+}
+
+sub SetInterval() {
+ $ScanInterval = $ScanEntry->get_text;
+ if (isRoamingRunning()) {
+ StopRoam();
+ StartRoam();
+ }
+}
+
+sub ConnectNow {
+ my ($row) = @_;
+ my @command = "";
+ push @command, "$IWConfig $device essid $KnownList->{data}[$row][0] ";
+ if ($KnownList->{data}[$row][1]) {
+ push @command, "mode $KnownList->{data}[$row][1] ";
+ }
+ if ($KnownList->{data}[$row][2]) {
+ push @command, "channel $KnownList->{data}[$row][2] ";
+ }
+ if ($KnownList->{data}[$row][4]) {
+ push @command, "key $KnownList->{data}[$row][4] ";
+ }
+ push @command, "; ";
+ if ($KnownList->{data}[$row][3]) {
+ push @command, "$IFConfig $device up; $DHClient $device";
+ }
+ else {
+ push @command, "$IFUp $device"
+ }
+ my $ToBash = join("", @command);
+ print("Sending $ToBash\n");
+ system($ToBash);
+ &UpdateStatus;
+}
+
+sub Disconnect {
+ print("Dropping $device\n");
+ system("$IFDown $device");
+ &UpdateStatus;
+}
+
+sub Dialog {
+ my ($FilePointer) = @_;
+ my $content = join('', cat_($FilePointer));
+ # dump into a dialog
+ my $AboutWindow = Gtk2::Dialog->new("Drakroam Info", $w->{window},
+ 'destroy-with-parent',
+ N("Ok") => 'none');
+ $AboutWindow->vbox->add(create_scrolled_window(Gtk2::Label->new($content)));
+ $AboutWindow->signal_connect(response => sub { $_[0]->destroy });
+ $AboutWindow->show_all;
+}
+
+# start GUI
+print "Starting GUI\n";
+
+$w->main;
diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec
index d62d5a313..105ab92f0 100755
--- a/perl-install/standalone/draksec
+++ b/perl-install/standalone/draksec
@@ -38,11 +38,23 @@ use security::l10n;
#/^-?-(\S+)$/ and $options{$1} = 1 foreach @ARGV;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/draksec-mdk.png";
my ($w, %fields);
############################ I18N ###################################
-my %inv_translations = map { translate($_) => $_ } N_("ALL"), N_("LOCAL"), N_("NONE"), N_("default"), N_("default"), N_("ignore"), N_("no"), N_("yes");
-my %translations = reverse %inv_translations;
+
+my @help;
+
+my %translations = (
+ 'ALL' => N("ALL"),
+ 'LOCAL' => N("LOCAL"),
+ 'NONE' => N("NONE"),
+ 'default' => N("Default"),
+ 'ignore' => N("Ignore"),
+ 'no' => N("No"),
+ 'yes' => N("Yes"),
+);
+my %inv_translations = reverse %translations;
sub to_i18n { map { $translations{$_} || $_ } @_ }
sub from_i18n { $inv_translations{$_[0]} || $_[0] }
@@ -54,8 +66,9 @@ my %inv_fields = reverse %fields;
# factorize this with rpmdrake and harddrake2
sub wait_msg {
my $mainw = ugtk2->new(N("Please wait"), (modal => 1, if_(!$::isEmbedded, transient => $w->{rwindow})));
- $mainw->{window}->add(new Gtk2::WrappedLabel($_[0]));
+ $mainw->{window}->add(Gtk2::WrappedLabel->new($_[0]));
$mainw->{rwindow}->show_all;
+ $mainw->{rwindow}->realize;
gtkset_mousecursor_wait($mainw->{rwindow}->window);
gtkflush();
$mainw;
@@ -67,28 +80,35 @@ sub basic_seclevel_explanations() {
my $text = Gtk2::TextView->new;
use Gtk2::Pango;
my %common_opts = ('left-margin' => '10', 'right-margin' => '10');
+ # this is a small parser for a Pango Text Attribute Markup Language-like for TextViews widget
gtktext_insert($text, [ map {
- if (my ($title, $str) = m!<span foreground="royalblue3">(.*)</span>(.*)!) {
- if_($title, [ $title, { 'foreground' => 'royalblue3', 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD, %common_opts } ]),
- if_($str, [ $str . "\n\n", \%common_opts ]);
+ if (s!^/span>!!) {
+ [ $_, \%common_opts ];
+ } elsif (s!span !!) {
+ my %tags = %common_opts;
+ while (s!(\w+?)="(\w+?)"!!) {
+ $tags{weight} ||= Gtk2::Pango->PANGO_WEIGHT_BOLD if $1 eq 'foreground';
+ $tags{$1} = $2 eq "bold" ? Gtk2::Pango->PANGO_WEIGHT_BOLD : $2;
+ }
+ s/^>//;
+ [ $_, \%tags ];
} else {
- if_($_, [ "$_\n\n", \%common_opts ]);
- }
- } split("\n",
-
- formatAlaTeX(
-#-PO: Do not alter the <span ..> and </span> tags
-#-PO: Translate the security levels (Poor, Standard, High, Higher and Paranoid) in the same way, you translated these individuals words
+ [ $_, \%common_opts ];
+ }
+ } split("<", formatAlaTeX(
+#-PO: Do not alter the <span ..> and </span> tags.
+#-PO: Translate the security levels (Poor, Standard, High, Higher and Paranoid) in the same way, you translated these individuals words.
+#-PO: keep the double empty lines between sections, this is formatted a la LaTeX.
N("Here, you can setup the security level and administrator of your machine.
-The Security Administrator is the one who will receive security alerts if the
-'Security Alerts' option is set. It can be a username or an email.
+The '<span weight=\"bold\">Security Administrator</span>' is the one who will receive security alerts if the
+'<span weight=\"bold\">Security Alerts</span>' option is set. It can be a username or an email.
-The Security Level menu allows you to select one of the six preconfigured security levels
-provided with msec. These levels range from poor security and ease of use, to
-paranoid config, suitable for very sensitive server applications:
+The '<span weight=\"bold\">Security Level</span>' menu allows you to select one of the six preconfigured security levels
+provided with msec. These levels range from '<span weight=\"bold\">poor</span>' security and ease of use, to
+'<span weight=\"bold\">paranoid</span>' config, suitable for very sensitive server applications:
<span foreground=\"royalblue3\">Poor</span>: This is a totally unsafe but very
@@ -118,16 +138,36 @@ maximum"))) ]);
sub new_nonedit_combo {
my ($string_list, $o_default_value) = @_;
- my $w = Gtk2::ComboBox->new_text ;
- $w->set_popdown_strings(to_i18n(@$string_list)) unless is_empty_array_ref $string_list;
- $w->entry->set_text(to_i18n($o_default_value)) if $o_default_value;
- $w;
+ Gtk2::ComboBox->new_with_strings([ to_i18n(@$string_list) ], to_i18n($o_default_value));
+}
+
+sub register_help_page {
+ my ($domain) = @_;
+ push @help,
+ ([
+ [ $domain . "\n\n",
+ {
+ justification => 'center',
+ scale => Gtk2::Pango->PANGO_SCALE_LARGE,
+ weight => Gtk2::Pango->PANGO_WEIGHT_BOLD,
+ },
+ ],
+ [ N("Description of the fields:\n\n"), ],
+ ],
+ );
}
-sub set_help_tip {
- my ($entry, $default, $opt) = @_;
+
+sub register_help_entry {
+ my ($label, $default, $opt) = @_;
my $help = $security::help::help{$opt};
- gtkset_tip(new Gtk2::Tooltips, $entry, formatAlaTeX($help) . "\n" . N("(default value: %s)", to_i18n($default)));
+ push @{$help[-1]},
+ ([
+ formatAlaTeX($label) . ":\n",
+ { foreground => "royalblue3" },
+ ],
+ [ join("\n", formatAlaTeX($help), N("(default value: %s)", to_i18n($default)), "\n") ]
+ );
}
my $msec = new security::msec;
@@ -147,7 +187,7 @@ unless ($::isEmbedded) {
$window->signal_connect('delete_event', sub { $window->destroy });
$window->signal_connect('destroy', sub { ugtk2->exit });
-$window->add(my $vbox = gtkshow(new Gtk2::VBox(0, 0)));
+$window->add(my $vbox = gtkshow(Gtk2::VBox->new(0, 0)));
# Create the notebook (for bookmarks at the top)
my $notebook = create_notebook();
@@ -157,7 +197,7 @@ my $common_opts = { col_spacings => 10, row_spacings => 5, mcc => 1 };
######################## BASIC OPTIONS PAGE ################################
my ($seclevel_entry, $secadmin_entry);
-$notebook->append_page(gtkshow(gtkpack_(new Gtk2::VBox(0, 0),
+$notebook->append_page(gtkshow(gtkpack_(Gtk2::VBox->new(0, 0),
1, basic_seclevel_explanations(),
0, create_packtable($common_opts,
[
@@ -177,7 +217,7 @@ $notebook->append_page(gtkshow(gtkpack_(new Gtk2::VBox(0, 0),
}) ],
[ Gtk2::WrappedLabel->new(N("Security Administrator:")),
$secadmin_entry = Gtk2::Entry->new_with_text($msec->get_check_value("MAIL_USER")) ]))),
- new Gtk2::Label(N("Basic options")));
+ Gtk2::Label->new(N("Basic options")));
if ($msec->get_check_value("MAIL_WARN") eq "yes") {
$secadmin_check->set_active(1);
@@ -190,13 +230,12 @@ my @yesno_choices = qw(yes no default ignore);
my @alllocal_choices = qw(ALL LOCAL NONE default);
my @all_choices = (@yesno_choices, @alllocal_choices);
my %options_values;
-my $help_msg = N("The following options can be set to customize your\nsystem security. If you need an explanation, look at the help tooltip.\n");
foreach ([ 'network', N("Network Options") ], [ 'system', N("System Options") ]) {
my ($domain, $label) = @$_;
+ register_help_page($label);
my %values;
- $notebook->append_page(gtkshow(gtkpack_(Gtk2::VBox->new,
- 0, Gtk2::Label->new($help_msg),
+ gtkappend_page($notebook, gtkshow(gtkpack_(Gtk2::VBox->new,
1, create_scrolled_window(create_packtable($common_opts,
map {
my $i = $_;
@@ -208,11 +247,11 @@ foreach ([ 'network', N("Network Options") ], [ 'system', N("System Options") ])
$values{$i} = new_nonedit_combo(member($default, @yesno_choices) ? \@yesno_choices : if_(member($default, @alllocal_choices), \@alllocal_choices));
$entry = $values{$i}->entry;
} else {
- $values{$i} = new Gtk2::Entry();
+ $values{$i} = Gtk2::Entry->new;
$entry = $values{$i};
}
$entry->set_text(to_i18n($msec->get_function_value($opt)));
- set_help_tip($entry, $default, $opt);
+ register_help_entry($i, $default, $opt);
[ Gtk2::WrappedLabel->new($i), resize($values{$i}) ];
} sort map { $fields{$_} || $_ } $msec->list_functions($domain),
),
@@ -227,18 +266,20 @@ foreach ([ 'network', N("Network Options") ], [ 'system', N("System Options") ])
######################## PERIODIC CHECKS ###################################
my %security_checks_value;
-$notebook->append_page(gtkshow(gtkpack_(Gtk2::VBox->new,
- 0, Gtk2::Label->new($help_msg),
+my $check_string = N("Periodic Checks");
+
+register_help_page($check_string);
+gtkappend_page($notebook, gtkshow(gtkpack_(Gtk2::VBox->new,
1, create_scrolled_window(create_packtable($common_opts,
map {
my $i = $_;
my $opt = $inv_fields{$i} || $i;
$security_checks_value{$i} = new_nonedit_combo([ 'yes', 'no', 'default' ], $msec->get_check_value($opt));
my $entry = $security_checks_value{$i}->entry;
- set_help_tip($entry, $msec->get_check_default($opt), $opt);
+ register_help_entry($i, $msec->get_check_default($opt), $opt);
[ gtkshow(Gtk2::WrappedLabel->new($i)), resize($security_checks_value{$i}) ];
} sort map { $fields{$_} || $_ } $msec->list_checks)))),
- new Gtk2::Label(N("Periodic Checks")));
+ Gtk2::Label->new($check_string));
####################### OK CANCEL BUTTONS ##################################
@@ -286,7 +327,7 @@ gtkpack_($vbox,
}
$msec->apply_functions;
log::explanations("Applying msec changes");
- run_program::rooted($::prefix, "/usr/sbin/msec");
+ run_program::run("/usr/sbin/msec");
remove_wait_msg($w);
@@ -294,9 +335,29 @@ gtkpack_($vbox,
}
},
undef, undef, '',
- [ N("Help"), sub { unless (fork()) { exec("drakhelp --id draksec") } } ],
+ [ N("Help"), sub {
+ my $text = Gtk2::TextView->new;
+ create_dialog(N("Help"),
+ gtktext_insert($text,
+ [
+ # -1 b/c of main page:
+ @{$help[$notebook->get_current_page-1]}
+ ]
+ ),
+ { use_markup => 1,
+ if_(!$::isEmbedded, transient => $w->{window}),
+ height => 400,
+ width => 600,
+ scroll => 1,
+ },
+ );
+ } ],
),
);
+
+$notebook->signal_connect("switch-page" => sub { $oc->{buttons}{N("Help")}->set_sensitive($_[2]) });
+
+$oc->{buttons}{N("Help")}->set_sensitive(0);
$oc->{cancel}->can_default(1);
$oc->{cancel}->grab_default;
diff --git a/perl-install/standalone/draksound b/perl-install/standalone/draksound
index 4a33c094c..da018d17a 100755
--- a/perl-install/standalone/draksound
+++ b/perl-install/standalone/draksound
@@ -19,7 +19,7 @@
use lib qw(/usr/lib/libDrakX);
use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
+
use strict;
use interactive;
use common;
@@ -29,23 +29,25 @@ use detect_devices;
my $in = 'interactive'->vnew('su');
-modules::mergein_conf();
-my @devices = grep { $_->{media_type} eq 'MULTIMEDIA_AUDIO' } detect_devices::probeall();
-if (@devices) {
+my $modules_conf = modules::any_conf->read;
+
+if (my @devices = modules::probe_category('multimedia/sound')) {
# TODO: That need some work for multiples sound cards
map_index {
# allocate sound-slot in the same order as install2.pm
# fill $device->{driver} with the right sound-slot-XX or default driver if missing sound-slot [real fix'll be in harddrake service]
- my $driver = modules::get_alias("sound-slot-$::i");
- $driver = modules::get_alias($driver) if $driver =~ /sound-card/; # alsaconf ...
+ my $driver = $modules_conf->get_alias("sound-slot-$::i");
+ $driver = $modules_conf->get_alias($driver) if $driver =~ /sound-card/; # alsaconf ...
$_->{current_driver} = $driver if $driver;
- $_->{sound_slot_index} = $::i;
- harddrake::sound::config($in, $_, $::i);
- } modules::probe_category('multimedia/sound');
+ $_->{sound_slot_index} = $::i;
+ harddrake::sound::config($in, $modules_conf, $_, $::i);
+ } @devices;
} else {
$in->ask_warn(N("No Sound Card detected!"),
- formatAlaTeX(N("No Sound Card has been detected on your machine. Please verify that a Linux-supported Sound Card is correctly plugged in.
+ formatAlaTeX(
+ #-PO: keep the double empty lines between sections, this is formatted a la LaTeX
+ N("No Sound Card has been detected on your machine. Please verify that a Linux-supported Sound Card is correctly plugged in.
You can visit our hardware database at:
@@ -55,5 +57,5 @@ http://www.linux-mandrake.com/en/hardware.php3") .
N("\n\n\nNote: if you've an ISA PnP sound card, you'll have to use the alsaconf or the sndconfig program. Just type \"alsaconf\" or \"sndconfig\" in a console.")));
}
-modules::write_conf();
+$modules_conf->write;
$in->exit(0);
diff --git a/perl-install/standalone/draksplash b/perl-install/standalone/draksplash
index 527631bd6..4a59407bd 100755
--- a/perl-install/standalone/draksplash
+++ b/perl-install/standalone/draksplash
@@ -4,7 +4,7 @@ use strict;
use lib qw(/usr/lib/libDrakX);
use standalone;
use common;
-use ugtk2 qw(:helpers :wrappers :create);
+use ugtk2 qw(:create :dialogs :helpers :wrappers);
use interactive;
#- convenience variables for true and false
@@ -25,7 +25,7 @@ unless ($in->do_pkgs->is_installed('ImageMagick')) {
#- application vars
my $tmp_path = '/tmp/draksplash/';
-! -d $tmp_path and mkdir($tmp_path);
+mkdir($tmp_path) if !-d $tmp_path;
my $thm_path = '/usr/share/bootsplash/themes/';
my $boot_conf_path = '/etc/bootsplash/themes/';
my $cfg_path = "/cfg/";
@@ -158,7 +158,7 @@ $first{widgets}{combo}{res}->entry->signal_connect(changed => sub {
$boot_conf_frame{frame} = Gtk2::Frame->new(N("Configure bootsplash picture"));
&make_boot_frame;
$first_vbox->add($boot_conf_frame{frame});
- member($theme{name}, giv_exist_thm()) && thm_in_this_res() && get_this_thm_res_conf() || $in->ask_warn(N("Notice"), N("This theme does not yet have a bootsplash in %s !", $theme{res}{res}));
+ member($theme{name}, giv_exist_thm()) && thm_in_this_res() && get_this_thm_res_conf() || $in->ask_warn(N("Notice"), N("This theme does not yet have a bootsplash in %s!", $theme{res}{res}));
});
#- go to bootsplash configuration step 2
#$first{widgets}{button}{boot_conf}->signal_connect(clicked => sub{show_act(\%boot_conf_frame) } );
@@ -220,46 +220,44 @@ sub write_boot_thm {
system('convert -scale '.$theme{res}{res} . ' ' . $img_file . ' ' . $thm_path.$theme{name} . '/images/bootsplash-' . $theme{res}{res} . '.jpg');
system('/usr/share/bootsplash/scripts/rewritejpeg '.$thm_path.$theme{name}.'/images/bootsplash-'.$theme{res}{res}.'.jpg');
#- write conf files
- my $cfg_cont = '# This is the configuration file for the '.$theme{res}{res}.' bootsplash picture
+ output($cfg_file, qq(# This is the configuration file for the $theme{res}{res} bootsplash picture
# this file is necessary to specify the coordinates of the text box on the
# splash screen.
# tx is the x coordinate of the text window in characters. default is 24
# multiply width font width for coordinate in pixels.
-tx='.$theme{boot_conf}{tx}.'
+tx=$theme{boot_conf}{tx}
# ty is the y coordinate of the text window in characters. default is 14
-ty='.$theme{boot_conf}{ty}.'
+ty=$theme{boot_conf}{ty}
# tw is the width of the text window in characters. default is 130
# note: this should at least be 80 as on the standard linux text console
-tw='.$theme{boot_conf}{tw}.'
+tw=$theme{boot_conf}{tw}
# th is the height of the text window in characters. default is 44
# NOTE: this should at least be 25 as on the standard linux text console
-th='.$theme{boot_conf}{th}.'
+th=$theme{boot_conf}{th}
# px is the progress bar x coordinate of its upper left corner
-px='.$theme{boot_conf}{px}.'
+px=$theme{boot_conf}{px}
# py is the progress bar y coordinate of its upper left corner
-py='.$theme{boot_conf}{py}.'
+py=$theme{boot_conf}{py}
# pw is the with of the progress bar
-pw='.$theme{boot_conf}{pw}.'
+pw=$theme{boot_conf}{pw}
# ph is the height of the progress bar
-ph='.$theme{boot_conf}{ph}.'
+ph=$theme{boot_conf}{ph}
# pc is the color of the progress bar
-pc='.$theme{boot_conf}{pc}.'';
- my $globalconf_cont = '# Display logo on console.
-LOGO_CONSOLE='.$logo.'
+pc=$theme{boot_conf}{pc}));
+ output($globalconf_file, qq(# Display logo on console.
+LOGO_CONSOLE=$logo
# Make kernel message quiet by default.
-QUIET='.$quiet;
- output($globalconf_file, $globalconf_cont);
- output($cfg_file, $cfg_cont);
+QUIET=$quiet));
}
@@ -269,25 +267,17 @@ sub get_this_thm_res_conf() {
and $theme{name} = $first{widgets}{combo}{name}->entry->get_text
and thm_in_this_res(1)
and read_boot_conf();
- -f $thm_path.$theme{name}."/images/bootsplash-".$theme{res}{res}.".jpg"
- and $img_file = $thm_path . $theme{name} . "/images/bootsplash-" . $theme{res}{res} . ".jpg";
+ my $file = $thm_path.$theme{name}."/images/bootsplash-".$theme{res}{res}.".jpg";
+ $img_file = $file if -f $file;
return 1;
}
sub read_boot_conf {
chdir($boot_conf_path);
- my $line;
- if (-f $theme{name} . "/$cfg_path/bootsplash-" . $theme{res}{res} . '.cfg') {
- local *CFG;
- open CFG, $theme{name} . "/$cfg_path/bootsplash-" . $theme{res}{res} . '.cfg';
- while ($line = <CFG>) {
- $line =~ m/^([a-z][a-z])=([^\n]+)/
- and $theme{boot_conf}{$1} = $2;
- }
- close CFG;
+ my $file = $theme{name} . "/$cfg_path/bootsplash-" . $theme{res}{res} . '.cfg';
+ if (-f $file) {
+ $theme{boot_conf} = { getVarsFromSh($file) };
&set_scale_values;
- } else {
- return 0;
}
}
@@ -316,7 +306,7 @@ sub which_res_exist() {
$first{widgets}{combo}{res}->entry->set_text($_);
last;
}
- $is_ok == 1 or $in->ask_warn(N("Notice"), N("This theme does not yet have a bootsplash in %s !", $theme{res}{res})) and return 0;
+ $is_ok == 1 or $in->ask_warn(N("Notice"), N("This theme does not yet have a bootsplash in %s!", $theme{res}{res})) and return 0;
return 1;
}
@@ -466,8 +456,8 @@ sub make_boot_frame() {
}
#- calculation of the 2 angle of text box and progress bar
set_thm_values();
- my $_w = $in->wait_message('', N("Generating preview ..."));
- my $txt_tl_yy = $theme{boot_conf}{tx}*$font_size{w};
+ my $_w = $in->wait_message('', N("Generating preview..."));
+ my $txt_tl_xx = $theme{boot_conf}{tx}*$font_size{w};
my $txt_tl_yy = $theme{boot_conf}{ty}*$font_size{h};
my $txt_width = $theme{boot_conf}{tw}*$font_size{w};
my $txt_height = $theme{boot_conf}{th}*$font_size{h};
@@ -496,38 +486,33 @@ sub set_thm_values() {
}
-my ($prev_pic, $prev_canvas);
-
#- Desc => destroy properly all widget of preview window
-sub kill_preview() {
- $prev_window->destroy; undef($prev_window);
- $prev_canvas->destroy; undef($prev_canvas);
- undef($prev_pic);
-}
#- Desc => create a new window with a preview of splash screen
#- Args => $img_file (str) full path to preview file
sub show_prev {
my ($txt_tl_xx, $txt_tl_yy, $txt_width, $txt_height, $prog_tl_xx, $prog_tl_yy, $prog_width, $prog_height) = @_;
- $prev_window
- or $prev_window = Gtk2::Window->new('toplevel');
+ $prev_window ||= Gtk2::Window->new('toplevel');
$prev_window->set_title(
#-PO: First %s is theme name, second %s (in parenthesis) is resolution
N("%s BootSplash (%s) preview", $theme{name}, $theme{res}{res}));
- $prev_pic = gtkcreate_pixbuf($img_file);
+ my $prev_pic;
+ eval { $prev_pic = gtkcreate_pixbuf($img_file) };
+ if (my $err = $@) {
+ err_dialog(N("Error"),
+ #-PO: Do not alter the <span ..> and </span> tags
+ N("The image \"%s\" cannot be load due to the following issue:\n\n<span foreground=\"Red\">%s</span>", $img_file, $err),
+ { use_markup => 1 }
+ );
+ return;
+ }
+
$prev_pic->scale_simple($theme{res}{w}, $theme{res}{h}, 'hyper');
- $prev_canvas && $prev_canvas->isa('Gtk2::Widget')
- or $prev_canvas = Gtk2::DrawingArea->new and $prev_window->add($prev_canvas);
- $prev_canvas->set_size_request($theme{res}{w}, $theme{res}{h});
- $prev_canvas->signal_connect(expose_event => sub {
- my ($w, $event) = @_;
- my ($x, $y, $width, $height) = $event->area->values;
- $prev_pic->render_to_drawable($w->window, $w->style->fg_gc('normal'), $x, $y, $x, $y, $width, $height, 'normal', 0, 0);
- $prev_canvas->window->draw_rectangle($prev_canvas->style->black_gc, $true, $txt_tl_xx, $txt_tl_yy, $txt_width, $txt_height);
- $prev_canvas->window->draw_rectangle($prev_canvas->style->black_gc, $true, $prog_tl_xx, $prog_tl_yy, $prog_width, $prog_height);
- });
- $prev_window->signal_connect(delete_event => \&kill_preview);
+ $prev_window->add(Gtk2::Image->new_from_pixbuf($prev_pic));
+ $prev_window->signal_connect(delete_event => sub {
+ $prev_window->destroy; undef($prev_window);
+ undef($prev_pic);
+ });
$prev_window->show_all;
-
}
#- Desc => define the max size of boot's scales
diff --git a/perl-install/standalone/draksplash2 b/perl-install/standalone/draksplash2
new file mode 100644
index 000000000..38bb464d3
--- /dev/null
+++ b/perl-install/standalone/draksplash2
@@ -0,0 +1,351 @@
+#!/usr/bin/perl
+
+#- convert in.png -colors 128 -treedepth 6 -dither out.gif
+
+use strict;
+
+use lib '/usr/lib/libDrakX';
+use Getopt::Long;
+use ugtk2 qw(:all);
+use Gtk2::Gdk::Keysyms;
+use MDK::Common;
+use Image::Magick;
+
+
+my $kernel_size = 1500; #- in KiB
+my $initrd_size = 130; #- in KiB
+
+my $lilo_block_size = 50; #- in KiB
+my $isolinux_block_size = 64; #- in KiB
+
+my @modes = (
+ { Vesa => 0x101, X => 640, Y => 480 },
+ { Vesa => 0x103, X => 800, Y => 600 },
+ { Vesa => 0x105, X => 1024, Y => 768 },
+ { Vesa => 0x107, X => 1280, Y => 1024 },
+);
+
+my (%image_size, $kernel_and_initrd_size);
+my ($progress_rect, $progress_color) = ([], {});
+my ($timer_pos, $timer_bg, $timer_fg) = ({}, {}, {});
+my ($entry_rect, $entry_selected_color, $entry_color) = ([], {}, {});
+my $isolinux_mode;
+
+my $magick = Image::Magick->new;
+
+my ($current_rect, $current_point);
+my ($image_area, $image_pixbuf);
+
+sub move_point {
+ my ($up_down, $direction) = @_;
+ my $wanted = $current_point->{$direction} + $up_down;
+ if (0 <= $wanted && $wanted < $image_size{$direction}) {
+ $current_point->{$direction} += $up_down;
+ }
+ $image_area->queue_draw;
+}
+sub create_image_area() {
+ $image_area = Gtk2::DrawingArea->new;
+ $image_area->can_focus(1);
+ $image_area->add_events('button-press-mask');
+ $image_area->signal_connect(button_press_event => \&image_button_pressed);
+ $image_area->signal_connect(expose_event => \&image_expose);
+ gtkmodify_font($image_area, 'Monospace 12');
+
+ my $keys = {
+ $Gtk2::Gdk::Keysyms{Down} => sub { move_point( ($_[0] ? 5 : 1), 'Y') },
+ $Gtk2::Gdk::Keysyms{Up} => sub { move_point(-($_[0] ? 5 : 1), 'Y') },
+ $Gtk2::Gdk::Keysyms{Left} => sub { move_point(-($_[0] ? 5 : 1), 'X') },
+ $Gtk2::Gdk::Keysyms{Right} => sub { move_point( ($_[0] ? 5 : 1), 'X') },
+ $Gtk2::Gdk::Keysyms{q} => sub { Gtk2->main_quit },
+ $Gtk2::Gdk::Keysyms{Escape} => sub { Gtk2->main_quit },
+ };
+
+ $image_area->signal_connect(key_press_event => sub {
+ my (undef, $event) = @_;
+
+ if (my $f = $keys->{$event->keyval}) {
+ $f->(member('control-mask', @{$event->state}));
+ }
+ 1;
+ });
+
+ $image_area->grab_focus;
+ $image_area->show;
+ $image_area;
+}
+sub image_expose {
+ my ($widget) = @_;
+ my $window = $widget->window;
+ $window->draw_pixbuf($widget->style->white_gc, $image_pixbuf, 0, 0, 0, 0, -1, -1, 'none', 0, 0);
+
+ if (!$isolinux_mode) {
+ {
+ my $layout = $widget->create_pango_layout('--:--');
+ my ($width, $height) = $layout->get_pixel_size;
+ $window->draw_rectangle(color_index2gc($window, $timer_bg), 1, $timer_pos->{X}, $timer_pos->{Y}, $width, $height);
+ $window->draw_layout(color_index2gc($window, $timer_fg), $timer_pos->{X}, $timer_pos->{Y}, $layout);
+ }
+ my ($x, $y, $w, $h) = rectangle2xywh($entry_rect);
+ my @std_labels = ('linux', 'failsafe', '2.6.3-7mdk', 'X' x ($w / 8));
+ for (my $nb = 0; $nb < int($h / 16); $y += 16, $nb++) {
+ my $label = shift(@std_labels) || 'label_' . ($nb+1);
+ my $gc = color_index2gc($window, !$nb ? $entry_selected_color : $entry_color);
+ my $layout = $widget->create_pango_layout($label);
+ $window->draw_layout($gc, $x, $y, $layout);
+ }
+ }
+ {
+ my ($x, $y, $w, $h) = rectangle2xywh($progress_rect);
+ my $w2 = $w - $w % nb_steps();
+ if ($current_rect) {
+ $window->draw_rectangle(color_index2gc($window, $progress_color), 1, $x, $y, $w2, $h);
+ $window->draw_rectangle($widget->style->black_gc, 0, $x, $y, $w, $h);
+ } else {
+ $window->draw_rectangle(color_index2gc($window, $progress_color), 1, $x, $y, $w, $h);
+ }
+ }
+ 0;
+}
+sub image_button_pressed {
+ my (undef, $event) = @_;
+
+ if ($event->button eq '3') {
+ create_popup()->popup(undef, undef, undef, undef, '3', $event->time);
+ return 1;
+ }
+
+ my $point = { X => $event->x, Y => $event->y };
+ my $chosen_point;
+
+ if ($current_rect) {
+ if (!@$current_rect) {
+ my @corners = ({ X => 0, Y => 0 },
+ { X => 0, Y => $image_size{Y} - 1 },
+ { X => $image_size{X} - 1, Y => 0 },
+ { X => $image_size{X} - 1, Y => $image_size{Y} - 1 });
+ @$current_rect = ($corners[farthest($point, @corners)], nearest($point, @corners));
+ }
+ $current_point = nearest($point, @$current_rect);
+ } elsif ($current_point) {
+ %$current_point or %$current_point = %$point;
+ } else {
+ return;
+ }
+
+ %$current_point = %$point;
+ $current_point->{Color} = $magick->Get("index[$point->{X},$point->{Y}]");
+
+ $image_area->queue_draw;
+ 1;
+}
+
+sub image_set_file {
+ my ($file) = @_;
+
+ $image_pixbuf = Gtk2::Gdk::Pixbuf->new_from_file($file);
+ %image_size = (X => $image_pixbuf->get_width, Y => $image_pixbuf->get_height);
+ $image_area->set_size_request($image_size{X}, $image_size{Y});
+ $image_area->queue_draw;
+}
+
+sub color_index2gc {
+ my ($window, $color) = @_;
+ my ($r, $g, $b) = split(',', $magick->Get("colormap[$color->{Color}]"));
+ my $gc = Gtk2::Gdk::GC->new($window);
+
+ my $gdk_color = Gtk2::Gdk::Color->new($r, $g, $b) or die "bad color for $r,$g,$b";
+ $window->get_colormap->rgb_find_color($gdk_color);
+ $gc->set_rgb_fg_color($gdk_color);
+ $gc;
+}
+
+sub rectangle2xywh {
+ my ($rect) = @_;
+
+ my $x = min($rect->[0]{X} , $rect->[1]{X});
+ my $y = min($rect->[0]{Y} , $rect->[1]{Y});
+ my $w = abs($rect->[0]{X} - $rect->[1]{X});
+ my $h = abs($rect->[0]{Y} - $rect->[1]{Y});
+ ($x, $y, $w, $h);
+}
+
+sub distance {
+ my ($p1, $p2) = @_;
+ sqr($p1->{X} - $p2->{X}) + sqr($p1->{Y} - $p2->{Y});
+}
+
+sub farthest {
+ my ($point, @others) = @_;
+ my $i = 0;
+ my $dist = 0;
+ my $farthest;
+ foreach (@others) {
+ my $d = distance($point, $_);
+ if ($d >= $dist) {
+ $dist = $d;
+ $farthest = $_;
+ }
+ }
+ $farthest;
+}
+
+sub nearest {
+ my ($point, @others) = @_;
+ my $i = 0;
+ my $dist;
+ my $nearest;
+ foreach (@others) {
+ my $d = distance($point, $_);
+ if (! defined $dist || $d < $dist) {
+ $dist = $d;
+ $nearest = $_;
+ }
+ }
+ $nearest;
+}
+
+sub create_popup() {
+ my %l = my @l = (
+ 'Progress bar position' => sub { $current_rect = $progress_rect },
+ 'Progress bar color' => sub { $current_point = $progress_color },
+ '' => sub {},
+ $isolinux_mode ? (
+ 'switch to lilo mode' => sub { $isolinux_mode = 0 },
+ ) : (
+ 'Timer position' => sub { $current_point = $timer_pos },
+ 'Timer text color' => sub { $current_point = $timer_fg },
+ 'Timer background' => sub { $current_point = $timer_bg },
+ '' => sub {},
+ 'Entry position' => sub { $current_rect = $entry_rect },
+ 'Entry text selected color' => sub { $current_point = $entry_selected_color },
+ 'Entry text color' => sub { $current_point = $entry_color },
+ '' => sub {},
+ 'switch to isolinux mode' => sub { $isolinux_mode = 1 },
+ ),
+
+ );
+
+ my $popup = Gtk2::Menu->new;
+ foreach (group_by2(@l)) {
+ my ($descr, $f) = @$_;
+ gtkappend($popup,
+ gtksignal_connect(Gtk2::MenuItem->new_with_label($descr),
+ activate => sub {
+ $current_rect = $current_point = undef;
+ $f->();
+ }));
+ }
+ $popup
+}
+sub nb_steps() {
+ $kernel_and_initrd_size / ($isolinux_mode ? $isolinux_block_size : $lilo_block_size);
+}
+
+sub read_parameters {
+ my ($file) = @_;
+ my %h = getVarsFromSh($file);
+
+ $entry_rect->[0]{X} = $h{'entry_x'};
+ $entry_rect->[0]{Y} = $h{'entry_y'};
+ $entry_rect->[1]{X} = $h{'entry_x'} + $h{'entry_w'};
+ $entry_rect->[1]{Y} = $h{'entry_y'} + $h{'entry_h'};
+ $entry_color->{Color} = $h{'entry_bg'} - 64;
+ $entry_selected_color->{Color} = $h{'entry_fg'} - 64;
+
+ $timer_pos->{X} = $h{'timer_x'};
+ $timer_pos->{Y} = $h{'timer_y'};
+ $timer_bg->{Color} = $h{'timer_bg'} - 64;
+ $timer_fg->{Color} = $h{'timer_fg'} - 64;
+
+ $progress_color->{Color} = $h{'progress_c'} - 64;
+ $progress_rect->[0]{X} = $h{'progress_x'};
+ $progress_rect->[0]{Y} = $h{'progress_y'};
+ $progress_rect->[1]{X} = $h{'progress_x'} + $h{'progress_real_w'};
+ $progress_rect->[1]{Y} = $h{'progress_y'} + $h{'progress_h'};
+
+ $isolinux_mode = $h{'isolinux_mode'};
+}
+
+sub save_parameters {
+ my ($file) = @_;
+ my %h;
+
+ $h{'mode'} = (find { $image_size{X} eq $_->{X} } @modes)->{Vesa};
+ $h{'clear_h'} = $image_size{X};
+ $h{'clear_w'} = $image_size{Y};
+
+ if (!$isolinux_mode) {
+ ($h{'entry_x'}, $h{'entry_y'}, $h{'entry_w'}, $h{'entry_h'}) = rectangle2xywh($entry_rect);
+ $h{'entry_w_chr'} = int($h{'entry_w'} / 8);
+ $h{'entry_h_chr'} = int($h{'entry_h'} / 16);
+ $h{'entry_bg'} = $entry_color->{Color} + 64;
+ $h{'entry_fg'} = $entry_selected_color->{Color} + 64;
+
+ $h{'timer_x'} = $timer_pos->{X};
+ $h{'timer_y'} = $timer_pos->{Y};
+ $h{'timer_bg'} = $timer_bg->{Color} + 64;
+ $h{'timer_fg'} = $timer_fg->{Color} + 64;
+ }
+
+ $h{'progress_c'} = $progress_color->{Color} + 64;
+ ($h{'progress_x'}, $h{'progress_y'}, $h{'progress_real_w'}, $h{'progress_h'}) = rectangle2xywh($progress_rect);
+ $h{'progress_w'} = int($h{'progress_real_w'} / nb_steps());
+
+ $h{'isolinux_mode'} = $isolinux_mode;
+
+ output($file, map { "$_=$h{$_}\n" } sort keys %h);
+}
+
+# MAIN #########################################################################
+my $usage = <<EOF;
+usage: $0 [--kernel <kernel> --initrd <initrd>] [--size <size in KiB>] <image>
+(kernel and initrd are used to compute the size of data to load)
+EOF
+
+GetOptions('kernel=s' => \ (my $kernel),
+ 'initrd=s' => \ (my $initrd),
+ 'size=s' => \$kernel_and_initrd_size,
+ 'isolinux' => \ (my $force_isolinux_mode),
+ ) or die $usage;
+
+my ($file) = @ARGV;
+@ARGV == 1 && -e $file or die $usage;
+
+if ($kernel_and_initrd_size) {
+ $kernel and die "give kernel and initrd or size, not both\n";
+} else {
+ if ($kernel) {
+ $initrd or die "give both kernel and initrd\n";
+ $kernel_size = (-s $kernel) / 1024 or die "bad file $kernel: $!\n";
+ $initrd_size = (-s $initrd) / 1024 or die "bad file $initrd: $!\n";
+ }
+ $kernel_and_initrd_size = $kernel_size + $initrd_size;
+}
+
+my $err;
+$err = $magick->Read($file) and die $err;
+
+my $bmp_file_name = $file;
+$bmp_file_name =~ s/\.\w\w\w?$//;
+$bmp_file_name .= '.bmp';
+
+if ($file ne $bmp_file_name || $magick->Get('colors') > 128) {
+ warn "writing $bmp_file_name\n";
+ $err = $magick->Quantize(colors => 128, dither => 'True', treedepth => 6) and die $err;
+ $err = $magick->Write(filename => "bmp3:$bmp_file_name", compression => 'None') and die $err;
+}
+read_parameters("$bmp_file_name.parameters");
+$isolinux_mode ||= $force_isolinux_mode;
+
+my $window_widget = Gtk2::Window->new('toplevel');
+$window_widget->signal_connect(destroy => sub { Gtk2->main_quit });
+gtkadd($window_widget,
+ gtkpack(Gtk2::VBox->new(0,0), create_image_area()));
+image_set_file($bmp_file_name);
+
+$window_widget->show;
+$image_area->window->set_cursor(Gtk2::Gdk::Cursor->new('crosshair'));
+Gtk2->main;
+
+save_parameters("$bmp_file_name.parameters");
diff --git a/perl-install/standalone/drakupdate_fstab b/perl-install/standalone/drakupdate_fstab
index 77c07ef89..fde9fa585 100755
--- a/perl-install/standalone/drakupdate_fstab
+++ b/perl-install/standalone/drakupdate_fstab
@@ -31,9 +31,23 @@ $::isStandalone = 1; #- not using standalone.pm which generates too many logs fo
log::l("drakupdate_fstab called with @ARGV\n");
-$::testing = $ARGV[0] eq '--test' && shift @ARGV;
-$::auto = $ARGV[0] eq '--auto' && shift @ARGV;
-my $no_flag = $ARGV[0] eq '--no-flag' && shift @ARGV;
+my ($no_flag, $debug, $removed);
+
+my %args = (
+ '--auto' => \$::auto,
+ '--debug' => \$debug,
+ '--no-flag' => \$no_flag,
+ '--test' => \$::testing,
+ );
+
+each_index {
+ if ($args{$_}) {
+ ${$args{$_}} = 1;
+ splice @ARGV, $::i - $removed, 1;
+ $removed++;
+ }
+} @ARGV;
+
my ($raw_action, $device_name) = @ARGV;
my ($action) = $raw_action =~ /^--(add|del)/;
@@ -47,8 +61,8 @@ sub check_hard_drives {
#- do not do anything if there are many partitions
#- otherwise we may add main extended partitions
- if ($name =~ s|/part\d+$||) {
- my @parts = grep { /part/ } all($name);
+ if (my ($path, $prefix) = $name =~ m!^(.*)/(\w+)\d+$!) {
+ my @parts = grep { /^\Q$prefix\E\d+$/ } all($path);
@parts <= 1;
} else {
1;
@@ -60,45 +74,47 @@ sub device_name_to_entry {
$name =~ s|/dev/||;
$name =~ /fd[01]/ && !$::auto and return { device => $name };
my @l = detect_devices::get();
+ if ($debug) {
+ require Data::Dumper;
+ output("/tmp/drakdump_devices-$action", Data::Dumper->Dump([ \@l ], [ qw($l) ]));
+ }
- my ($e, $nb);
- if ((my $devfs_prefix, $nb) = $name =~ m,(.*)/(?:cd|disc|part(\d+))$,) {
+ my $e;
+ if (my ($devfs_prefix, $nb) = $name =~ m,(.*)/(?:cd|disc|part(\d+))$,) {
$e = find { $_->{devfs_prefix} eq $devfs_prefix } @l;
- } else {
- if ($e = find { $name eq $_->{device} } @l) {
- $nb = '';
+ $e->{part_number} = $nb;
+ $e->{devfs_prefix} ||= $devfs_prefix;
+ $e->{devfs_device} = $e->{devfs_prefix} . '/part' . $nb;
+ if ($e->{devfs_device} eq $name) {
+ $e->{prefer_devfs_name} = 1;
} else {
- (my $prefix, $nb) = $name =~ m/^(.*?)(\d*)$/;
+ $e->{devfs_device} = $e->{device} = $name;
+ }
+ } else {
+ unless ($e = find { $name eq $_->{device} } @l) {
+ my ($prefix) = $name =~ m/^(.*?)\d*$/;
$e = find { $prefix eq ($_->{prefix} || $_->{device}) } @l;
+ $e->{device} = $name;
}
}
- if ($nb) {
- $e->{devfs_device} = $e->{devfs_prefix} . '/part' . $nb;
- $e->{device} = ($e->{prefix} || $e->{device}) . $nb;
- }
- $e ||= {};
- if ($e->{devfs_device} eq $name) {
- $e->{prefer_devfs_name} = 1;
- } else {
- $e->{device} = $name; #- keeping the exact name given (often is the devfs name)
- }
$e->{media_type} = 'fd' if $name =~ /fd[01]/;
$e;
}
sub set_options {
- my ($part, $useSupermount) = @_;
+ my ($part, $useSupermount, $o_sync) = @_;
$part->{is_removable} = 1; #- force removable flag
- fs::set_default_options($part,
+ fs::mount_options::set_default($part,
useSupermount => $useSupermount,
security => security::level::get(),
lang::fs_options(lang::read()));
- my ($options, $unknown) = fs::mount_options_unpack($part);
+ my ($options, $unknown) = fs::mount_options::unpack($part);
+ $options->{sync} = $o_sync if defined($o_sync);
$options->{kudzu} = 1 if !$no_flag;
- fs::mount_options_pack($part, $options, $unknown);
+ fs::mount_options::pack($part, $options, $unknown);
}
sub set_mount_point {
@@ -108,7 +124,7 @@ sub set_mount_point {
$mntpoint = "/mnt/$mntpoint";
foreach ('', 2 .. 10) {
- next if fsedit::mntpoint2part("$mntpoint$_", $fstab);
+ next if fs::get::mntpoint2part("$mntpoint$_", $fstab);
$part->{mntpoint} = "$mntpoint$_";
return 1;
}
@@ -134,15 +150,21 @@ sub main {
my $fstab = [ fs::read_fstab('', '/etc/fstab', 'keep_freq_passno', 'keep_devfs_name', 'verbatim_credentials') ];
my ($existing_fstab_entries, $fstab_) = partition { fsedit::is_same_hd($_, $part) } @$fstab;
+ if ($debug) {
+ require Data::Dumper;
+ output("/tmp/drakdump_entries-$action", Data::Dumper->Dump([ \@ARGV, $part, $fstab, $fstab_, $existing_fstab_entries ],
+ [ qw($ARGV $part $fstab $fstab_ $existing_fstab_entries) ]));
+ }
if ($action eq 'add') {
if (@$existing_fstab_entries) {
print STDERR "Already in fstab\n" if $::testing;
return;
}
- my $useSupermount = ${{ getVarsFromSh('/etc/sysconfig/dynamic') }}{SUPERMOUNT} eq 'no' ? '' : 'magicdev';
- set_options($part, $useSupermount);
+ my %dynamic = getVarsFromSh('/etc/sysconfig/dynamic');
+ my $useSupermount = $dynamic{SUPERMOUNT} eq 'yes' ? 'magicdev' : '';
+ set_options($part, $useSupermount, to_bool($dynamic{SYNC} ne 'no'));
set_mount_point($part, $fstab) or return;
-
+
my ($line) = fs::prepare_write_fstab([$part]);
if ($line) {
append_to_file($fstab_file, $line);
diff --git a/perl-install/standalone/drakups b/perl-install/standalone/drakups
index 9f55af292..6e12956f8 100755
--- a/perl-install/standalone/drakups
+++ b/perl-install/standalone/drakups
@@ -23,16 +23,25 @@ my ($w, $in); # GUI
my %indexes;
-sub writeconf {
+sub writeconf() {
info_dialog(N("Warning"), "Write support for users is incomplete\n\nIt lacks some support for some extra fields that would be lost else");
log::explanations("Updating NUT configuration accordingly");
$struct->writeConf($files{devices});
- log::explanations("Updating NUT users configuration accordingly");
- $users->writeConf($files{users});
+ if ($users) {
+ log::explanations("Updating NUT users configuration accordingly");
+ $users->writeConf($files{users});
+ }
+
+ require services;
+ services::restart("upsd");
}
-sub readDriversList {
+sub read_nut_config() {
+ $struct = Libconf::Glueconf::NUT::Ups_conf->new($files{devices})
+}
+
+sub readDriversList() {
my (%ups, @ups);
local $_;
foreach (cat_(first(glob("/usr/share/doc/nut-*/docs/driver.list")))) {
@@ -42,12 +51,14 @@ sub readDriversList {
driver => $driver,
extra => $extra,
};
- push @ups, "$vendor|$model";
+ push @ups, "$vendor|$model ($extra)";
}
}
\%ups, \@ups;
}
+my %models;
+
sub add_device_wizard {
my ($in, $config) = @_;
my ($ups_models, $model_list) = readDriversList();
@@ -63,7 +74,7 @@ sub add_device_wizard {
auto => N("Connected through a serial port or an usb cable"),
manual => N("Manual configuration"),
);
- my $method = $methods{manual};
+ my $method = $methods{auto};
$wiz = {
#defaultimage => "logdrake.png", # FIXME
name => N("Add an UPS device"),
@@ -71,14 +82,14 @@ sub add_device_wizard {
welcome => {
name => N("Welcome to the UPS configuration utility.
-Here, you'll be add a new UPS to your system.\n"),
+Here, you'll add a new UPS to your system.\n"),
no_back => 1,
next => 'method'
},
method => {
name => N("We're going to add an UPS device.
-Do you prefer autodetect UPS devices connected to this machine or ?"),
+Do you want to autodetect UPS devices connected to this machine or to manually select them?"),
data => [ { label => N("Autodetection"), val => \$method, type => "list",
list => [ values %methods ] } ],
post => sub { +{ reverse %methods }->{$method} },
@@ -87,7 +98,7 @@ Do you prefer autodetect UPS devices connected to this machine or ?"),
end => 1,
pre => sub {
local $::isWizard;
- my $wait = $in->wait_message(N("Please wait"), N("Detection in progress"));
+ my $_wait = $in->wait_message(N("Please wait"), N("Detection in progress"));
# UPS autoconfig:
detect_devices::probeSerialDevices() if !$::testing;
@new_devices = ();
@@ -95,10 +106,11 @@ Do you prefer autodetect UPS devices connected to this machine or ?"),
foreach my $ups_device (detect_devices::getUPS()) {
my $str = $ups_device->{name} || $ups_device->{DESCRIPTION};
$str =~ s/ /_/g;
+ $name = $str;
if (!exists $struct->{$str}) {
- $struct->{$str}{port} = $ups_device->{port} || $ups_device->{DEVICE};
- $struct->{$str}{driver} = $ups_device->{driver};
+ $port = $struct->{$str}{port} = $ups_device->{port} || $ups_device->{DEVICE};
+ $driver = $struct->{$str}{driver} = $ups_device->{driver};
push @new_devices, $str;
}
}
@@ -106,7 +118,7 @@ Do you prefer autodetect UPS devices connected to this machine or ?"),
name => sub {
if (@new_devices) {
N("Congratulations") . "\n\n" .
- N("The wizard successfully added the following UPS devices:", join("\n\n-", @new_devices))
+ N("The wizard successfully added the following UPS devices:") . join("\n\n-", @new_devices)
} else {
N("No new UPS devices was found");
}
@@ -117,9 +129,9 @@ Do you prefer autodetect UPS devices connected to this machine or ?"),
data => [ { label => N("Manufacturer / Model:"), val => \$ups, list => $model_list,
type => 'combo', sort => 1, separator => '|' }, ],
post => sub {
- ($vendor, $model) = split(/\|/, $ups);
+ ($vendor, $model) = ($1, $2) if $ups =~ /(.*)\|(.*) \(/;
($name, $driver, $port) = ("myups", $ups_models->{$vendor}{$model}{driver}, "");
- ($driver) = split(/\s*/, $driver);
+ ($driver) = split(/\s+/, $driver);
"driver";
},
},
@@ -131,7 +143,7 @@ Please fill in its name, its driver and its port.", $model, $vendor);
data => sub {
[
{ label => N("Name:"), val => \$name, help => N("The name of your ups") },
- { label => N("Driver:"), val => \$driver, help => N("The driver that manage your ups") },
+ { label => N("Driver:"), val => \$driver, help => N("The driver that manages your ups") },
{ label => N("Port:"), val => \$port, format => \&mouse::serial_port2text, type => "combo",
list => [ &mouse::serial_ports() ], not_edit => 0,
help => N("The port on which is connected your ups") },
@@ -154,6 +166,8 @@ Please fill in its name, its driver and its port.", $model, $vendor);
$config->{$name}{driver} = $driver;
$config->{$name}{port} = $port;
+ # refresh the GUI when needed:
+ $models{ups}->append_set(1 => $name, 2 => $driver, 3 => $port) if $models{ups};
log::explanations(qq(Configuring "$name" UPS));
}
@@ -206,19 +220,19 @@ sub edit_row {
}
-sub add_callback() {
- my ($model, $list, $getindex) = @_;
+sub add_callback {
+ my ($model, $_list, $_getindex) = @_;
edit_row($model);
}
-sub edit_callback() {
+sub edit_callback {
my ($model, $list) = @_;
my ($iter) = $list->get_selection->get_selected;
return unless $iter;
edit_row($model, $iter);
}
-sub del_callback() {
+sub del_callback {
my ($model, $list) = @_;
my (undef, $iter) = $list->get_selection->get_selected;
my $removed_idx = $list->get($iter, 0); # 1st column is index
@@ -243,9 +257,10 @@ my @pages = (
remove => sub { },
},
load => sub {
- $struct = Libconf::Glueconf::NUT::Ups_conf->new($files{devices});
+ read_nut_config();
map { [ $_, @{$struct->{$_}}{qw(driver port)} ] } keys %$struct;
},
+ id => "ups",
},
{ name => N("UPS users"),
columns => [ N("Name") ],
@@ -261,6 +276,7 @@ my @pages = (
$users = Libconf::Glueconf::NUT::Ups_conf->new($files{users});
map { [ $_ ] } keys %$users;
},
+ id => "users",
},
{ name => N("Access Control Lists"),
columns => [ N("Name"), N("IP address"), N("IP mask") ],
@@ -273,6 +289,7 @@ my @pages = (
load_access_conf();
@acls;
},
+ id => "acls",
},
{ name => N("Rules"),
columns => [ N("Action"), N("Level"), N("ACL name"), N("Password") ],
@@ -283,6 +300,7 @@ my @pages = (
},
load => sub { @rules }, # already loaded when we loaded acls
+ id => "rules",
},
);
@@ -294,6 +312,16 @@ my @pages = (
$in = 'interactive'->vnew;
$ugtk2::wm_icon = "drakups";
+
+$in->do_pkgs->ensure_is_installed('nut-server', '/etc/rc.d/init.d/upsd') if !$::testing;
+
+if (any { $_ eq '--wizard' } @ARGV) {
+ read_nut_config();
+ add_device_wizard($in, $struct);
+ writeconf();
+ $in->exit($@ ? 1 : 0);
+}
+
$w = ugtk2->new(N("DrakUPS"));
if (!$::isEmbedded) {
$::main_window = $w->{rwindow};
@@ -307,9 +335,9 @@ if (!$::isEmbedded) {
my $_msg = N("Welcome to the UPS configuration tools");
$w->{window}->add(gtkpack_(Gtk2::VBox->new,
- 0, Gtk2::Banner->new('drakups', N("DrakUPS")),
+ if_(!$::isEmbedded, 0, Gtk2::Banner->new('drakups', N("DrakUPS"))),
1, my $nb = Gtk2::Notebook->new,
- 0, create_okcancel( my $oc =
+ 0, create_okcancel(my $oc =
{
ok_clicked => sub {
#$_->{save}->() foreach @pages;
@@ -332,11 +360,11 @@ my %labels = (
);
foreach my $i (@pages) {
- my $model = Gtk2::ListStore->new("Glib::Int", ("Glib::String") x listlength(@{$i->{columns}}));
+ my $model = $models{$i->{id}} = Gtk2::ListStore->new("Glib::Int", ("Glib::String") x listlength(@{$i->{columns}}));
my (%buttons, $list);
$indexes{$i->{name}} = 0;
my $idx = \$indexes{$i->{name}};
- my $getindex = sub { ${$idx}++ };
+ my $getindex = sub { $$idx++ };
$nb->append_page(gtkpack_(Gtk2::VBox->new,
1, create_scrolled_window($list = Gtk2::TreeView->new_with_model($model),
[ 'automatic', 'automatic' ]),
@@ -348,7 +376,7 @@ foreach my $i (@pages) {
})
} ([ 'add', N("Add"), $i->{callbacks}{add} || \&add_callback ],
[ 'edit', N("Edit"), \&edit_callback ],
- [ 'remove', N("Remove"), \&del_callback],
+ [ 'remove', N("Remove"), \&del_callback ],
)
)
#(map {
@@ -380,6 +408,5 @@ foreach my $i (@pages) {
#------------------------------------------------------------------
# let's start the show:
-$in->do_pkgs->ensure_is_installed('nut-server', '/usr/sbin/upsd') if !$::testing;
$w->{rwindow}->show_all;
$w->main;
diff --git a/perl-install/standalone/drakvpn b/perl-install/standalone/drakvpn
index fd6fb5c3f..a374d36bb 100644
--- a/perl-install/standalone/drakvpn
+++ b/perl-install/standalone/drakvpn
@@ -88,7 +88,7 @@ begin:
#- **********************************
#- * 0th step: verify if we are already set up
-if ($shorewall && -f "/etc/shorewall/tunnels") {
+if ($shorewall && any { !/^\s*(?:#|\n)/ } cat_($tunnels_file)) {
$::Wizard_no_previous = 1;
if (!$shorewall->{disabled}) {
@@ -97,7 +97,7 @@ N("The setup of a VPN connection has already been done.
It's currently enabled.
-What would you like to do ?"),
+What would you like to do?"),
[ N_("disable"), N_("reconfigure"), N_("dismiss") ]) or quit_global($in, 0);
# FIXME: reconfigure isn't handled
if ($r eq "disable") {
@@ -123,7 +123,7 @@ N("The setup of a VPN connection has already been done.
It's currently disabled.
-What would you like to do ?"),
+What would you like to do?"),
[ N_("enable"), N_("reconfigure"), N_("dismiss") ]);
# FIXME: reconfigure isn't handled
if ($r eq "enable") {
@@ -194,7 +194,7 @@ Please read AT LEAST the ipsec-howto docs
before going any further.",$ipsec_package)) or goto begin;
$direct or $in->ask_okcancel(N("Kernel module."),
-N("The kernel need to have ipsec support.
+N("The kernel needs to have ipsec support.
You're running a %s kernel version.
@@ -293,13 +293,13 @@ my %messages = (ipsec => N("Security Policies"), racoon => N("IKE daemon racoon"
if ($kernel_version > 2.5) {
$in->ask_from(N("Configuration file"),
-N("Configuration step !
+N("Configuration step!
You need to define the Security Policies and then to
configure the automatic key exchange (IKE) daemon.
The KAME IKE daemon we're using is called 'racoon'.
-What would you like to configure ?\n"),
+What would you like to configure?\n"),
[ { val => \$c, type => "list", list => [ keys %messages ], format => sub { $messages{$_[0]} } } ]) or goto step_detectsetup;
} else {
@@ -325,11 +325,11 @@ my $choice = $section_names[0] if $section_names[0];
my $d = $in->ask_from_list(N("%s entries", $ipsec_conf),
N("The %s file contents
is divided into sections.\n
-You can now :\n
+You can now:\n
- display, add, edit, or remove sections, then
- commit the changes
-What would you like to do ?\n", $ipsec_conf),
+What would you like to do?\n", $ipsec_conf),
[ N_("_:display here is a verb\nDisplay"), N_("Add"), N_("Edit"), N_("Remove"), N_("Commit") ]) or goto step_configuration;
my $existing_section = "";
@@ -367,7 +367,7 @@ if ($kernel_version < 2.5) {
my $e = $in->ask_from_list_(N("ipsec.conf entries"),
N("The %s file contains different sections.\n
-Here is its skeleton : 'config setup'
+Here is its skeleton: 'config setup'
'conn default'
'normal1'
'normal2' \n
@@ -379,7 +379,7 @@ Choose the section you would like to add.\n", $ipsec_conf),
$existing_section = network::ipsec::already_existing_section_ipsec_conf("config setup", $ipsec, $kernel_version);
if ($existing_section eq "already existing") {
-$in->ask_okcancel(N("Exists !"),
+$in->ask_okcancel(N("Exists!"),
N("A section with this name already exists.
The section names have to be unique.\n
You'll have to go back and add another section
@@ -420,7 +420,7 @@ Choose continue or previous when you are done.\n", $ipsec_conf),
$existing_section = network::ipsec::already_existing_section_ipsec_conf("conn %default", $ipsec, $kernel_version);
if ($existing_section eq "already existing") {
-$in->ask_okcancel(N("Exists !"),
+$in->ask_okcancel(N("Exists!"),
N("A section with this name already exists.
The section names have to be unique.\n
You'll have to go back and add another section
@@ -504,10 +504,10 @@ Choose continue when you are done to write the data.\n", $ipsec_conf),
]
) or goto step_configure_ipsec_conf;
- $existing_section = network::ipsec::already_existing_section_ipsec_conf($normal_conn->{1}[0]." ".$normal_conn->{1}[1], $ipsec, $kernel_version);
+ $existing_section = network::ipsec::already_existing_section_ipsec_conf($normal_conn->{1}[0] . " " . $normal_conn->{1}[1], $ipsec, $kernel_version);
if ($existing_section eq "already existing") {
-$in->ask_okcancel(N("Exists !"),
+$in->ask_okcancel(N("Exists!"),
N("A section with this name already exists.
The section names have to be unique.\n
You'll have to go back and add another section
@@ -547,7 +547,7 @@ Choose continue when you are done to write the data.\n"), $section) or goto ste
# $existing_section = network::ipsec::already_existing_section_ipsec_conf($section->{src_dest}, $ipsec, $kernel_version);
#
# if ($existing_section eq "already existing") {
-#$in->ask_okcancel(N("Exists !"),
+#$in->ask_okcancel(N("Exists!"),
#N("A section with this name already exists.
#The section names have to be unique.\n
#You'll have to go back and add another section
@@ -587,12 +587,12 @@ my $number = network::ipsec::matched_section_key_number_ipsec_conf($choice,$ipse
if ($kernel_version < 2.5) {
if ($choice =~ /^version|block|private|clear|packet/) {
-$in->ask_okcancel(N("Can't edit !"),
+$in->ask_okcancel(N("Can't edit!"),
N("You cannot edit this section.\n
-This section is mandatory for Freswan 2.X.
+This section is mandatory for Freeswan 2.X.
One has to specify version 2.0 on the top
of the %s file, and eventually, disable or
-enable the oportunistic encryption.\n",$ipsec_conf));
+enable the opportunistic encryption.\n",$ipsec_conf));
goto step_edit_ipsec_conf;
} elsif ($choice =~ /^config setup/) {
@@ -643,7 +643,7 @@ Choose continue when you are done to write the data.\n", $ipsec_conf),
ask_info3('',
N("Edit a Security Policy.\n
-You can now add a Security Policy.\n
+You can now edit a Security Policy.\n
Choose continue when you are done to write the data.\n"), $ipsec->{$number}) or goto step_configure_ipsec_conf;
goto step_configure_ipsec_conf;
@@ -685,7 +685,7 @@ my $choice = $section_names[0] if $section_names[0];
my $d = $in->ask_from_list_(N("%s entries", $racoon_conf),
N("The racoon.conf file configuration.\n
The contents of this file is divided into sections.
-You can now :
+You can now:
- display \t\t (display the file contents)
- add \t\t (add one section)
- edit \t\t\t (modify parameters of an existing section)
@@ -727,7 +727,7 @@ step_add_section_racoon:
my $e = $in->ask_from_list_(N("racoonf.conf entries"),
N("The 'add' sections step.\n
-Here below is the racoon.conf file skeleton :
+Here below is the racoon.conf file skeleton:
\t'path'
\t'remote'
\t'sainfo' \n
@@ -747,23 +747,23 @@ Put your mouse over the certificate entry to obtain online help."),
val => \$path_section->{1}[1],
list => [ 'certificate', 'pre_shared_key', 'include' ],
help =>
-N("path include path : specifies a path to include
+N("path include path: specifies a path to include
a file. See File Inclusion.
Example: path include '/etc/racoon'
-path pre_shared_key file : specifies a file containing
+path pre_shared_key file: specifies a file containing
pre-shared key(s) for various ID(s). See Pre-shared key File.
Example: path pre_shared_key '/etc/racoon/psk.txt' ;
-path certificate path : racoon(8) will search this directory
+path certificate path: racoon(8) will search this directory
if a certificate or certificate request is received.
Example: path certificate '/etc/cert' ;
-File Inclusion : include file
+File Inclusion: include file
other configuration files can be included.
Example: include \"remote.conf\" ;
-Pre-shared key File : Pre-shared key file defines a pair
+Pre-shared key File: Pre-shared key file defines a pair
of the identifier and the shared secret key which are used at
Pre-shared key authentication method in phase 1."),
},
@@ -929,7 +929,7 @@ source_id and destination_id are constructed like:
address address [/ prefix] [[port]] ul_proto
-Examples : \n
+Examples: \n
sainfo anonymous (accepts connections from anywhere)
leave blank this entry if you want anonymous
@@ -947,7 +947,7 @@ source_id and destination_id are constructed like:
address address [/ prefix] [[port]] ul_proto
-Examples : \n
+Examples: \n
sainfo anonymous (accepts connections from anywhere)
leave blank this entry if you want anonymous
@@ -962,7 +962,7 @@ source_id and destination_id are constructed like:
address address [/ prefix] [[port]] ul_proto
-Examples : \n
+Examples: \n
sainfo anonymous (accepts connections from anywhere)
leave blank this entry if you want anonymous
@@ -980,7 +980,7 @@ source_id and destination_id are constructed like:
address address [/ prefix] [[port]] ul_proto
-Examples : \n
+Examples: \n
sainfo anonymous (accepts connections from anywhere)
leave blank this entry if you want anonymous
@@ -991,16 +991,16 @@ sainfo address 203.178.141.209 any address 203.178.141.218 any
help => N("define the group of Diffie-Hellman exponentiations.
If you do not require PFS then you can omit this directive.
Any proposal will be accepted if you do not specify one.
-group is one of following: modp768, modp1024, modp1536.
+group is one of the following: modp768, modp1024, modp1536.
Or you can define 1, 2, or 5 as the DH group number.") },
{ label => N("Lifetime number"), val => \$data->{3}[2], type => 'entry',
help => N("define a lifetime of a certain time which will be pro-
posed in the phase 1 negotiations. Any proposal will be
-accepted, and the attribute(s) will be not proposed to
+accepted, and the attribute(s) will not be proposed to
the peer if you do not specify it(them). They can be
individually specified in each proposal.
-Examples : \n
+Examples: \n
lifetime time 1 min; # sec,min,hour
lifetime time 1 min; # sec,min,hour
lifetime time 30 sec;
@@ -1014,17 +1014,17 @@ So, here, the lifetime numbers are 1, 1, 30, 30, 60 and 12.
list => [ qw(sec min hour) ],
help => N("define a lifetime of a certain time which will be pro-
posed in the phase 1 negotiations. Any proposal will be
-accepted, and the attribute(s) will be not proposed to
+accepted, and the attribute(s) will not be proposed to
the peer if you do not specify it(them). They can be
individually specified in each proposal.
-Examples : \n
+Examples: \n
lifetime time 1 min; # sec,min,hour
lifetime time 1 min; # sec,min,hour
lifetime time 30 sec;
lifetime time 30 sec;
lifetime time 60 sec;
- lifetime time 12 hour ;
+ lifetime time 12 hour;
So, here, the lifetime units are 'min', 'min', 'sec', 'sec', 'sec' and 'hour'.
") },
@@ -1046,7 +1046,7 @@ specifies the parameters for IKE phase 1 for each remote node.
The default port is 500. If anonymous is specified, the state-
ments apply to all peers which do not match any other remote
directive.\n
-Examples : \n
+Examples: \n
remote anonymous
remote ::1 [8000]") },
{ label => N("Exchange mode"), val => \$main_remote_section->{2}[1],
@@ -1092,7 +1092,7 @@ server.") },
some reason, set this to off. The default is on.") },
{ label => N("My identifier"), val => \$main_remote_section->{8}[1], type => 'entry',
help => N("specifies the identifier sent to the remote host and the
-type to use in the phase 1 negotiation. address, fqdn,
+type to use in the phase 1 negotiation. address, FQDN,
user_fqdn, keyid and asn1dn can be used as an idtype.
they are used like:
my_identifier address [address];
@@ -1101,7 +1101,7 @@ they are used like:
my_identifier user_fqdn string;
the type is a USER_FQDN (user fully-qualified
domain name).
- my_identifier fqdn string;
+ my_identifier FQDN string;
the type is a FQDN (fully-qualified domain name).
my_identifier keyid file;
the type is a KEY_ID.
@@ -1109,16 +1109,16 @@ they are used like:
the type is an ASN.1 distinguished name. If
string is omitted, racoon(8) will get DN from
Subject field in the certificate.\n
-Examples : \n
+Examples: \n
my_identifier user_fqdn \"myemail\@mydomain.com\"") },
{ label => N("Peers identifier"), val => \$main_remote_section->{9}[1], type => 'entry' },
{ label => N("Proposal"), val => \$proposal_remote_section->{1}[0], list => [ 'proposal' ], allow_empty_list => 1 },
{ label => N("Encryption algorithm"), val => \$proposal_remote_section->{2}[1], list => [ qw(des 3des blowfish cast128) ],
help => N("specify the encryption algorithm used for the
phase 1 negotiation. This directive must be defined.
-algorithm is one of following:
+algorithm is one of the following:
-des, 3des, blowfish, cast128 for oakley.
+DES, 3DES, blowfish, cast128 for oakley.
For other transforms, this statement should not be used.") },
{ label => N("Hash algorithm"), val => \$proposal_remote_section->{3}[1], type => 'entry' },
diff --git a/perl-install/standalone/drakxservices b/perl-install/standalone/drakxservices
index 5da4b4464..91317d1f4 100755
--- a/perl-install/standalone/drakxservices
+++ b/perl-install/standalone/drakxservices
@@ -10,6 +10,7 @@ use interactive;
use services;
use log;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/service-mdk.png";
my $in = 'interactive'->vnew('su');
begin:
my $l = services::ask($in);
diff --git a/perl-install/standalone/drakxtv b/perl-install/standalone/drakxtv
index 6646a3f37..709c13309 100755
--- a/perl-install/standalone/drakxtv
+++ b/perl-install/standalone/drakxtv
@@ -29,13 +29,15 @@ use detect_devices;
use lang;
use log;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/tv-mdk.png";
+
my $in = 'interactive'->vnew;
sub scan4channels() {
# xawtv has been installed by DrakX when/if it's detected a tv
# card.
- $in->do_pkgs->ensure_is_installed('xawtv', '/usr/bin/scantv');
+ $in->do_pkgs->ensure_binary_is_installed('xawtv', 'scantv');
my ($ftable_id, $norm);
# this table must be checked on each xawtv release:
@@ -68,7 +70,7 @@ sub scan4channels() {
);
my $tbl;
- my $locale = lang::read('', $>);
+ my $locale = lang::read($>);
$locale->{country} =~ /$_/ and $tbl = $countries{$_} foreach keys %countries;
if ($tbl) {
$ftable_id = $tbl->[0];
@@ -84,11 +86,11 @@ sub scan4channels() {
[
{ label => N("TV norm:"), val => \$norm, list => [ "NTSC", "NTSC-JP", "PAL", "PAL-M", "PAL-N", "PAL-NC", "SECAM" ], type => 'combo' },
{ label => N("Area:"), val => \$ftable_id, list => [keys %freqtables], format => sub { $freqtables{$_[0]} }, sort => 1 },
- { label => N("User :"), val => \$user, list => [ keys %users ], sort => 1 },
+ { label => N("User:"), val => \$user, list => [ keys %users ], sort => 1 },
]
)) {
my $_wait = $in->wait_message(N("Please wait"),
- N("Scanning for TV channels in progress ..."));
+ N("Scanning for TV channels in progress..."));
# we provide scantv a bogus table (france) which will
# will be ignored since "All" is selected (because of -a)
$ftable_id = "france -a " if $ftable_id eq -1;
@@ -115,22 +117,23 @@ my @devices = detect_devices::getTVcards();
push @devices, { driver => 'bttv', description => 'dummy' } if $::testing && !@devices;
if (@devices) {
my $not_canceled = 1;
- my $configured;
+ my $modules_conf;
# TODO: That need some work for multiples TV cards
each_index {
if (($< == 0 || $::testing) && (grep { detect_devices::isTVcard($_) } @devices)) {
require harddrake::v4l;
require modules;
- modules::mergein_conf() if !$configured;
- $configured++;
- $not_canceled &&= harddrake::v4l::config($in, $_->{driver});
- modules::write_conf();
+
+ $modules_conf ||= modules::any_conf->read;
+ $not_canceled &&= harddrake::v4l::config($in, $modules_conf, $_->{driver});
+ $modules_conf->write;
}
scan4channels() if $not_canceled;
} @devices
} else {
$in->ask_warn(N("No TV Card detected!"), formatAlaTeX(
- N("No TV Card has been detected on your machine. Please verify that a Linux-supported Video/TV Card is correctly plugged in.
+ #-PO: keep the double empty lines between sections, this is formatted a la LaTeX
+ N("No TV Card has been detected on your machine. Please verify that a Linux-supported Video/TV Card is correctly plugged in.
You can visit our hardware database at:
diff --git a/perl-install/standalone/finish-install b/perl-install/standalone/finish-install
new file mode 100755
index 000000000..4d615762e
--- /dev/null
+++ b/perl-install/standalone/finish-install
@@ -0,0 +1,134 @@
+#!/usr/bin/perl
+
+use lib qw(/usr/lib/libDrakX);
+
+use common;
+use interactive;
+use any;
+use authentication;
+use network::netconnect;
+use security::level;
+
+$ENV{SHARE_PATH} ||= "/usr/share";
+my $authentication = authentication::get();
+my $security = security::level::get();
+network::netconnect::read_net_conf(my $netcnx = {}, my $netc = {}, my $intf = {});
+
+$::isWizard = 1;
+my $in = 'interactive'->vnew;
+
+sub ask_language() {
+ require lang;
+ my $locale = lang::read();
+ any__selectLanguage_and_more_standalone($in, $locale);
+ lang::write($locale);
+ lang__set($locale);
+ Gtk2->set_locale;
+}
+
+sub ask_keyboard() {
+ require keyboard;
+ my $keyboard = keyboard::read();
+
+ choose:
+ $keyboard->{KEYBOARD} = $in->ask_from_listf(N("Keyboard"),
+ N("Please, choose your keyboard layout."),
+ sub { translate(keyboard::KEYBOARD2text($_[0])) },
+ [ keyboard::KEYBOARDs() ],
+ $keyboard->{KEYBOARD}) or return;
+
+ keyboard::group_toggle_choose($in, $keyboard) or goto choose;
+
+ keyboard::setxkbmap($keyboard);
+ eval {
+ my $xfree_conf = Xconfig::xfree->read;
+ my $xkb = keyboard::keyboard2full_xkb($keyboard);
+ $xfree_conf->set_keyboard($xkb);
+ $xfree_conf->write;
+ };
+
+ keyboard::write($keyboard);
+ system('/etc/init.d/keytable', 'restart');
+}
+
+sub ask_network() {
+ my $modules_conf = modules::any_conf->read;
+ modules::load_category($modules_conf, 'net');
+
+ require network::netconnect;
+ network::netconnect::real_main('', $netcnx, $in, $modules_conf, $netc, undef, $intf);
+}
+
+sub ask_authentication() {
+ my $meta_class = { getVarsFromSh("/etc/sysconfig/system") }->{META_CLASS};
+
+ my $superuser = {};
+ authentication::ask_root_password_and_authentication($in, $netc, $superuser, $authentication, $meta_class, $security);
+ authentication::set_root_passwd($superuser, $authentication);
+
+ eval {
+ authentication::set($in, $netc, $authentication);
+ network::network::write_conf($netc);
+ };
+ if (my $err = $@) {
+ $in->ask_warn(N("Error"), formatError($err));
+ goto &ask_authentication;
+ }
+}
+
+sub ask_users() {
+ my $users = [];
+ any::ask_users($in, $users, $security, []);
+ any::add_users($users, $authentication);
+}
+
+sub call {
+ my ($f_name) = @_;
+ log::l("calling $f_name");
+ my $f = $::{$f_name} or internal_error "bad function $f_name";
+ eval { $f->() };
+ log::l("$f_name failed: $@") if $@;
+}
+
+call('ask_language');
+call('ask_keyboard');
+call('ask_network');
+$::WizardWindow->destroy; undef $::WizardWindow;
+$::Wizard_pix_up = 'redhat-config-users';
+call('ask_authentication');
+call('ask_users');
+setVarsInSh('/etc/sysconfig/finish-install', { FINISH_INSTALL => 'no' });
+
+$in->exit(0);
+
+
+sub lang__set {
+ my ($locale) = @_;
+ put_in_hash(\%ENV, lang::i18n_env($locale));
+ lang::bindtextdomain();
+}
+
+sub any__selectLanguage_and_more_standalone {
+ my ($in, $locale) = @_;
+ eval {
+ local $::isWizard = 1;
+ language:
+ # keep around previous settings so that selectLanguage can keep UTF-8 flag:
+ local $::Wizard_no_previous = 1;
+ my $old_lang = $locale->{lang};
+ $in->{locale} = $locale;
+ $locale->{lang} = any::selectLanguage($in, $locale->{lang});
+ $locale->{IM} = lang::get_default_im($locale->{lang}) if $old_lang ne $locale->{lang};
+ undef $::Wizard_no_previous;
+ any::selectCountry($in, $locale) or goto language;
+ };
+ if ($@) {
+ if ($@ =~ /^one lang only/) {
+ any::selectCountry($in, $locale) or $in->exit(0);
+ } elsif ($@ !~ /wizcancel/) {
+ die;
+ } else {
+ $in->exit(0);
+ }
+ }
+}
diff --git a/perl-install/standalone/finish-install.xsetup b/perl-install/standalone/finish-install.xsetup
new file mode 100755
index 000000000..f08bc02d1
--- /dev/null
+++ b/perl-install/standalone/finish-install.xsetup
@@ -0,0 +1,16 @@
+#!/bin/sh
+# (c) 2004 Mandrakesoft SA
+
+# to be sourced
+if [ -f /etc/sysconfig/finish-install -a -x /usr/sbin/finish-install ]; then
+ . /etc/sysconfig/finish-install
+ if [ "$FINISH_INSTALL" = yes ]; then
+ if [ -r /etc/sysconfig/i18n ]; then
+ . /etc/sysconfig/i18n
+ export LANGUAGE LC_ADDRESS LC_COLLATE LC_NAME LC_NUMERIC LC_MEASUREMENT LC_TIME \
+ LANG LC_IDENTIFICATION LC_MESSAGES LC_CTYPE LC_TELEPHONE LC_MONETARY LC_PAPER
+ fi
+ xsetroot -cursor_name left_ptr
+ /usr/sbin/finish-install
+ fi
+fi
diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2
index 59bb64847..f9506bbc6 100755
--- a/perl-install/standalone/harddrake2
+++ b/perl-install/standalone/harddrake2
@@ -50,10 +50,10 @@ my %fields =
"pci_bus" => [ N("Bus PCI #"), N("the PCI bus on which the device is plugged") ],
"pci_device" => [ N("PCI device #"), N("PCI device number") ],
"pci_function" => [ N("PCI function #"), N("PCI function number") ],
- "vendor" => [ N("Vendor ID"), N("this is the standard numerical identifiant of the vendor") ],
- "id" => [ N("Device ID"), N("this is the numerical identifiant of the device") ],
- "subvendor" => [ N("Sub vendor ID"), N("this is the minor numerical identifiant of the vendor") ],
- "subid" => [ N("Sub device ID"), N("this is the minor numerical identifiant of the device") ],
+ "vendor" => [ N("Vendor ID"), N("this is the standard numerical identifier of the vendor") ],
+ "id" => [ N("Device ID"), N("this is the numerical identifier of the device") ],
+ "subvendor" => [ N("Sub vendor ID"), N("this is the minor numerical identifier of the vendor") ],
+ "subid" => [ N("Sub device ID"), N("this is the minor numerical identifier of the device") ],
"usb_pci_device" =>, [ N("Device USB ID"), N("..") ],
},
CPU =>
@@ -75,13 +75,13 @@ my %fields =
"hlt_bug" => [ N("Halt bug"),
N("Some of the early i486DX-100 chips cannot reliably return to operating mode after the \"halt\" instruction is used") ],
"level" => [ N("Level"), N("sub generation of the cpu") ],
- "model" => [ N("Model"), N("generation of the cpu (eg: 8 for PentiumIII, ...)") ],
+ "model" => [ N("Model"), N("generation of the cpu (eg: 8 for Pentium III, ...)") ],
"model name" => [ N("Model name"), N("official vendor name of the cpu") ],
"name" => [ N("Name"), N("the name of the CPU") ],
"processor" => [ N("Processor ID"), N("the number of the processor") ],
"stepping" => [ N("Model stepping"), N("stepping of the cpu (sub model (generation) number)") ],
"vendor_id" => [ N("Vendor"), N("the vendor name of the processor") ],
- "wp" => [ N("Write protection"), N("the WP flag in the CR0 register of the cpu enforce write proctection at the memory page level, thus enabling the processor to prevent unchecked kernel accesses to user memory (aka this is a bug guard)") ],
+ "wp" => [ N("Write protection"), N("the WP flag in the CR0 register of the cpu enforce write protection at the memory page level, thus enabling the processor to prevent unchecked kernel accesses to user memory (aka this is a bug guard)") ],
},
FLOPPY =>
{
@@ -154,7 +154,7 @@ my ($current_device, $current_class, $current_configurator);
my %menus = (
'options' =>
- #-PO: please keep all "/" charaters !!!
+ #-PO: please keep all "/" characters !!!
N("/_Options"),
'help' => N("/_Help")
);
@@ -169,7 +169,7 @@ my %menu_options = (
my @menu_items =
(
[ N("/_File"), undef, undef, undef, '<Branch>' ],
- [ N("/_File").N("/_Quit"), N("<control>Q"), \&quit_global, undef, '<StockItem>', 'gtk-quit' ],
+ [ N("/_File") . N("/_Quit"), N("<control>Q"), \&quit_global, undef, '<StockItem>', 'gtk-quit' ],
[ join('', @{$menu_options{PRINTERS_DETECTION}}), undef,
sub { $options{PRINTERS_DETECTION} = $check_boxes{PRINTERS_DETECTION}->get_active }, undef, '<CheckItem>' ],
[ join('', @{$menu_options{MODEMS_DETECTION}}), undef,
@@ -177,8 +177,8 @@ my @menu_items =
[ join('', @{$menu_options{JAZZ_DETECTION}}), undef,
sub { $options{JAZZ_DETECTION} = $check_boxes{JAZZ_DETECTION}->get_active }, undef, '<CheckItem>' ],
[ $menus{help}, undef, undef, undef, '<Branch>' ],
- [ $menus{help}.N("/_Help"), undef, sub { unless (fork()) { exec("drakhelp --id harddrake") } }, undef, '<Item>' ],
- [ $menus{help}.N("/_Fields description"), undef, sub {
+ [ $menus{help} . N("/_Help"), undef, sub { unless (fork()) { exec("drakhelp --id harddrake") } }, undef, '<Item>' ],
+ [ $menus{help} . N("/_Fields description"), undef, sub {
if ($current_device) {
create_dialog(N("Harddrake help"),
N("Description of the fields:\n\n")
@@ -194,11 +194,11 @@ my @menu_items =
},
undef, '<Item>'
],
- [ $menus{help}.N("/_Report Bug"), undef, sub { unless (fork()) { exec("drakbug --report harddrake2 &") } }, undef, '<Item>' ],
- [ $menus{help}.N("/_About..."), undef, sub {
+ [ $menus{help} . N("/_Report Bug"), undef, sub { unless (fork()) { exec("drakbug --report harddrake2 &") } }, undef, '<Item>' ],
+ [ $menus{help} . N("/_About..."), undef, sub {
create_dialog(N("About Harddrake"),
#-PO: Do not alter the <span ..> and </span> tags
- N("This is HardDrake, a Mandrake hardware configuration tool.\n<span foreground=\"royalblue3\">Version:</span> %s
+ N("This is HardDrake, a Mandrakelinux hardware configuration tool.\n<span foreground=\"royalblue3\">Version:</span> %s
<span foreground=\"royalblue3\">Author:</span> Thierry Vignaud &lt;tvignaud\@mandrakesoft.com&gt;\n\n", $harddrake::data::version) . "\n" .
formatAlaTeX($::license), { use_markup => 1, if_(!$::isEmbedded, transient => $w->{window}) });
}, undef, '<Item>'
@@ -393,7 +393,7 @@ foreach (@classes) {
if ($Ident eq "AUDIO") {
require harddrake::sound;
my $alter = harddrake::sound::get_alternative($_->{driver});
- my $alternative_drivers = join(':', @$alter) if $alter->[0] ne 'unknown';
+ my $alternative_drivers = join(', ', @$alter) if $alter->[0] ne 'unknown';
$_->{alternative_drivers} = $alternative_drivers if $alternative_drivers;
}
if ($Ident eq "HARDDISK") {
@@ -422,7 +422,7 @@ foreach (@classes) {
my $custom_id = harddrake::data::custom_id($_, $title);
foreach my $field (qw(devfs_device device)) {
- $_->{$field} = '/dev/'.$_->{$field} if $_->{$field};
+ $_->{$field} = "/dev/$_->{$field}" if $_->{$field};
}
$tree_model->append_set($parent_iter, [ 1 => $custom_id, 2 => $index++ ]);
push @data, [ $_, $Ident ];
@@ -484,7 +484,7 @@ sub lookup_field {
sub titleFormat {
my ($title) = @_;
- [ $title . "\n", { 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD, size => 14 * Gtk2::Pango->PANGO_SCALE } ];
+ [ $title . "\n", { 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD, scale => Gtk2::Pango->PANGO_SCALE_LARGE } ];
}
sub rename_field {
diff --git a/perl-install/standalone/icons/harddrake2/ups.png b/perl-install/standalone/icons/harddrake2/ups.png
new file mode 100644
index 000000000..1e2652da4
--- /dev/null
+++ b/perl-install/standalone/icons/harddrake2/ups.png
Binary files differ
diff --git a/perl-install/standalone/keyboarddrake b/perl-install/standalone/keyboarddrake
index c45d70a34..cef005041 100755
--- a/perl-install/standalone/keyboarddrake
+++ b/perl-install/standalone/keyboarddrake
@@ -11,6 +11,7 @@ use common;
use any;
use c;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/keyboard-mdk.png";
my $in;
my $keyboard = keyboard::read();
if (my ($kb) = grep { !/^-/ } @ARGV) {
diff --git a/perl-install/standalone/listsupportedprinters b/perl-install/standalone/listsupportedprinters
new file mode 100755
index 000000000..efd334409
--- /dev/null
+++ b/perl-install/standalone/listsupportedprinters
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2003-2004 Mandrakesoft
+#
+# Till Kamppeter <till@mandrakesoft.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License Version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+use strict;
+use lib qw(/usr/lib/libDrakX);
+use standalone;
+use printer::main;
+
+# Data structure for printer data
+my $printer;
+
+# printer::main::read_printer_db() needs a spooler name ...
+$printer->{SPOOLER} = 'cups';
+
+# ... and the user mode (expert mode gives us more info)
+$printer->{expert} = 1;
+
+# Read the command line options
+my $commandline = join ('', @ARGV);
+
+# HELP !!!
+$commandline =~ /-(h\b|help)/i and print "
+Uasge: $ARGV[0] [--only-models] [--help]
+
+Shows list of supported printers and the drivers which support them.
+Manufacturer-supplied PPDs of native PostScript printers, manually added
+drivers, or installed updates are taken into account.
+
+--only-models: Show only the model names, not the drivers
+
+--help: This help page.
+
+" and exit 0;
+
+# Do we only need models and not drivers? Beginner's mode gives us the
+# needed info then.
+$commandline =~ /-only-models/i and $printer->{expert} = 0;
+
+# Build the list of supported printers
+printer::main::read_printer_db($printer, $printer->{SPOOLER});
+
+# Show the list on STDOUT
+foreach my $item (sort keys %printer::main::thedb) {
+ print "$item\n";
+}
+
+
diff --git a/perl-install/standalone/localedrake b/perl-install/standalone/localedrake
index e89804d3f..9e6d97ba9 100644
--- a/perl-install/standalone/localedrake
+++ b/perl-install/standalone/localedrake
@@ -21,48 +21,50 @@ if (defined $klang) {
$klang or exit(-1);
my $lang = member($klang, lang::list_langs()) ? $klang : 'en_US';
my $country = member($kcountry, lang::list_countries()) ? $kcountry : 'US';
- my $locale = lang::read('', $>);
+ my $locale = lang::read($>);
$klang and $locale->{lang} = $lang;
$kcountry and $locale->{country} = $country;
- lang::write('', $locale, $>, 'dont_touch_kde_files') if $apply;
+ lang::write($locale, $>, 'dont_touch_kde_files') if $apply;
#- help KDE defaulting to the right charset
print lang::charset2kde_charset(lang::l2charset($lang)), "\n";
exit(0);
}
-my $locale = lang::read('', $>);
+my $locale = lang::read($>);
my $in = 'interactive'->vnew;
-sub select_language() {
- $locale->{lang} = any::selectLanguage($in, $locale->{lang});
-}
+$ugtk2::wm_icon = "localedrake";
+$::Wizard_title = N("LocaleDrake");
+
sub select_country() {
any::selectCountry($in, $locale);
}
eval {
+ local $::isWizard = 1;
+ local $::Wizard_no_previous = 1;
language:
- select_language() or goto the_end;
+ my $old_lang = $locale->{lang};
+ $locale->{lang} = any::selectLanguage($in, $locale->{lang});
+ $locale->{IM} = lang::get_default_im($locale->{lang}) if $old_lang ne $locale->{lang};
+ undef $::Wizard_no_previous;
select_country() or goto language;
};
if ($@) {
if ($@ =~ /^one lang only/) {
- select_country() or goto the_end;
- } else {
+ select_country() or $in->exit(0);
+ } elsif ($@ !~ /wizcancel/) {
die;
+ } else {
+ $in->exit(0);
}
}
-lang::write('', $locale, $>);
+lang::write($locale, $>);
if ($>) {
if (my $wm = any::running_window_manager()) {
$in->ask_okcancel('', N("The change is done, but to be effective you must logout"), 1)
and any::ask_window_manager_to_logout($wm);
}
}
-
-the_end:
-$in->exit(0);
-
-
diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake
index fa6475bbc..df4751115 100755
--- a/perl-install/standalone/logdrake
+++ b/perl-install/standalone/logdrake
@@ -29,6 +29,7 @@ use interactive;
use ugtk2 qw(:create :dialogs :helpers :wrappers);
use vars qw(*F);
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/logdrake-mdk.png";
my $in = 'interactive'->vnew('su');
my ($isExplain, $Explain, $isFile, $File, $isWord, $Word);
@@ -46,7 +47,7 @@ $| = 1 if $isTail;
my $h = chomp_(`hostname -s`);
$ugtk2::wm_icon = "logdrake";
-my $explain_title = N("Mandrake Tools Logs");
+my $explain_title = N("Mandrakelinux Tools Logs");
my $my_win = ugtk2->new($isExplain ? $explain_title : N("Logdrake"));
unless ($::isEmbedded) {
@@ -55,12 +56,12 @@ unless ($::isEmbedded) {
}
$my_win->{window}->signal_connect(delete_event => \&quit);
-my $cal = gtkset_sensitive(new Gtk2::Calendar(), 0);
+my $cal = gtkset_sensitive(Gtk2::Calendar->new, 0);
my $mday = (localtime(time()))[3];
$cal->select_day($mday);
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my $cal_mode = 0;
-my $cal_butt = gtksignal_connect(new Gtk2::CheckButton(N("Show only for the selected day")), clicked => sub { $cal_mode = !$cal_mode; gtkset_sensitive($cal,$cal_mode) });
+my $cal_butt = gtksignal_connect(Gtk2::CheckButton->new(N("Show only for the selected day")), clicked => sub { $cal_mode = !$cal_mode; gtkset_sensitive($cal,$cal_mode) });
### menus definition
# the menus are not shown
@@ -112,7 +113,7 @@ my %files = (
"explanations" => { file => "/var/log/explanations", desc => $explain_title }
);
-my $yy = gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("search")) , clicked => \&search),0);
+my $yy = gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("search")) , clicked => \&search),0);
my $log_text = gtktext_insert(Gtk2::TextView->new, [ [ '' ] ]);
@@ -123,29 +124,29 @@ my $refcount_search;
my %toggle;
gtkadd($my_win->{window},
- gtkpack_(new Gtk2::VBox(0,0),
+ gtkpack_(Gtk2::VBox->new(0,0),
if_(!$isExplain && !$::isEmbedded, 0, N("A tool to monitor your logs")),
- if_(!$isFile, 0, gtkadd(new Gtk2::Frame(N("Settings")),
- gtkpack__(new Gtk2::VBox(0,2),
- gtkpack__(new Gtk2::VBox(0,2),
+ if_(!$isFile, 0, gtkadd(Gtk2::Frame->new(N("Settings")),
+ gtkpack__(Gtk2::VBox->new(0,2),
+ gtkpack__(Gtk2::VBox->new(0,2),
# N("Show lines"),
- gtkpack__(new Gtk2::HBox(0,0),
- " " . N("Matching") . " ", my $e_yes = new Gtk2::Entry(),
- " " . N("but not matching") . " ", my $e_no = new Gtk2::Entry()
+ gtkpack__(Gtk2::HBox->new(0,0),
+ " " . N("Matching") . " ", my $e_yes = Gtk2::Entry->new,
+ " " . N("but not matching") . " ", my $e_no = Gtk2::Entry->new
)
),
- gtkpack_(new Gtk2::HBox(0,0),
- 1, gtkadd(gtkset_border_width(new Gtk2::Frame(N("Choose file")),2),
+ gtkpack_(Gtk2::HBox->new(0,0),
+ 1, gtkadd(gtkset_border_width(Gtk2::Frame->new(N("Choose file")),2),
gtkpack(gtkset_border_width(Gtk2::VBox->new(0,0),0),
- map { $toggle{$_} = gtksignal_connect(new Gtk2::CheckButton($files{$_}{desc}),
+ map { $toggle{$_} = gtksignal_connect(Gtk2::CheckButton->new($files{$_}{desc}),
clicked => sub {
$refcount_search++;
gtkset_sensitive($yy, $refcount_search);
}) } sort keys %files,
)
),
- 0, gtkadd(gtkset_border_width(new Gtk2::Frame(N("Calendar")),2),
- gtkpack__(gtkset_border_width(new Gtk2::VBox(0,0),5),
+ 0, gtkadd(gtkset_border_width(Gtk2::Frame->new(N("Calendar")),2),
+ gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,0),5),
$cal_butt, $cal
)
)
@@ -154,18 +155,18 @@ gtkadd($my_win->{window},
)
)
),
- !$isExplain ? (1, gtkadd(new Gtk2::Frame(N("Content of the file")),
+ !$isExplain ? (1, gtkadd(Gtk2::Frame->new(N("Content of the file")),
create_scrolled_window($log_text)
)) : (1, create_scrolled_window($log_text)),
if_(!$isExplain, 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk2::HButtonBox->new, 'end'), 5),
- if_(!$isFile, gtksignal_connect(new Gtk2::Button(N("Mail alert")),
+ if_(!$isFile, gtksignal_connect(Gtk2::Button->new(N("Mail alert")),
clicked => sub {
eval { alert_config() };
my $err = $@;
$::WizardWindow->destroy if defined $::WizardWindow;
undef $::WizardWindow;
if ($err && $err !~ /wizcancel/) {
- err_dialog(N("Error"), N("The alert wizard had unexpectly failled:")
+ err_dialog(N("Error"), N("The alert wizard has failed unexpectedly:")
. "\n\n" . $err);
}
})),
@@ -205,19 +206,20 @@ sub search() {
my $timer;
-my (@logs, %tags);
+my @logs;
+
+my $F;
sub parse_file {
my ($file, $descr) = @_;
- undef %tags;
$file =~ s/\.gz$//;
my ($pbar, $win_pb);
unless ($::isEmbedded && $isExplain) {
- gtkadd($win_pb = gtkset_modal(new Gtk2::Window('toplevel'), 1),
- gtkpack(new Gtk2::VBox(2,0),
- new Gtk2::Label(" " . N("please wait, parsing file: %s", $descr) . " "),
- $pbar = new Gtk2::ProgressBar()
+ gtkadd($win_pb = gtkset_modal(Gtk2::Window->new('toplevel'), 1),
+ gtkpack(Gtk2::VBox->new(2,0),
+ Gtk2::Label->new(" " . N("please wait, parsing file: %s", $descr) . " "),
+ $pbar = Gtk2::ProgressBar->new
)
);
$win_pb->set_transient_for($my_win->{rwindow}) unless $::isEmbedded;
@@ -274,49 +276,19 @@ sub parse_file {
$win_pb->destroy if !$::isEmbedded || !$isExplain;
if ($isTail) {
- close F;
- open F, $file or die "E: $!";
+ close $F;
+ open $F, $file or die "E: $!";
local $_;
- while (<F>) {}; #to prevent to output the file twice..
+ while (<$F>) {}; #to prevent to output the file twice..
# $log_text->set_point($log_text->get_length());
$timer ||= Glib::Timeout->add(1000, sub {
- logcolorize($_) while <F>;
- seek F, 0, 1;
+ logcolorize($_) while <$F>;
+ seek $F, 0, 1;
});
}
- log_output__real();
+ insert_text_n_scroll();
}
-sub text_append {
- my ($textview, $t, %opts) = @_;
- my $buffer = $textview->get_buffer;
- $buffer->{tags} ||= {};
- my $gtk_tags = $buffer->{tags};
- if (ref($t) eq 'ARRAY') {
- foreach my $token (@$t) {
- my $iter1 = $buffer->get_end_iter;
- if ($token->[0] =~ /^Gtk2::Gdk::Pixbuf/) {
- $buffer->insert_pixbuf($iter1, $token->[0]);
- next;
- }
- if ($token->[1]) {
- my $tag = $token->[1];
- $gtk_tags->{$tag} ||= $buffer->create_tag($tag, %{$tags{$token->[1]}});
- $buffer->insert_with_tags($iter1, $token->[0], $gtk_tags->{$tag});
- } else {
- $buffer->insert($iter1, $token->[0]);
- }
- }
- } else {
- $buffer->set_text($t);
- }
- #- the following line is needed to move the cursor to the beginning, so that if the
- #- textview has a scrollbar, it won't scroll to the bottom when focusing (#3633)
- $buffer->place_cursor($buffer->get_start_iter);
- $textview->set_wrap_mode($opts{wrap_mode} || 'word');
- $textview->set_editable($opts{editable} || 0);
- $textview->set_cursor_visible($opts{visible} || 0);
-}
##########################################################################################
@@ -340,7 +312,7 @@ sub logcolorize {
}
# Extract PID if present
if ($rec[1] =~ /\[(\d+)\]:/) {
- my ($pid) = $1;
+ my $pid = $1;
$rec[1] =~ s/\[$1\]://;
log_output($rec[1] . "[", undef, 'green');
log_output($pid, 'Bold', 'black');
@@ -367,22 +339,22 @@ sub logcolorize {
log_output("$rec[$therest] ", undef, $col);
}
log_output("\n", undef, 'black');
- log_output__real() if $isExplain;
+ insert_text_n_scroll() if $isExplain;
}
# log_output (Gtk2::TextView, [ [ ... ] ])
sub log_output {
my ($text, $font, $col) = @_;
- my $tag = join($font, $col);
+ my $tag = join('', $font, $col);
push @logs, [ $text, $tag ];
- $tags{$tag} ||= { if_($font, font => $font), foreground => $col };
+ $log_buf->{tags}{$tag} ||= { foreground => $col }; # if_($font, font => $font),
}
-sub log_output__real() {
- text_append($log_text, \@logs);
- undef @logs;
+sub insert_text_n_scroll() {
+ ugtk2::gtktext_insert($log_text, \@logs, append => !($isExplain || $isTail));
$log_text->scroll_to_iter($log_buf->get_end_iter, 0, 1, 0.5, 0.5);
+ undef @logs;
}
@@ -455,7 +427,7 @@ sub alert_config() {
email => {
name => N("Alert configuration") . "\n\n" .
N("Please enter your email address below ") . "\n" .
- N("and enter the name (or the IP) of the SMTP server you whish to use"),
+ N("and enter the name (or the IP) of the SMTP server you wish to use"),
data => [
{ label => "Email address", val => \$options{MAIL} },
{ label => "Email server", val => \$options{SMTP} },
diff --git a/perl-install/standalone/man/C/man8/drakconnect.8 b/perl-install/standalone/man/C/man8/drakconnect.8
new file mode 100644
index 000000000..f8ba1438b
--- /dev/null
+++ b/perl-install/standalone/man/C/man8/drakconnect.8
@@ -0,0 +1,109 @@
+.TH DRAKCONNECT 8 "17 November 2003" "drakxtools" "Linux Administrator's Manual"
+.SH NAME
+drakconnect \- configure network interfaces
+.SH SYNOPSIS
+.B "drakconnect"
+.br
+.B "drakconnect --skip-wizard"
+.SH DESCRIPTION
+.B Drakconnect
+is used to configure the network interfaces.
+
+Drakconnect handle ISDN, modems, xDSL, LAN as well as wirelless
+connexions.
+
+There's two main modes: the wizard mode and the "embedded in mcc" view
+(the manage interface). In the wizard mode, drakconnect detect all
+network interfaces and offer to configure them.
+
+.SH OPTIONS
+.TP
+.B "\-\-del"
+Delete a network interface and all related files
+.TP
+.B "\-\-expert"
+Expert mode; give access to more options (advanced options are shown by
+default and some extra steps occured in the wizard)
+.TP
+.B "\-\-help"
+Display short description of drakconnect options
+.TP
+.B "\-\-skip-wizard"
+Manage interface.
+.TP
+.B "\-\-testing"
+Do not do anything (for debugging purpose)
+.SH FILES
+.SS Name resolution
+.I /etc/sysconfig/network
+global network options (hostname, is networking enabled, default gateway)
+.br
+.I /etc/hosts
+hosts to IPs mapping
+.br
+.I /etc/resolv.conf
+domain, primary & secondary DNS
+.br
+.SS Kernel interfaces list
+.I /proc/net/dev
+network interfaces and their stats
+.br
+.I /proc/net/if_inet6
+the same for IPv6
+.br
+.I /sys/class/net/*/
+per network interface sysfs interface
+.br
+.SS Interfaces configuration
+.I /etc/modules.conf and /etc/modprobe.conf
+logical network interfaces (eg: ethX) to kernel driver mapping
+.br
+.I /etc/iftab
+enable to remap interfaces names depending on ARP or MAC addresses,
+kernel driver, ... (see
+.BR iftab (5)
+for further information)
+.br
+.I /etc/sysconfig/network-scripts/ifcfg-*
+per interface configuration (IP/network, IP discovery
+protocol, link notification support, ...) (see
+.BR ifcfg (8)
+for further information)
+.br
+.I /etc/profile.d/proxy.csh /etc/profile.d/proxy.sh
+proxy configuration
+.SS Profiles
+.I /etc/netprofile/
+the directory where profiles are saved
+.br
+.I /etc/netprofile/current
+this file hold the current profile name
+.br
+.I /etc/netprofile/list
+this file list the files to save in profiles
+.br
+.SS Peer
+.I /etc/ppp/options
+generic pppd options
+.br
+.I /etc/ppp/peers/ppp0
+pppd options for provider (ISP)
+.br
+.I /etc/ppp/pap-secrets and /etc/ppp/chap-secrets
+peer authentication data (login and passwords)
+.br
+.I /etc/ppp/pppoe.conf
+ppoe configuration file. see pppoe.conf(8)
+.SH BUGS
+.SH SEE ALSO
+arp(8), ethtool(8), ifcfg(5), ifconfig(8), pppd(8), netstat(8), rarp(8), route(8),
+.SH AUTHORS
+Damien "Dam's" Krotkine,
+.br
+Damien Chaumette,
+.br
+Francois Pons,
+.br
+Thierry Vignaud <tvignaud@mandrakesoft.com>
+.br
+Olivier blin <blino@mandrakesoft.com>
diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake
index 19d104f95..2f6d0dd87 100755
--- a/perl-install/standalone/mousedrake
+++ b/perl-install/standalone/mousedrake
@@ -11,16 +11,17 @@ use mouse;
use c;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/mousedrake-mdk.png";
my $in = 'interactive'->vnew('su');
-modules::mergein_conf();
+my $modules_conf = modules::any_conf->read;
begin:
my $mouse = mouse::read();
my %old = %$mouse;
if (!$::noauto) {
- my $probed_mouse = mouse::detect();
+ my $probed_mouse = mouse::detect($modules_conf);
$mouse = $probed_mouse if !$mouse->{XMOUSETYPE} || !$probed_mouse->{unsafe};
}
@@ -29,14 +30,14 @@ if (!$mouse || !$::auto) {
my $test_hbox;
my $name = $in->ask_from_treelistf('mousedrake', N("Please choose your mouse type."), '|',
sub { join '|', map { translate($_) } split '\|', $_[0] },
- [ mouse::fullnames ],
+ [ mouse::fullnames() ],
$mouse->{type} . '|' . $mouse->{name});
$name or $in->exit(0);
my $mouse_chosen = mouse::fullname2mouse($name);
$mouse = $mouse_chosen if !($mouse->{type} eq $mouse_chosen->{type} && $mouse->{name} eq $mouse_chosen->{name});
if ($mouse->{device} eq "usbmouse") {
- modules::load_category('bus/usb') or die 'no usb bus found\n';
+ modules::load_category($modules_conf, 'bus/usb') or die 'no usb bus found\n';
modules::load(qw(hid mousedev usbmouse));
}
@@ -51,7 +52,7 @@ if (!$mouse || !$::auto) {
$test_hbox and $test_hbox->destroy;
}
-mouse::write_conf($in, $mouse, 1);
+mouse::write_conf($in->do_pkgs, $modules_conf, $mouse, 1);
if ($in->isa('interactive::gtk') && mouse::change_mouse_live($mouse, \%old)) {
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet
index d71dd102d..c005862cc 100644
--- a/perl-install/standalone/net_applet
+++ b/perl-install/standalone/net_applet
@@ -1,30 +1,24 @@
#!/usr/bin/perl
-#use strict;
+use strict;
use lib qw(/usr/lib/libDrakX);
use c;
use common;
+use standalone;
use Digest::MD5;
+use network::netconnect;
+use network::tools;
use Gtk2::TrayIcon;
-eval { require ugtk2; ugtk2->import(qw(:all)); require Gtk2::Pango };
-if ($@) {
- print "This program cannot be run in console mode.\n";
- c::_exit(0); #- skip ugtk2::END
-}
+use ugtk2 qw(:create :helpers :wrappers);
my ($eventbox, $img);
-my ($menu, $_timeout);
-my $raisedwindow = 0;
+my ($current_state, $menu, $timeout);
my $onstartupfile = "$ENV{HOME}/.net_applet";
add_icon_path("/usr/share/libDrakX/pixmaps/");
-#don't launch it twice :)
-#my @pids = fuzzy_pidofs(qr/\bnet_applet\b/);
-#foreach (@pids) {
-# print "pid = $_ \n";
-#}
-#@pids > 1 and die "net_applet already running\n";
+# Allow multiple instances, but only one per user:
+is_running('net_applet') and die "net_applet already running\n";
my $prog_name = "/usr/bin/net_applet";
my $current_md5 = md5file($prog_name);
@@ -32,20 +26,34 @@ my %appletstate = (
connected => {
colour => [ 'connected' ],
changes => [ 'disconnected', 'error', 'busy' ],
- menu => [ 'confNetwork', 'monitorNetwork', 'refresh', 'help' ],
- tt => [ N("Network is up on interface ") ]
+ menu => [ 'downNetwork', 'confNetwork', 'monitorNetwork', 'refresh', 'help' ],
+ tt => [ N_("Network is up on interface %s") ]
},
disconnected => {
colour => [ 'disconnected' ],
changes => [ 'connected', 'error', 'busy' ],
- menu => [ 'confNetwork', 'refresh', 'help' ],
- tt => [ N("Network is down. Click on \"configure Network\"") ]
- }
+ menu => [ 'upNetwork', 'confNetwork', 'refresh', 'help' ],
+ tt => [
+ #-PO: keep the "Configure Network" substring synced with the "Configure Network" message below
+ N_("Network is down on interface %s. Click on \"Configure Network\"")
+ ]
+ },
+ notconfigured => {
+ colour => [ 'disconnected' ],
+ changes => [ 'connected' ],
+ menu => [ 'confNetwork', 'refresh', 'help' ],
+ tt => [
+ N_("You don't have any configured Internet connection.
+Run the \"Add Connection\" assistant from the Mandrakelinux Control Center")
+ ]
+ }
);
my %actions = (
+ 'upNetwork' => { name => sub { N("Connect %s", $_[0]) }, launch => \&network::tools::start_interface },
+ 'downNetwork' => { name => sub { N("Disconnect %s", $_[0]) }, launch => \&network::tools::stop_interface },
+ 'monitorNetwork' => { name => N("Monitor Network"), launch => sub { system("/usr/sbin/net_monitor --defaultintf $_[0] &") } },
'confNetwork' => { name => N("Configure Network"), launch => sub { system("/usr/sbin/drakconnect --skip-wizard &") } },
- 'monitorNetwork' => { name => N("Monitor Network"), launch => sub { system("/usr/sbin/net_monitor &") } },
'refresh' => { name => N("Refresh"), launch => sub { checkNetwork() } },
'help' => { name => N("Get Online Help"), launch => sub { system("drakhelp --id internet-connection &") } }
);
@@ -56,11 +64,9 @@ gtkadd(my $icon = Gtk2::TrayIcon->new("Net_Applet"),
)
);
$eventbox->signal_connect(button_press_event => sub {
- if (!$raisedwindow) {
- if ($_[1]->button == 1) {
- $raisedwindow = 1; netMonitor()
- }
- }
+ if ($_[1]->button == 1) {
+ is_running('net_monitor') or netMonitor()
+ }
$_[1]->button == 3 && $menu and $menu->popup(undef, undef, undef, undef, $_[1]->button, $_[1]->time);
});
my ($opt) = @ARGV;
@@ -76,6 +82,14 @@ Gtk2->main;
ugtk2::exit(0);
+sub is_running {
+ my ($name) = @_;
+ any {
+ my ($ppid, $pid, $n) = /^\s*(\d+)\s+(\d+)\s+(.*)/;
+ #- to run ps, perl may create some process with $name as name and 1 as ppid
+ $ppid != 1 && $pid != $$ && $n eq $name;
+ } `ps -o '%P %p %c' -u $ENV{USER}`;
+}
sub shouldStart() {
my %p = getVarsFromSh($onstartupfile);
my $ret = $p{AUTOSTART} eq 'FALSE' ? 0 : 1;
@@ -92,27 +106,18 @@ sub md5file {
return wantarray() ? @md5 : $md5[0];
}
sub netMonitor() {
- system("/usr/sbin/net_monitor --testing");
+ system("/usr/sbin/net_monitor&");
checkNetwork()
}
sub checkNetwork() {
- my $gatewayconf = '/etc/sysconfig/network';
- my %h = getVarsFromSh($gatewayconf);
- my $new_md5 = md5file($prog_name);
- # print "NEW($newmd5) = OLD($oldmd5)\n"
- my ($gd, $addrgd);
- if ($h{GATEWAYDEV}) {
- $addrgd = getIP($gd = $h{GATEWAYDEV});
- } else {
- ($addrgd, $gd) = `/sbin/ip route show` =~ /^default\s+via\s+(\S+).*\s+dev\s+(\S+)/m;
- }
-
- $gd or die "No Gatewaydev defined";
-
- if ($addrgd) {
- go2State('connected', $gd)
- } else { go2State('disconnected', '') }
+ my $netcnx = {};
+ my $netc = {};
+ my $intf = {};
+ network::netconnect::read_net_conf($netcnx, $netc, $intf);
+ my ($gw_intf, $is_up, $gw_address, $dns_server) = network::tools::get_internet_connection($netc, $intf);
+ go2State($gw_address ? 'connected' : $gw_intf ? 'disconnected' : 'notconfigured', $gw_intf);
+ my $new_md5 = md5file($prog_name);
if ($new_md5 ne $current_md5) { exec($prog_name) };
}
sub getIP {
@@ -123,14 +128,18 @@ sub getIP {
return wantarray() ? @ip : $ip[0];
}
sub cronNetwork() {
- $_timeout = Glib::Timeout->add(60*1000, sub {
+ $timeout = Glib::Timeout->add(5*1000, sub {
checkNetwork();
1;
});
}
sub go2State {
- $menu and $menu->destroy;
- $menu = setState(@_)
+ my ($state_type, $interface) = @_;
+ if ($current_state ne $state_type) {
+ $current_state = $state_type;
+ $menu and $menu->destroy;
+ $menu = setState($state_type, $interface);
+ }
}
sub setState {
my ($state_type, $interface) = @_;
@@ -138,10 +147,12 @@ sub setState {
my $arr = $appletstate{$state_type}{menu};
my $tmp = gtkcreate_pixbuf($appletstate{$state_type}{colour}[0]);
$img->set_from_pixbuf($tmp);
- gtkset_tip(new Gtk2::Tooltips, $eventbox, formatAlaTeX($appletstate{$state_type}{tt}[0] . $interface));
+ gtkset_tip(Gtk2::Tooltips->new, $eventbox, formatAlaTeX(common::sprintf_fixutf8(translate($appletstate{$state_type}{tt}[0]), $interface)));
my $menu = Gtk2::Menu->new;
foreach (@$arr) {
- $menu->append(gtksignal_connect(gtkshow(Gtk2::MenuItem->new_with_label($actions{$_}{name})), activate => $actions{$_}{launch}));
+ my $name = ref($actions{$_}{name}) eq 'CODE' ? $actions{$_}{name}->($interface) : $actions{$_}{name};
+ my $launch = $actions{$_}{launch};
+ $menu->append(gtksignal_connect(gtkshow(Gtk2::MenuItem->new_with_label($name)), activate => sub { $launch->($interface) }));
}
$menu->append(gtkshow(Gtk2::SeparatorMenuItem->new));
$menu->append(gtksignal_connect(gtkset_active($checkmi = Gtk2::CheckMenuItem->new_with_label(N("Always launch on startup")), shouldStart()), toggled => sub { setAutoStart(uc(bool2text($checkmi->get_active))) }));
@@ -150,6 +161,7 @@ sub setState {
$menu
}
sub mainQuit() {
+ Glib::Source->remove($timeout) if $timeout;
Gtk2->main_quit
}
sub setAutoStart {
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
index 556ad8fa2..a7cc437d5 100755
--- a/perl-install/standalone/net_monitor
+++ b/perl-install/standalone/net_monitor
@@ -34,6 +34,8 @@ use network::tools;
use MDK::Common::Globals "network", qw($in);
use POSIX;
+$ugtk2::wm_icon = "/usr/share/mcc/themes/default/net_monitor-mdk.png";
+
if ("@ARGV" =~ /--status/) { print connected(); exit(0) }
my $force = "@ARGV" =~ /--force/;
my $quiet = "@ARGV" =~ /--quiet/;
@@ -41,9 +43,15 @@ my $connect = "@ARGV" =~ /--connect/;
my $disconnect = "@ARGV" =~ /--disconnect/;
my ($default_intf) = "@ARGV" =~ /--defaultintf (\w+)/;
+my $netcnx = {};
+my $netc = {};
+my $intf = {};
+network::netconnect::read_net_conf($netcnx, $netc, $intf);
+$default_intf ||= network::tools::get_default_gateway_interface($netc, $intf);
+
if ($force) {
- $connect and start_connection();
- $disconnect and stop_connection();
+ $connect and network::tools::start_interface($default_intf);
+ $disconnect and network::tools::stop_interface($default_intf);
$connect = $disconnect = 0;
}
$quiet and exit(0);
@@ -51,7 +59,7 @@ my $in = 'interactive'->vnew;
my $window1 = ugtk2->new(N("Network Monitoring"));
-$window1->{rwindow}->signal_connect(delete_event => sub { ugtk2->exit(0) });
+$window1->{rwindow}->signal_connect(delete_event => \&main_quit);
unless ($::isEmbedded) {
$window1->{rwindow}->set_position('center');
@@ -66,13 +74,10 @@ my $colora = gtkcolor(655, 50400, 655);
my $isconnected = -1;
my @interfaces;
my $monitor = {};
-my $netcnx = {};
-my $netc = {};
-my $intf = {};
my $c_time = 0;
my $ct_tag;
-my ($pixmap, $darea);
+my ($pixmap, $darea, $gc_lines);
my ($width, $height) = (300, 150);
my $left_border = 50;
@@ -80,17 +85,17 @@ my $grid_interval = 30;
my $arrow_space = 6;
my $arrow_size = 5;
-my $use_same_scale = 1;
+my $cfg_file = $< ? "$ENV{HOME}/.net_monitorrc" : "/etc/sysconfig/net_monitorrc";
+my %config = getVarsFromSh($cfg_file);
+my $use_same_scale = text2bool($config{use_same_scale});
-network::netconnect::load_conf($netcnx, $netc, $intf);
-network::netconnect::read_net_conf('', $netcnx, $netc);
MDK::Common::Globals::init(in => $in);
gtkadd($window1->{window},
gtkpack_(Gtk2::VBox->new(0,5),
1, gtkpack_(Gtk2::HBox->new(0,5),
- 1, my $notebook = Gtk2::Notebook->new,
- 0, gtkpack_(Gtk2::VBox->new(0,5),
+ 0, my $notebook = Gtk2::Notebook->new,
+ 1, gtkpack_(Gtk2::VBox->new(0,5),
0, gtkadd(gtkset_shadow_type(Gtk2::Frame->new(N("Settings")), 'etched_out'),
gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,0),5),
N("Connection type: "),
@@ -99,34 +104,38 @@ gtkadd($window1->{window},
1, gtkadd(gtkset_shadow_type(Gtk2::Frame->new(N("Global statistics")), 'etched_out'),
gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,0),5),
create_packtable({ col_spacings => 1, row_spacings => 5, homogeneous => 1 },
- [ "", N("Instantaneous") , N("Average") ],
- [ Gtk2::WrappedLabel->new(N("Sending\nspeed:")), my $label_st = Gtk2::Label->new(""), my $label_sta = Gtk2::Label->new("na") ],
- [ Gtk2::WrappedLabel->new(N("Receiving\nspeed:")), my $label_sr = Gtk2::Label->new(""), my $label_sra = Gtk2::Label->new("na") ],
+ [ Gtk2::Label->new(""), Gtk2::Label->new(N("Instantaneous")) , Gtk2::Label->new(N("Average")) ],
+ [ Gtk2::WrappedLabel->new(N("Sending\nspeed:")), my $label_st = Gtk2::Label->new(""), my $label_sta = Gtk2::Label->new(N("unknown")) ],
+ [ Gtk2::WrappedLabel->new(N("Receiving\nspeed:")), my $label_sr = Gtk2::Label->new(""), my $label_sra = Gtk2::Label->new(N("unknown")) ],
),
+ Gtk2::HSeparator->new,
gtkpack__(gtkset_border_width(Gtk2::HBox->new(0,0),5),
N("Connection\ntime: "),
- my $label_ct = Gtk2::Label->new(""),
+ my $label_ct = Gtk2::Label->new(N("unknown")),
),
)
),
)
),
- 0, gtksignal_connect(gtkset_active(new Gtk2::CheckButton(N("Use same scale for received and transmitted")), $use_same_scale), clicked => sub { $use_same_scale = !$use_same_scale }),
+ 0, gtksignal_connect(gtkset_active(Gtk2::CheckButton->new(N("Use same scale for received and transmitted")), $use_same_scale), clicked => sub { $use_same_scale = !$use_same_scale }),
0, gtkpack(create_hbox('edge'),
gtksignal_connect(my $button_connect = gtkset_sensitive(Gtk2::Button->new(N("Wait please")), 0), clicked => \&connection),
- gtksignal_connect(my $button_close = Gtk2::Button->new(N("Close")), clicked => sub { ugtk2->exit(0) }),
+ gtksignal_connect(my $button_close = Gtk2::Button->new(N("Close")), clicked => \&main_quit),
),
0, my $statusbar = Gtk2::Statusbar->new
),
);
+
$window1->{rwindow}->show_all;
$window1->{rwindow}->realize;
+
my $gct = Gtk2::Gdk::GC->new($window1->{rwindow}->window);
$gct->set_foreground($colort);
my $gcr = Gtk2::Gdk::GC->new($window1->{rwindow}->window);
$gcr->set_foreground($colorr);
my $gca = Gtk2::Gdk::GC->new($window1->{rwindow}->window);
$gca->set_foreground($colora);
+
$statusbar->push(1, N("Wait please, testing your connection..."));
$window1->{rwindow}->show_all;
@@ -139,7 +148,7 @@ rescan();
gtkflush() while $isconnected == -2 || $isconnected == -1;
Glib::Source->remove($time_tag2);
-$time_tag2 = Glib::Timeout->add(20000, \&update);
+$time_tag2 = Glib::Timeout->add(5000, \&update);
connection() if $connect && !$isconnected || $disconnect && $isconnected;
@@ -151,7 +160,6 @@ $SIG{CHLD} = sub {
$child_pid = waitpid(-1, POSIX::WNOHANG);
if ($tool_pid eq $child_pid) {
undef $tool_pid;
- $button_connect->set_sensitive(1);
$button_close->set_sensitive(1);
}
} while $child_pid > 0;
@@ -159,22 +167,15 @@ $SIG{CHLD} = sub {
$window1->main;
-ugtk2->exit(0);
+main_quit();
my $during_connection;
my $first;
-sub bg_command_as_root {
- my $name = shift;
- run_program::raw({ detach => 1 }, [ 'consolehelper', $name ], @_);
-}
-
-sub start_connection() {
- $default_intf and bg_command_as_root('/sbin/ifup', $default_intf);
-}
-
-sub stop_connection() {
- $default_intf and bg_command_as_root('/sbin/ifdown', $default_intf);
+sub main_quit() {
+ $config{use_same_scale} = bool2yesno($use_same_scale);
+ setVarsInSh($cfg_file, \%config);
+ ugtk2->exit(0);
}
sub connection() {
@@ -185,13 +186,13 @@ sub connection() {
$button_close->set_sensitive(0);
$statusbar->pop(1);
$statusbar->push(1, $wasconnected ? N("Disconnecting from Internet ") : N("Connecting to Internet "));
- if ($wasconnected == 1) {
+ if ($wasconnected == 0) {
$c_time = time();
$ct_tag = Glib::Timeout->add(1000, sub {
my ($sec, $min, $hour) = gmtime(time() - $c_time);
my $e = sprintf("%02d:%02d:%02d", $hour, $min, $sec);
$label_ct->set_label($e); 1 })
- } else { Glib::Source->remove($ct_tag) }
+ }
my $nb_point = 1;
$first = 1;
@@ -232,8 +233,10 @@ sub connection() {
N("Disconnection from Internet complete.")) :
($isconnected ?
N("Connection complete.") :
- N("Connection failed.\nVerify your configuration in the Mandrake Control Center."))
+ N("Connection failed.\nVerify your configuration in the Mandrakelinux Control Center."))
);
+ # remove the connection time timer if connection is down or failed
+ $isconnected or Glib::Source->remove($ct_tag);
my $delay = 1000;
# keep the message displayed longer if there is a problem.
if ($isconnected == $wasconnected) { $delay = 5000 }
@@ -252,9 +255,9 @@ sub connection() {
gtkflush();
if ($wasconnected == 1) {
- $tool_pid = stop_connection();
+ $tool_pid = network::tools::stop_interface($default_intf);
} else {
- $tool_pid = start_connection();
+ $tool_pid = network::tools::start_interface($default_intf);
}
}
@@ -336,21 +339,16 @@ sub get_val() {
sub change_color {
my ($color) = @_;
my $dialog = _create_dialog(N("Color configuration"));
- my $doit;
$dialog->vbox->add(my $colorsel = Gtk2::ColorSelection->new);
- gtkpack($dialog->action_area,
- gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub {
- $doit = 1;
- $dialog->destroy;
- }),
- gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub {
- $dialog->destroy;
- }),
- );
$colorsel->set_current_color($color);
+ $dialog->add_button(N("Cancel"), 'cancel');
+ $dialog->add_button(N("Ok"), 'ok');
$dialog->show_all;
- $dialog->run;
- $doit ? $colorsel->get_current_color : $color;
+ if ($dialog->run eq 'ok') {
+ $color = $colorsel->get_current_color;
+ }
+ $dialog->destroy;
+ $color;
}
my ($scale_r, $scale_t);
@@ -422,11 +420,12 @@ sub update() {
)),
Gtk2::Label->new($intf));
foreach my $i ([$button_t, $gct], [$button_r, $gcr], [$button_a, $gca]) {
- $i->[0]->add(gtksignal_connect(gtkshow(gtksize(gtkset_size_request(Gtk2::DrawingArea->new, 10, 10), 10, 10)), expose_event => sub { $_[0]->window->draw_rectangle($i->[1], 1, 0, 0, 10, 10) }));
+ $i->[0]->add(gtksignal_connect(gtkshow(gtksize(gtkset_size_request(Gtk2::DrawingArea->new, 10, 10), 10, 10)),
+ expose_event => sub { $_[0]->window->draw_rectangle($i->[1], 1, 0, 0, 10, 10) }));
}
$monitor->{$intf}{page} = $notebook->page_num($page);
- $darea->{$intf}->realize;
- $pixmap->{$intf} = Gtk2::Gdk::Pixmap->new($darea->{$intf}->window, $width, $height, $darea->{$intf}->window->get_depth);
+ $darea->{$intf}->realize;
+ $pixmap->{$intf} = Gtk2::Gdk::Pixmap->new($darea->{$intf}->window, $width, $height, $darea->{$intf}->window->get_depth);
$monitor->{$intf}{referencer} = $monitor->{$intf}{val}[0];
$monitor->{$intf}{referencet} = $monitor->{$intf}{val}[8];
$pixmap->{$intf}->draw_rectangle($darea->{$intf}->style->black_gc, 1, 0, 0, $width, $height);
@@ -441,6 +440,10 @@ sub update() {
$darea->{$intf}->signal_connect(expose_event => sub {
$darea->{$intf}->window->draw_drawable($darea->{$intf}->style->bg_gc('normal'), $pixmap->{$intf}, 0, 0, 0, 0, $width, $height);
});
+ $gc_lines->{$intf} = Gtk2::Gdk::GC->new($darea->{$intf}->window);
+ $gc_lines->{$intf}->set_foreground($darea->{$intf}->style->white);
+ $gc_lines->{$intf}->set_line_attributes(1, 'on-off-dash', 'not-last', 'round');
+
}
}
foreach (@interfaces) {
@@ -464,10 +467,10 @@ sub update() {
$statusbar->pop(1);
$statusbar->push(1, $isconnected == 1 ? N("Connected") : N("Not connected"));
}
+ $button_connect->set_sensitive(1);
$button_connect->set("label", $isconnected == 1 ? N("Disconnect %s", translate($netcnx->{type})) : N("Connect %s", $netcnx->{type}));
- $button_connect->set_sensitive($default_intf || scalar(@interfaces));
}
- if (!(-e $network::tools::connect_file && -e $network::tools::disconnect_file)) {
+ unless ($default_intf || @interfaces) {
$button_connect->set_sensitive(0);
$button_connect->set("label", N("No internet connection configured"));
}
@@ -484,6 +487,7 @@ sub in_ifconfig {
sub draw_monitor {
my ($o, $intf) = @_;
defined $darea->{$intf} or return;
+ my $gcl = $gc_lines->{$intf};
my $pixmap = $pixmap->{$intf};
$pixmap->draw_rectangle($darea->{$intf}->style->black_gc, 1, 0, 0, $width, $height);
my $maxr = 0;
@@ -539,10 +543,6 @@ sub draw_monitor {
$step++;
}
- my $gcl = Gtk2::Gdk::GC->new($darea->{$intf}->window);
- $gcl->set_foreground($darea->{$intf}->style->white);
- $gcl->set_line_attributes(1, 'on-off-dash', 'not-last', 'round');
-
my ($pix_maxr, $pix_maxt);
if ($last_a) {
$pix_maxr = $height - scale_received(@{$o->{stack_ra}}[$last_a]);
diff --git a/perl-install/standalone/printerdrake b/perl-install/standalone/printerdrake
index e9dde3564..013905069 100755
--- a/perl-install/standalone/printerdrake
+++ b/perl-install/standalone/printerdrake
@@ -37,7 +37,6 @@ use Gtk2::Gdk::Keysyms;
use modules;
use c;
-my $companyname = "Mandrakesoft";
my $distroname = "Mandrakelinux";
my $domainname = "mandrakesoft.com";
@@ -47,15 +46,15 @@ local $_ = join '', @ARGV;
my $printer;
+$ugtk2::wm_icon = "printerdrake";
my $in = 'interactive'->vnew('su', if_(!$::isEmbedded, 'printer-mdk'));
-my $commandline = $_;
-exit 0 unless printer::printerdrake::first_time_dialog($printer, $in);
+my $commandline = $_;
# Data structure for GTK2 main window
my $us = {};
-$us->{VERSION} = '0.1';
+$us->{VERSION} = '10.1';
# GTK2 splash screen
my $window_splash;
@@ -88,13 +87,19 @@ my $w = $in->wait_message(N("Printerdrake"),
# Get what was installed before
eval { $printer = printer::main::getinfo('') };
+undef $w;
+
+exit 0 unless printer::printerdrake::first_time_dialog($printer, $in, undef);
+
# Were we in expert mode last time?
$printer->{expert} = printer::main::get_usermode();
# Choose the spooler by command line options
-$commandline =~ /-expert/ and $printer->{expert} = 1;
+$::expert and $printer->{expert} = 1;
$commandline =~ /-cups/ and
$printer->{SPOOLER} = 'cups' and printer::main::read_configured_queues($printer);
+$commandline =~ /-rcups/ and
+ $printer->{SPOOLER} = 'rcups' and printer::main::read_configured_queues($printer);
$commandline =~ /-lpr/ and
$printer->{SPOOLER} = 'lpd' and printer::main::read_configured_queues($printer);
$commandline =~ /-lpd/ and
@@ -103,21 +108,21 @@ $commandline =~ /-lprng/ and
$printer->{SPOOLER} = 'lprng' and printer::main::read_configured_queues($printer);
$commandline =~ /-pdq/ and
$printer->{SPOOLER} = 'pdq' and printer::main::read_configured_queues($printer);
-modules::mergein_conf();
-
-undef $w;
if ($::isInstall) {
# Interactive main window for installation
- printer::printerdrake::main($printer, $in, 1);
+ printer::printerdrake::main($printer, $::o->{security}, $in, 1, undef);
exit();
}
+require security::level;
+my $security = security::level::get();
+
# Do not let printerdrake ask for the spooler
$printer->{SPOOLER} ||= 'cups';
# Initialization
-printer::printerdrake::init($printer, $in);
+printer::printerdrake::init($printer, $security, $in, undef);
# GTK2 main window
@@ -133,13 +138,14 @@ if (!$::isEmbedded) {
$us->{wnd}{rwindow}->set_position('center');
}
$us->{wnd}{window}->signal_connect(delete_event => \&QuitGlobal);
-my $ltree_model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String");
-my $rtree_model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String");
+my $ltree_model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String");
+my $rtree_model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String");
my ($localtree, $remotetree);
$localtree = CreateTree($ltree_model);
$remotetree = CreateTree($rtree_model);
# slightly verbatimed from control-center
my %options = (
+ 'add' => [ N("/_Actions"), N("/_Add Printer") ],
'default' => [ N("/_Actions"), N("/Set as _Default") ],
'edit' => [ N("/_Actions"), N("/_Edit") ],
'delete' => [ N("/_Actions"), N("/_Delete") ],
@@ -169,14 +175,14 @@ my ($menu, $factory) = create_factory_menu($::isEmbedded ? $::Plug : $us->{wnd}{
();
}, undef, '<CheckItem>' ],
[ N("/_Help"), undef, undef, undef, '<Branch>' ],
- [ N("/_Help").N("/_Help"), undef, sub { HelpSystem() }, undef, '<StockItem>', 'gtk-help' ],
- [ N("/_Help").N("/_Report Bug"), undef, sub { system("$ENV{BROWSER} https://qa.$domainname &") }, undef, '<StockItem>', 'gtk-stop' ],
- [ N("/_Help").N("/_About..."), undef, \&About, undef, '<StockItem>', 'gtk-preferences' ]
+ [ N("/_Help") . N("/_Help"), undef, sub { HelpSystem() }, undef, '<StockItem>', 'gtk-help' ],
+ [ N("/_Help") . N("/_Report Bug"), undef, sub { system("$ENV{BROWSER} https://qa.$domainname &") }, undef, '<StockItem>', 'gtk-stop' ],
+ [ N("/_Help") . N("/_About..."), undef, \&About, undef, '<StockItem>', 'gtk-preferences' ]
)
);
%buttorcheck = map {
$_ => $factory->get_widget("<main>" . join '', map { s/_//; $_ } @{$options{$_}})
-}('default', 'edit', 'delete', 'expert');
+}('add', 'default', 'edit', 'delete', 'expert');
if (defined $buttorcheck{expert}) {
$buttorcheck{expert}->set_active($printer->{expert});
@@ -202,26 +208,26 @@ $us->{wnd}{window}->add(gtkpack_(Gtk2::VBox->new(0, 0),
0, $searchBox,
0, Gtk2::HSeparator->new,
1, $nb));
-my @lcolsize = (1, 1, 1, 1, 1, 1, -1);
-my @rcolsize = (1, 1, 1, 1, 1, -1);
+my @lcolsize = (1, 1, 1, 1, 1, 1, 1, -1);
+my @rcolsize = (1, 1, 1, 1, 1, 1, -1);
each_index {
my $col = Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i);
$col->set_sort_column_id($::i);
$col->set_min_width($lcolsize[$::i]);
$localtree->append_column($col);
-} (N("Def."), N("Printer Name"), N("Model"), N("Connection Type"), N("Description"), N("Location"));
+} (N("Def."), N("Printer Name"), N("State"), N("Model"), N("Connection Type"), N("Description"), N("Location"));
each_index {
my $col = Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i);
$col->set_sort_column_id($::i);
$col->set_min_width($rcolsize[$::i]);
$remotetree->append_column($col);
-} (N("Def."), N("Printer Name"), N("Server Name"), N("Description"), N("Location"));
+} (N("Def."), N("Printer Name"), N("State"), N("Server Name"), N("Description"), N("Location"));
my @toolbwg = map {
$toolb->append_item($_->[0], $_->[1], $_->[2],
Gtk2::Image->new_from_file($pixdir . $_->[2] . '.png'), $_->[3], $toolb);
# $toolb->append_space;
-} ( [
+} ([
# FIXME: then "add printer" should be a simple verb as suggested in Human Guidelines!!!
#-PO: "Add Printer" is a button text and the translation has to be AS SHORT AS POSSIBLE
N("Add Printer"), N("Add a new printer to the system"), 'printer_add', \&AddPrinter ],
@@ -241,8 +247,11 @@ my @toolbwg = map {
#-PO: "Configure CUPS" is a button text and the translation has to be AS SHORT AS POSSIBLE
N("Configure CUPS"), N("Configure CUPS printing system"), 'cups_config', \&ConfigCUPS ]
);
-my ($_tbadd, $tbdefault, $tbedit, $tbdel, $_tbref, $_tbconfig) = @toolbwg;
+my ($tbadd, $tbdefault, $tbedit, $tbdel, $_tbref, $_tbconfig) = @toolbwg;
GrayDelEdit();
+foreach ($tbadd, $buttorcheck{add}) { defined $_ and $_->set_sensitive($printer->{SPOOLER} ne "rcups")};
+$localtree->parent->parent->set_sensitive($printer->{SPOOLER} ne "rcups");
+$nb->set_current_page(1) if $printer->{SPOOLER} eq "rcups";
$fbut->signal_connect('clicked', sub { $stringsearch = $filter->get_text; Refresh($stringsearch) });
Refresh($stringsearch);
@@ -283,6 +292,7 @@ sub RefreshLocalPrintersFull {
my @printers;
defined $printer and @printers = keys %{$printer->{configured}};
$ltree_model->clear;
+ return if $printer->{SPOOLER} eq "rcups";
my @LocalReal;
LOOP: foreach my $p (@printers) {
# Apply string search to all fields, not only the printer name
@@ -295,15 +305,19 @@ sub RefreshLocalPrintersFull {
push(@LocalReal, $p) if $searchstr =~ /\Q$strfilt/i;
};
foreach my $p (sort { lc($a) cmp lc($b) } @LocalReal) {
+ my $state = ($printer->{SPOOLER} !~ /cups/ ? N("Unknown") :
+ (printer::cups::queue_enabled($p) ? N("Enabled") :
+ N("Disabled")));
my $connect = printer::main::connectionstr($printer->{configured}{$p}{queuedata}{connect});
my $description = $printer->{configured}{$p}{queuedata}{desc};
my $location = $printer->{configured}{$p}{queuedata}{loc};
my $model = $printer->{configured}{$p}{queuedata}{make} . ' ' .
$printer->{configured}{$p}{queuedata}{model};
my $default = ($p eq $printer->{DEFAULT} ? "X" : "");
- $ltree_model->append_set([ 0 => $default, 1 => $p, 2 => $model,
- 3 => $connect, 4 => $description,
- 5 => $location ]);
+ $ltree_model->append_set([ 0 => $default, 1 => $p, 2 => $state,
+ 3 => $model,
+ 4 => $connect, 5 => $description,
+ 6 => $location ]);
}
}
@@ -318,7 +332,8 @@ sub RefreshRemotePrintersFull {
next LOOP if defined($printer->{configured}{$p->{queuename}});
# Apply string search to all fields, not only the printer name
my $queue = $p->{queuename};
- my $server = $p->{ipp};
+ my $server = ($p->{ipp} ?
+ $p->{ipp} : $printer->{remote_cups_server});
my $description = $p->{description};
my $location = $p->{location};
my $searchstr = "$queue|$server|$description|$location";
@@ -328,13 +343,18 @@ sub RefreshRemotePrintersFull {
foreach my $p (sort { lc($a->{queuename}) cmp lc($b->{queuename}) }
@RemoteReal) {
my $queue = $p->{queuename};
- my $server = $p->{ipp};
+ my $state = ($printer->{SPOOLER} !~ /cups/ ? N("Unknown") :
+ (printer::cups::queue_enabled($queue) ? N("Enabled") :
+ N("Disabled")));
+ my $server = ($p->{ipp} ?
+ $p->{ipp} : $printer->{remote_cups_server});
my $description = $p->{description};
my $location = $p->{location};
my $default = ($queue eq $printer->{DEFAULT} ? "X" : "");
$rtree_model->append_set([ 0 => $default, 1 => $queue,
- 2 => $server, 3 => $description,
- 4 => $location ]);
+ 2 => $state, 3 => $server,
+ 4 => $description,
+ 5 => $location ]);
}
}
@@ -349,7 +369,7 @@ sub Refresh {
sub AddPrinter() {
deactivate_mainwindow();
- if (printer::printerdrake::add_printer($printer, $in)) {
+ if (printer::printerdrake::add_printer($printer, $in, undef)) {
Refresh($stringsearch);
set_selection($printer->{QUEUE});
} else {
@@ -393,7 +413,10 @@ sub Delete() {
sub ConfigCUPS() {
deactivate_mainwindow();
- printer::printerdrake::config_cups($printer, $in);
+ printer::printerdrake::config_cups($printer, $security, $in, undef);
+ foreach ($tbadd, $buttorcheck{add}) { defined $_ and $_->set_sensitive($printer->{SPOOLER} ne "rcups")};
+ $localtree->parent->parent->set_sensitive($printer->{SPOOLER} ne "rcups");
+ $nb->set_current_page(1) if $printer->{SPOOLER} eq "rcups";
Refresh($stringsearch);
activate_mainwindow();
}
@@ -482,7 +505,23 @@ sub CreateTree {
$tree->get_selection->set_mode('browse');
$tree->set_headers_visible(1);
$tree->set_rules_hint(1);
- $tree->get_selection->signal_connect('changed' => sub { foreach ($tbdefault, $tbedit, $tbdel, $buttorcheck{default}, $buttorcheck{edit}, $buttorcheck{delete}) { $_->set_sensitive(1) } });
+ $tree->get_selection->signal_connect('changed' => sub {
+ my (undef, $_event) = @_;
+ my (undef, $iter) = $tree->get_selection->get_selected;
+ return unless $iter;
+ foreach ($tbdefault, $tbedit, $tbdel, $buttorcheck{default}, $buttorcheck{edit}, $buttorcheck{delete}) { $_->set_sensitive(1) }
+ my $queue = $tree_model->get($iter, 1);
+ if (!defined($printer->{configured}{$queue})) {
+ foreach ($tbdel, $buttorcheck{delete}) {
+ $_->set_sensitive(0);
+ }
+ }
+ if ($queue eq $printer->{DEFAULT}) {
+ foreach ($tbdefault, $buttorcheck{default}) {
+ $_->set_sensitive(0);
+ }
+ }
+ });
$tree->signal_connect(button_press_event => sub {
my (undef, $event) = @_;
my (undef, $iter) = $tree->get_selection->get_selected;
@@ -494,6 +533,11 @@ sub CreateTree {
$_->set_sensitive(0);
}
}
+ if ($queue eq $printer->{DEFAULT}) {
+ foreach ($tbdefault, $buttorcheck{default}) {
+ $_->set_sensitive(0);
+ }
+ }
Edit() if $event->type eq '2button-press';
});
$tree->signal_connect(key_press_event => sub {
@@ -525,7 +569,7 @@ sub About() {
$list->can_focus(0);
each_index { $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => $::i)) } 0..2;
$list->set_headers_visible(0);
- foreach my $row ([ '', '', ''], [ N("Authors: "), 'Till Kamppeter', "<till\@$domainname>" ], ['', '', '']) {
+ foreach my $row ([ '', '', '' ], [ N("Authors: "), 'Till Kamppeter', "<till\@$domainname>" ], [ '', '', '' ]) {
$tree_model->append_set(undef, [ map_index { $::i => $_ } @$row ]);
}
$list->get_selection->set_mode('none');
diff --git a/perl-install/standalone/scannerdrake b/perl-install/standalone/scannerdrake
index 78dac5207..09508e280 100755
--- a/perl-install/standalone/scannerdrake
+++ b/perl-install/standalone/scannerdrake
@@ -41,6 +41,7 @@ foreach (@ARGV) {
/^--dynamic=(.*)$/ and do { dynamic(); exit() };
}
+$ugtk2::wm_icon = "scannerdrake";
my $in = 'interactive'->vnew('su');
if (!files_exist(qw(/usr/bin/scanimage
/etc/sane.d/dll.conf)) ||
@@ -63,11 +64,11 @@ Do you want to install the SANE packages?"))) {
}
if ($::Manual) { manual(); quit() }
my $wait = $in->wait_message(N("Scannerdrake"),
- N("Searching for configured scanners ..."));
+ N("Searching for configured scanners..."));
my @c = scanner::configured();
$wait = undef;
$wait = $in->wait_message(N("Scannerdrake"),
- N("Searching for new scanners ..."));
+ N("Searching for new scanners..."));
my @f = scanner::detect(@c);
$wait = undef;
my $changed = 0;
@@ -75,7 +76,7 @@ my $changed = 0;
if ($changed) {
my $_wait =
$in->wait_message(N("Scannerdrake"),
- N("Re-generating list of configured scanners ..."));
+ N("Re-generating list of configured scanners..."));
@c = scanner::configured();
}
mainwindow(@c);
@@ -151,14 +152,9 @@ sub dynamic() {
if (member($_->{val}{DESCRIPTION}, keys %$scanner::scannerDB)) {
$name = $_->{val}{DESCRIPTION};
$name =~ s/\s$//; #some HP entry have a trailing space, i will correct usbtable asap
- if ($scanner::scannerDB->{$name}{flags}{unsupported}) {
- $in->ask_warn('Scannerdrake', N("The %s is not supported by this version of %s.", removeverticalbar($name), $distroname));
- next;
- }
+ next if ($scanner::scannerDB->{$name}{flags}{unsupported});
scanner::confScanner($name, $_->{port},
$_->{val}{vendor}, $_->{val}{id}, "");
- } else {
- $in->ask_warn('Scannerdrake', N("The %s is not known by this version of Scannerdrake.", removeverticalbar($name)));
}
}
}
@@ -342,7 +338,7 @@ sub tryConfScanner {
) or return 0;
if ($port eq N("Auto-detect available ports")) {
$wait = $in->wait_message(N("Scannerdrake"),
- N("Searching for scanners ..."));
+ N("Searching for scanners..."));
my @d = scanner::detect();
undef $wait;
my @list = map {
@@ -461,11 +457,11 @@ sub mainwindow {
# Do scanner auto-detection
my $wait =
$in->wait_message(N("Scannerdrake"),
- N("Searching for configured scanners ..."));
+ N("Searching for configured scanners..."));
@configured = scanner::configured();
$wait =
$in->wait_message(N("Scannerdrake"),
- N("Searching for new scanners ..."));
+ N("Searching for new scanners..."));
my @f = scanner::detect(@configured);
$wait = undef;
if (@f) {
@@ -487,7 +483,7 @@ sub mainwindow {
if ($changed) {
my $_wait =
$in->wait_message(N("Scannerdrake"),
- N("Re-generating list of configured scanners ..."));
+ N("Re-generating list of configured scanners..."));
@configured = scanner::configured();
}
} else {
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 1cd03cc43..4069551b6 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -10,17 +10,28 @@ use common;
use interactive;
use detect_devices;
use harddrake::data;
+use harddrake::autoconf;
use harddrake::sound;
use modules;
use Storable qw(store retrieve);
+
+my $force = any { $_ eq '--force' } @ARGV;
+
+my $mode = 'stop' if $ARGV[0] eq 'stop';
+
+if ($mode eq 'stop') {
+ append_to_file('/etc/hotplug/blacklist', "\nsnd-usb-audio\n");
+ c::_exit(0);
+}
+
my $invert_do_it = $ARGV[0] eq 'X11' ? 1 : 0;
my ($hw_sysconfdir, $timeout) = ("/etc/sysconfig/harddrake2", $invert_do_it ? 600 : 25);
-my $last_boot_config = $hw_sysconfdir."/previous_hw";
+my $last_boot_config = "$hw_sysconfdir/previous_hw";
$last_boot_config .= '_X11' if $invert_do_it;
-modules::mergein_conf();
+my $modules_conf = modules::any_conf->read;
# autoreconfigure the mouse on major kernel change:
my $prev_kernel = { getVarsFromSh("$hw_sysconfdir/kernel") }->{KERNEL};
@@ -29,13 +40,14 @@ $curr_kernel =~ s/(^\d+\.\d+).*/$1/;
setVarsInSh("$hw_sysconfdir/kernel", { KERNEL => $curr_kernel });
if ($curr_kernel ne $prev_kernel) {
log::explanations("Autoconfiguring mouse since we switched between 2.4.x and 2.6.x kernels");
- require class_discard;
- require mouse;
- mouse::write_conf(class_discard->new, mouse::detect(), 1);
+ harddrake::autoconf::mouse_conf($modules_conf);
}
if (find { $_->{driver} =~ /Card:NVIDIA/ } detect_devices::probeall()) {
- if (find { -e join('', "/lib/modules/", c::kernel_version(), "/kernel/drivers/$_") } map { ("video/$_", "char/$_") } qw(NVdriver nvidia.o nvidia.o.gz nvidia.ko nvidia.ko.gz)) {
+ if (find { -e join('', "/lib/modules/", c::kernel_version(), "/kernel/drivers/$_") } map { ("video/$_", "char/$_", "char/drm/$_") } qw(NVdriver nvidia.o nvidia.o.gz nvidia.ko nvidia.ko.gz)) {
+ # do not automatically switch from nv to nvidia (in order to handle
+ # cases where nvidia module crashes the system):
+ #
# substInFile {
# log::explanations("switch XFree86 driver from nv to nvidia") if /Driver "nv"/;
# s!Driver "nv.*"!Driver "nvidia"!g;
@@ -45,22 +57,31 @@ if (find { $_->{driver} =~ /Card:NVIDIA/ } detect_devices::probeall()) {
substInFile {
log::explanations("switch XFree86 driver from nvidia to nv") if /Driver "nv.+"/;
s!Driver "nv.*"!Driver "nv"!g;
- s!([^#]Load.*glx)!#$1!g;
- } $_ foreach "/etc/X11/XF86Config-4", "/etc/X11/XF86Config";
+ } $_ foreach grep { -e $_ } "/etc/X11/XF86Config-4", "/etc/X11/XF86Config";
}
}
my $is_globetrotter = -f '/usr/sbin/mdkmove';
# first run ? if not read old hw config
-my $previous_config = -f $last_boot_config && -s $last_boot_config ? Storable::retrieve($last_boot_config) : {};
+my $previous_config;
+
+if (-f $last_boot_config && -s $last_boot_config) {
+ eval { $previous_config = Storable::retrieve($last_boot_config) };
+ log::explanations("resetting previous harware file ($@)") if $@;
+}
+
+$previous_config ||= {};
+
$previous_config = $$previous_config if ref($previous_config) !~ /HASH/;
my (%config, $wait);
my $in;
my $splash = -f '/proc/splash';
+my $splash_was_silent = cat_('/proc/splash') =~ /, silent : on/;
+
# For each hw, class, detect device, compare and offer to reconfigure if needed
foreach my $hw_class (@harddrake::data::tree) {
- my ($Ident, $item, $configurator, $detector, $do_it) = @$hw_class{qw(class string configurator_auto detector checked_on_boot)};
+ my ($Ident, $item, $configurator, $detector, $do_it) = @$hw_class{qw(class string configurator detector checked_on_boot)};
$configurator ||= $hw_class->{configurator};
next unless $do_it ^ $invert_do_it;
@@ -73,7 +94,7 @@ foreach my $hw_class (@harddrake::data::tree) {
$id => $i;
} eval { &$detector };
$config{$Ident} = \%ID;
- next if !$is_globetrotter && is_empty_hash_ref $previous_config; # don't fsck on first run
+ next if !$is_globetrotter && !$force && is_empty_hash_ref($previous_config); # don't fsck on first run but if --force
my $oldconfig = $previous_config->{$Ident};
@@ -89,12 +110,19 @@ foreach my $hw_class (@harddrake::data::tree) {
log::explanations("removed $Ident: " . harddrake::data::custom_id($oldconfig->{$_}, $item)) foreach @was_removed;
log::explanations("added $Ident: " . harddrake::data::custom_id($ID{$_}, $item)) foreach @added;
- modules::load('ohci1394') if $Ident eq 'FIREWIRE_CONTROLLER' && any { $_->{driver} eq 'ohci1394' } @added;
+ modules::load_and_configure($modules_conf, 'ohci1394') if $Ident eq 'FIREWIRE_CONTROLLER' && any { $_->{driver} eq 'ohci1394' } @added;
@added || @was_removed or next;
+
+ if (harddrake::data::is_removable($Ident)) {
+ modules::load_category('floppy') if $Ident eq 'FLOPPY';
+ }
+
+ next if $Ident eq 'MOUSE' && $curr_kernel ne $prev_kernel;
+
my @configurator_pool;
if (harddrake::data::is_removable($Ident)) {
foreach my $device (@ID{@added}) {
- push @configurator_pool, harddrake::data::set_removable_configurator($Ident, $device);
+ push @configurator_pool, harddrake::data::set_removable_auto_configurator($Ident, $device);
};
foreach my $device (@$oldconfig{@was_removed}) {
push @configurator_pool, harddrake::data::set_removable_remover($Ident, $device);
@@ -105,30 +133,40 @@ foreach my $hw_class (@harddrake::data::tree) {
if ($Ident eq "AUDIO") {
# automatic sound slots configuration
rm_rf("/etc/asound.state");
- harddrake::sound::configure_sound_slots();
+ harddrake::sound::configure_sound_slots($modules_conf);
next;
} elsif ($Ident eq "ETHERNET") {
- modules::remove_alias_regexp('^(wlan|eth)[0-9]*$');
- modules::load_category('network/main|gigabit|usb|wireless');
+ $modules_conf->remove_alias_regexp('^(wlan|eth)[0-9]*$');
+ modules::load_category($modules_conf, 'network/main|gigabit|usb|wireless|firewire|pcmcia');
require network::ethernet;
- network::ethernet::configure_eth_aliases();
- modules::write_conf();
- } elsif ($Ident eq "AGP") {
- # add agpgart modules to modprobe.preload if needed:
- modules::write_conf();
+ network::ethernet::update_iftab();
+ network::ethernet::configure_eth_aliases($modules_conf);
+ $modules_conf->write;
+ next;
+ } elsif (member($Ident, qw(AGP ATA_STORAGE SATA_STORAGE SCSI_CONTROLLER TV))) {
+ # add agpgart and the like modules to modprobe.preload if needed:
+ $modules_conf->write;
+ next;
+ } elsif ($Ident eq "USB_CONTROLLER") {
+ modules::load_category($modules_conf, 'bus/usb');
+ $modules_conf->write;
} elsif ($Ident eq "VIDEO") {
- require harddrake::autoconf;
- harddrake::autoconf::xconf();
+ harddrake::autoconf::xconf($modules_conf, {});
+ next;
+ } elsif ($Ident eq "MOUSE") {
+ harddrake::autoconf::mouse_conf($modules_conf);
next;
}
next if $is_globetrotter && !$hw_class->{automatic};
next unless $configurator_pool[0];
- if (!-x first(split /\s+/, $configurator_pool[0])) {
- log::explanations(qw(skip $Ident configuration sincecannot "$configurator" isn't executable));
+ if (ref($configurator) ne 'CODE' && !-x first(split /\s+/, $configurator_pool[0])) {
+ log::explanations(qw(skip $Ident configuration since "$configurator" isn't executable));
next;
}
my ($pid, $no, $res);
+ $hw_class->{automatic} ||= ref($configurator) eq 'CODE';
+
if (!$hw_class->{automatic}) {
$SIG{ALRM} = sub { $no = 1; kill 15, $pid };
unless ($pid = fork()) {
@@ -142,13 +180,17 @@ foreach my $hw_class (@harddrake::data::tree) {
} else {
$res = 1;
}
- if (!$no && $res) {
- foreach my $configurator (@configurator_pool) {
+ if (ref($configurator) eq 'CODE') {
+ eval { $configurator->() };
+ log::explanations(qw(cannot run "$configurator": $@)) if $@;
+ } elsif (!$no && $res) {
+ foreach my $program (@configurator_pool) {
if (fork()) {
wait();
} else {
- exec("$configurator 2>/dev/null") or do {
- log::explanations(qw(cannot run "$configurator"));
+ log::explanations(qq(run "$program"));
+ exec("$program 2>/dev/null") or do {
+ log::explanations(qq(cannot run "$program"));
require POSIX;
POSIX::_exit();
};
@@ -168,5 +210,8 @@ foreach my $hw_class (@harddrake::data::tree) {
log::explanations("created file $last_boot_config");
Storable::store(\%config, $last_boot_config);
+# restore bootsplash mode
+$splash_was_silent and eval { output('/proc/splash', 'silent') };
+
$in->exit(0) if $in;
diff --git a/perl-install/standalone/service_harddrake.sh b/perl-install/standalone/service_harddrake.sh
index b3da8d1a4..c12bedc31 100644
--- a/perl-install/standalone/service_harddrake.sh
+++ b/perl-install/standalone/service_harddrake.sh
@@ -45,6 +45,7 @@ case "$1" in
stop)
# dummy
rm -f $SUBSYS
+ action "Stopping %s" harddrake /usr/share/harddrake/service_harddrake stop 2>/dev/null
;;
*)
gprintf "Usage: %s {start|stop}\n" "$0"
diff --git a/perl-install/standalone/service_harddrake_confirm b/perl-install/standalone/service_harddrake_confirm
index eaf454960..1528fd9bf 100644
--- a/perl-install/standalone/service_harddrake_confirm
+++ b/perl-install/standalone/service_harddrake_confirm
@@ -5,5 +5,5 @@ use interactive;
my $in = interactive->vnew;
my $res = $in->ask_okcancel(N("Hardware changes in \"%s\" class (%s seconds to answer)", $ARGV[0], $ARGV[1]),
- $ARGV[2] . N("Do you want to run the appropriate config tool ?"), 1);
+ $ARGV[2] . N("Do you want to run the appropriate config tool?"), 1);
$in->exit($res);