summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorMystery Man <unknown@mandriva.org>2002-07-23 11:21:56 +0000
committerMystery Man <unknown@mandriva.org>2002-07-23 11:21:56 +0000
commitc20b84a8b572951b48049234f632f4f1dd7c978f (patch)
tree492e9ef624cee574ecd82c836aeb4b0b05915e6b /perl-install/standalone
parent127a73d935d78af53d3dadd05d4636f6b717976d (diff)
downloaddrakx-1_1_8_12mdk.tar
drakx-1_1_8_12mdk.tar.gz
drakx-1_1_8_12mdk.tar.bz2
drakx-1_1_8_12mdk.tar.xz
drakx-1_1_8_12mdk.zip
This commit was manufactured by cvs2svn to create tag 'V1_1_8_12mdk'.V1_1_8_12mdk
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/XFdrake101
-rwxr-xr-xperl-install/standalone/adduserdrake43
-rwxr-xr-xperl-install/standalone/diskdrake120
-rwxr-xr-xperl-install/standalone/drakTermServ1288
-rwxr-xr-xperl-install/standalone/drakautoinst439
-rwxr-xr-xperl-install/standalone/drakbackup5149
-rwxr-xr-xperl-install/standalone/drakboot63
-rwxr-xr-xperl-install/standalone/drakbug136
-rwxr-xr-xperl-install/standalone/drakbug_report14
-rwxr-xr-xperl-install/standalone/drakconnect694
-rwxr-xr-xperl-install/standalone/drakfloppy456
-rwxr-xr-xperl-install/standalone/drakfont1265
-rwxr-xr-xperl-install/standalone/drakgw770
-rwxr-xr-xperl-install/standalone/drakproxy34
-rwxr-xr-xperl-install/standalone/draksec33
-rwxr-xr-xperl-install/standalone/drakxservices25
-rwxr-xr-xperl-install/standalone/drakxtv166
-rwxr-xr-xperl-install/standalone/fileshareset389
-rwxr-xr-xperl-install/standalone/harddrake26
-rw-r--r--perl-install/standalone/icons/categ.pngbin5173 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/drakTS.620x57.pngbin410 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/drakbackup.540x57.pngbin15562 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/drakconnect_step.pngbin10749 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/drakfont.620x57.pngbin13239 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/eth_card_mini2.pngbin1538 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/fileopen.xpm34
-rw-r--r--perl-install/standalone/icons/find.xpm34
-rw-r--r--perl-install/standalone/icons/findf.xpm31
-rw-r--r--perl-install/standalone/icons/ftin.xpm30
-rw-r--r--perl-install/standalone/icons/ftout.xpm30
-rw-r--r--perl-install/standalone/icons/gmon.pngbin17411 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/cd.pngbin712 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/cpu.pngbin438 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/floppy.pngbin419 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/harddisk.pngbin731 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/harddrake.pngbin671 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/hw_mouse.pngbin606 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/hw_network.pngbin499 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/hw_printer.pngbin547 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/ide_hd.pngbin712 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/isdn.pngbin584 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/joystick.pngbin592 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/keyboard.pngbin798 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/memory.pngbin527 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/modem.pngbin533 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/scanner.pngbin685 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/scsi.pngbin390 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/scsi_hd.pngbin677 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/sound.pngbin435 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/tape.pngbin374 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/tv.pngbin543 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/unknown.pngbin461 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/usb.pngbin432 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/video.pngbin526 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/harddrake2/webcam.pngbin444 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/hori.pngbin7232 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic-drakfont-48.pngbin3337 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-CD-40.pngbin1444 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-back-up-16.pngbin594 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-back-up-32.pngbin3153 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-back-up-48.pngbin4735 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-discdurwhat-40.pngbin1873 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-dossier-32.pngbin818 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-moreoption-40.pngbin1891 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-network-40.pngbin952 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-others-40.pngbin2230 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-system-40.pngbin1169 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-systemeplus-40.pngbin1551 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-tape-40.pngbin2389 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-users-40.pngbin1836 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-when-40.pngbin1834 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/ic82-where-40.pngbin1124 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/mdk_logo.pngbin10892 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/net_c.pngbin3198 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/net_d.pngbin3192 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/net_u.pngbin2866 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/reload.xpm31
-rw-r--r--perl-install/standalone/icons/smbnfs_default.pngbin279 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/smbnfs_has_mntpoint.pngbin300 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/smbnfs_mounted.pngbin295 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/smbnfs_server.pngbin314 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/tradi.pngbin32579 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/verti.pngbin21123 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/wiz_default_left.pngbin2185 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/wiz_default_up.pngbin14567 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/wiz_drakconnect.pngbin14567 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/wiz_drakgw.pngbin8733 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/wiz_firewall.pngbin7016 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/wiz_printerdrake.pngbin11340 -> 0 bytes
-rw-r--r--perl-install/standalone/icons/wiz_scannerdrake.pngbin7158 -> 0 bytes
-rw-r--r--perl-install/standalone/interactive_http/Makefile21
-rw-r--r--perl-install/standalone/interactive_http/authorised_progs13
-rw-r--r--perl-install/standalone/interactive_http/index.html.pl14
-rwxr-xr-xperl-install/standalone/interactive_http/interactive_http.cgi95
-rw-r--r--perl-install/standalone/interactive_http/miniserv.conf13
-rw-r--r--perl-install/standalone/interactive_http/miniserv.init51
-rw-r--r--perl-install/standalone/interactive_http/miniserv.logrotate7
-rw-r--r--perl-install/standalone/interactive_http/miniserv.pam5
-rw-r--r--perl-install/standalone/interactive_http/miniserv.pem18
-rw-r--r--perl-install/standalone/interactive_http/miniserv.pl1817
-rw-r--r--perl-install/standalone/interactive_http/miniserv.users1
-rwxr-xr-xperl-install/standalone/keyboarddrake72
-rwxr-xr-xperl-install/standalone/livedrake46
-rw-r--r--perl-install/standalone/localedrake40
-rwxr-xr-xperl-install/standalone/logdrake681
-rwxr-xr-xperl-install/standalone/lsnetdrake29
-rwxr-xr-xperl-install/standalone/mousedrake97
-rwxr-xr-xperl-install/standalone/net_monitor540
-rwxr-xr-xperl-install/standalone/printerdrake72
-rwxr-xr-xperl-install/standalone/scannerdrake148
-rwxr-xr-xperl-install/standalone/service_harddrake97
-rw-r--r--perl-install/standalone/service_harddrake.sh53
112 files changed, 0 insertions, 15311 deletions
diff --git a/perl-install/standalone/XFdrake b/perl-install/standalone/XFdrake
deleted file mode 100755
index f6584fad8..000000000
--- a/perl-install/standalone/XFdrake
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/perl
-
-# XFdrake
-# Copyright (C) 1999 MandrakeSoft (pixel@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use modules;
-use Xconfigurator;
-use Xconfig;
-use c;
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: XFdrake [--xf3] [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing]\n";
-
-my $X = {};
-
-$::force_xf3 = /-xf3/;
-$::beginner = /-beginner/;
-$::expert = /-expert/;
-$::auto = /-auto/;
-$::noauto = /-noauto/;
-$::testing = /-testing/;
-$X->{skiptest} = /-skiptest/;
-
-my $in = 'interactive'->vnew('su', 'X');
-
--r '/etc/modules.conf' and modules::mergein_conf('/etc/modules.conf');
-
-my $f = "/usr/X11R6/lib/X11/rgb.txt"; #- this one is on all platform (instead of Cards ?)
-$in->do_pkgs->install('XFree86', 'XFree86-75dpi-fonts') if !-e $f;
--e $f or die "install XFree86 first!\n";
-
-`pidof xfs` > 0 or system("/etc/rc.d/init.d/xfs start") if !$X->{skiptest};
-
-system("mount /proc 2>/dev/null"); # ensure /proc is mounted for pci probing
-
-begin:
-Xconfig::getinfo($X);
-Xconfig::getinfoFromXF86Config($X); #- take default from here at least.
-
-my $allowNVIDIA_rpms;
-{
- my (%list, %select);
- eval {
- require urpm;
- my $urpm = new urpm;
- $urpm->read_config(nocheck_access => 1);
- foreach (grep { !$_->{ignore} } @{$urpm->{media} || []}) {
- $urpm->parse_synthesis($_);
- }
- foreach (@{$urpm->{depslist} || []}) {
- $_->name =~ /NVIDIA/ and $list->{$_->name} = 1;
- }
- };
- if ($list{NVIDIA_GLX}) {
- eval {
- my ($version, $release, $ext) = c::kernel_version() =~ /([^-]*)-([^-]*mdk)(\S*)/;
- $ext and $ext = "-$ext";
- $list{"NVIDIA_kernel-$version-$release$ext"} or die "no NVIDIA kernel for current kernel";
- $select{"NVIDIA_kernel-$version-$release$ext"} = 1;
- foreach (`rpm -qa kernel-2* kernel-smp-2* kernel-enterprise-2* kernel-secure-2* kernel kernel-smp kernel-entreprise kernel22 kernel22-smp kernel22-secure`) {
- ($ext, $version, $release) = /kernel[^-]*(-\D[^-]*)-([^-]*)-([^-]*mdk)?/;
- $release or ($version, $release) = $version =~ /(.*?)\.(\d+mdk)/;
- $list{"NVIDIA_kernel-$version-$release$ext"} and $select{"NVIDIA_kernel-$version-$release$ext"} = 1;
- }
- $allowNVIDIA_rpms = [ keys(%select), "NVIDIA_GLX" ];
- }
- }
- if (!$allowNVIDIA_rpms) {
- $allowNVIDIA_rpms = system("modprobe NVdriver 2>/dev/null") == 0 && []; #- empty list but true.
- }
-}
-
-$::isEmbedded and kill USR2, $::CCPID;
-Xconfigurator::main($X, $in, $in->do_pkgs,
- { allowFB => $::expert,
- allowNVIDIA_rpms => $allowNVIDIA_rpms });
-!$::isEmbedded and $in->exit(0);
-kill USR1, $::CCPID;
-goto begin;
diff --git a/perl-install/standalone/adduserdrake b/perl-install/standalone/adduserdrake
deleted file mode 100755
index c176f5936..000000000
--- a/perl-install/standalone/adduserdrake
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use common;
-use interactive;
-use any;
-
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: adduserdrake [--beginner] [--expert] [<users...>]\n";
-
-$::beginner = /-beginner/;
-$::expert = /-expert/;
-
-my @etc_pass_fields = qw(name pw uid gid realname home shell);
-my @shells = grep { -x $_ } map { "/bin/$_" } qw(bash tcsh zsh ash ksh);
-my $isMD5 = cat_("/etc/pam.d/passwd") =~ /md5/;
-my $isShadow = cat_("/etc/pam.d/passwd") =~ /shadow/;
-
-
-my $users = [];
-my $in;
-
-if (my @l = grep { ! /^-/ } @ARGV) {
- $users = [ map { { name => $_, realname => $_ } } @l ];
-} else {
- $in = 'interactive'->vnew('su', 'user');
- any::ask_users('', $in, $users, $ENV{SECURE_LEVEL});
-}
-
-system("adduser", $_->{name}) foreach @$users;
-any::addUsers('', $users);
-
-any::write_passwd_user('', $_, $isMD5) foreach @$users;
-system("pwconv") if $isShadow;
-
-#$in->do_pkgs->install("autologin") if $o->{autologin};
-#any::set_autologin('', $o->{autologin}, $o->{desktop});
-
-$in->exit(0) if $in;
diff --git a/perl-install/standalone/diskdrake b/perl-install/standalone/diskdrake
deleted file mode 100755
index 97fca7bde..000000000
--- a/perl-install/standalone/diskdrake
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/usr/bin/perl
-
-# DiskDrake
-# Copyright (C) 1999 MandrakeSoft (pixel@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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.
-
-# DiskDrake uses resize_fat which is a perl rewrite of the work of Andrew
-# Clausen (libresize).
-# DiskDrake is also based upon the libfdisk and the install from Red Hat Software
-
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use common;
-use diskdrake::interactive;
-use interactive;
-use detect_devices;
-use fsedit;
-use fs;
-use log;
-use c;
-
-
-my %options;
-my @l = @ARGV;
-while (my $e = shift @l) {
- my ($option) = $e =~ /--?(.*)/ or next;
- if ($option eq 'embedded') {
- $::isEmbedded = 1;
- ($::XID, $::CCPID, @l) = @l;
- } elsif ($option =~ /(.*?)=(.*)/) {
- $options{$1} = $2;
- } else {
- $options{$option} = '';
- }
-}
-$::expert = defined(delete $options{expert});
-$::testing = defined(delete $options{testing});
-
-my @types = qw(hd nfs smb removable fileshare);
-my ($type, $para) = ('hd', '');
-foreach (@types) {
- if (exists $options{$_}) {
- $para = delete $options{$_};
- $type = $_;
- last;
- }
-}
-%options and die "usage: diskdrake [--expert] [--testing] [--{" . join(",", @types) . "}]\n";
-
-if ($>) {
- $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
-}
-
-
-my $in = 'interactive'->vnew('su');
-
-if ($type eq 'fileshare') {
- any::fileshare_config($in);
- $in->exit(0);
-}
-
-my $all_hds = do {
- if ($type eq 'hd') {
- catch_cdie { fsedit::hds([ detect_devices::hds() ], {}) }
- sub {
- my $err = formatError($@);
- if ($err =~ s/ask_before_blanking://) {
- $in->ask_okcancel(_("Error"),
-[_("I can't read your partition table, it's too corrupted for me :(
-I'll try to go on blanking bad partitions"), $err]);
- } else {
- $in->ask_warn('', $err);
- 1;
- }
- };
- } else { fsedit::empty_all_hds() }
-};
-
-$SIG{__DIE__} = sub { my $m = chomp_($_[0]); log::l("ERROR: $m") };
-my $fstab = [ fsedit::get_all_fstab($all_hds) ];
-
-fs::get_raw_hds('', $all_hds);
-
-fs::merge_info_from_fstab([ fsedit::get_really_all_fstab($all_hds) ]);
-fs::merge_info_from_mtab([ fsedit::get_really_all_fstab($all_hds) ]);
-
-$all_hds->{current_fstab} = fs::fstab_to_string($all_hds);
-
-if ($type eq 'hd') {
- diskdrake::interactive::main($in, $all_hds);
-} elsif ($type eq 'removable') {
- require diskdrake::removable;
- $para =~ s|^/dev/||;
- my ($raw_hd) = $para ?
- first(grep { $para eq $_->{device} } @{$all_hds->{raw_hds}}) || die "unknown removable $para\n" :
- $in->ask_from_listf('', '', \&diskdrake::interactive::format_raw_hd_info, $all_hds->{raw_hds}) or $in->exit(0);
- diskdrake::removable::main($in, $all_hds, $raw_hd);
-} else {
- $in->ask_warn('', "Sorry only a gtk frontend is available") if !$in->isa('interactive::gtk');
- require diskdrake::smbnfs_gtk;
- diskdrake::smbnfs_gtk::main($in, $all_hds, $type);
-}
-
-$in->exit(0);
diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ
deleted file mode 100755
index 496a30beb..000000000
--- a/perl-install/standalone/drakTermServ
+++ /dev/null
@@ -1,1288 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2001 by MandrakeSoft (sbenedict@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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.
-#
-# first pass at an interactive tool to help setup/maintain the Mandrake
-# Terminal Server implementation
-#
-# Requires: etherboot, mkinitrd-net, terminal-server, dhcpd-server
-# clusternfs, tftpserver
-#
-# Tasks:
-# 1) creation/management of boot images (kernel+initrd, etherboot enabled)
-# mkinitrd-net is the command line interface for this
-# 2) create/modify /etc/dhcpd.conf for diskless clients
-# 3) create/modify /etc/exports for clusternfs export of "/"
-# 4) add/remove entries in /etc/shadow$$CLIENTS$$ to allow user access
-# 5) per client XF86Config-4, using /etc/XF86Config-4$$IP-ADDRESS$$
-# 6) other per client customizations (modules.conf, keyboard, mouse)
-# 7) enable/modify /etc/xinetd.d/tftp for etherboot
-# 8) create etherboot floppies for client machines
-#
-# Thanks to the fine work of the folks involved in ltsp.org, and
-# Michael Brown <mbrown@fensystems.co.uk>
-#
-
-use Gtk;
-use lib qw(/usr/lib/libDrakX );
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use my_gtk qw(:helpers :wrappers);
-use common;
-use run_program;
-
-#use strict;
-use Config;
-use POSIX;
-
-#turn off su for now - just testing - need to run as root or sudo
-my $in = 'interactive'->vnew('su');
-
-my @buff; #- used o display status info
-
-my $central_widget;
-my $window1;
-my $windows;
-my $status_box;
-my $main_box;
-
-my $nfs_subnet;
-my $nfs_mask;
-
-my $in = 'interactive'->vnew;
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\S*) (\S*)/;
-
-if ("@ARGV" =~ /--help|-h/) {
- print q(Mandrake Terminal Server Configurator
---enable : enable MTS
---disable : disable MTS
---start : start MTS
---stop : stop MTS
---adduser : add an existing system user to MTS (requires username)
---deluser : delete an existing system user from MTS (requires username)
---addclient : add a client machine to MTS (requires MAC address, IP, nbi image name)
---delclient : delete a client machine from MTS (requires MAC address, IP, nbi image name)
-);
- exit(0);
-}
-
-if ("@ARGV" =~ /--enable/) {
- my $cmd_line = 1;
- enable_ts($cmd_line);
- exit(0);
-}
-
-if ("@ARGV" =~ /--disable/) {
- my $cmd_line = 1;
- disable_ts($cmd_line);
- exit(0);
-}
-
-if ("@ARGV" =~ /--start/) {
- my $cmd_line = 1;
- start_ts($cmd_line);
- exit(0);
-}
-
-if ("@ARGV" =~ /--stop/) {
- my $cmd_line = 1;
- stop_ts($cmd_line);
- exit(0);
-}
-
-if ("@ARGV" =~ /--adduser/) {
- die "$0 $ARGV[0] requires a username...\n" if $#ARGV<1;
- my $cmd_line = 1;
- adduser($cmd_line, $ARGV[1]);
- exit(0);
-}
-
-if ("@ARGV" =~ /--deluser/) {
- die "$0 $ARGV[0] requires a username...\n" if $#ARGV<1;
- my $cmd_line = 1;
- deluser($cmd_line, $ARGV[1]);
- exit(0);
-}
-
-if ("@ARGV" =~ /--addclient/) {
- die "$0 $ARGV[0] requires hostname, MAC address, IP, nbi-image...\n" if $#ARGV<4;
- my $cmd_line = 1;
- addclient($cmd_line, $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4]);
- exit(0);
-}
-
-if ("@ARGV" =~ /--delclient/) {
- die "$0 $ARGV[0] requires hostname...\n" if $#ARGV<1;
- my $cmd_line = 1;
- delclient($cmd_line, $ARGV[1], $ARGV[2], $ARGV[3]);
- exit(0);
-}
-
-interactive_mode() if $#ARGV<1;
-
-sub cursor_wait {
- # turn the cursor to a watch
- $window1->window->set_cursor( new Gtk::Gdk::Cursor( 150 ) );
- Gtk->main_iteration while Gtk->events_pending;
-}
-
-sub cursor_norm {
- # restore normal cursor
- $window1->window->set_cursor( new Gtk::Gdk::Cursor( 68 ) );
- Gtk->main_iteration while Gtk->events_pending;
-}
-
-sub display_error {
- my ($message) = @_;
- my $label;
- my $error_box;
- ${$central_widget}->destroy();
- gtkpack($status_box,
- $error_box = gtkpack_(new Gtk::VBox(0,0),
- 1, new Gtk::Label($message),
- 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -spread),
- gtksignal_connect(new Gtk::Button(_("OK")), clicked =>
- sub { ${$central_widget}->destroy(); create_fontsel() }),
- ),
- )
- );
- $central_widget = \$error_box;
-}
-
-sub interactive_mode {
- my $font_sel;
-# $interactive = 1;
- init Gtk;
- $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
- $window1->signal_connect (delete_event => sub { Gtk->exit(0) });
- $window1->set_position(1);
- $window1->set_title(_("Mandrake Terminal Server Configuration"));
- $window1->set_border_width(5);
- my ($pix_user_map, $pix_user_mask) = gtkcreate_png("ic82-network-40");
- my ($pix_u_map, $pix_u_mask) = gtkcreate_png("drakTS.620x57");
-
- gtkadd($window1,
- gtkpack_(new Gtk::VBox(0,2),
- if_(!$::isEmbedded, 0, new Gtk::Pixmap($pix_u_map, $pix_u_mask)),
- 1, gtkpack_(new Gtk::HBox(0,2),
- 1, gtkpack_(new Gtk::VBox(0,2),
- 1, gtkpack ($status_box = new Gtk::VBox(0,5),
- $main_box = new Gtk::VBox(0,10),
- ),
- 1, gtkpack_(new Gtk::HBox(0,2),
- 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("Enable Server")), clicked =>
- sub { ${$central_widget}->destroy();
- $windows = 1;
- cursor_wait();
- enable_ts();
- cursor_norm();
- }),
- gtksignal_connect(new Gtk::Button(_("Disable Server")), clicked =>
- sub { ${$central_widget}->destroy();
- cursor_wait();
- disable_ts();
- cursor_norm();
- }),
- ),
- 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("Start Server")), clicked =>
- sub { ${$central_widget}->destroy();
- $windows = 0;
- cursor_wait();
- start_ts();
- cursor_norm();
- }),
- gtksignal_connect(new Gtk::Button(_("Stop Server")), clicked =>
- sub { ${$central_widget}->destroy();
- cursor_wait();
- stop_ts();
- cursor_norm();
- }),
- ),
- 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("Etherboot Floppy/ISO")), clicked =>
- sub { ${$central_widget}->destroy(); $windows = 1; make_boot();}),
- gtksignal_connect(new Gtk::Button(_("Net Boot Images")), clicked =>
- sub { ${$central_widget}->destroy(); make_nbi() }),
- ),
- 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("Add/Del Users")), clicked =>
- sub { ${$central_widget}->destroy(); $windows = 0; maintain_users();}),
- gtksignal_connect(new Gtk::Button(_("Add/Del Clients")), clicked =>
- sub { ${$central_widget}->destroy(); maintain_clients()}),
- ),
- 1, new Gtk::HBox(0,2),
- 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("Help")),clicked =>
- sub { ${$central_widget}->destroy(); help() }),
- gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub {
- $::isEmbedded and kill USR1, $::CCPID;
- Gtk->main_quit() }),
- ),
- ),
- ),
- ),
- ),
- );
- $central_widget = \$main_box;
- $window1->show_all;
- $window1->realize;
- $window1->show_all();
-
- Gtk->main_iteration while Gtk->events_pending;
- $::isEmbedded and kill USR2, $::CCPID;
- Gtk->main;
- Gtk->exit(0);
-}
-
-sub about {
- my $text = new Gtk::Text(undef, undef);
- my $about_box;
- gtkpack($status_box,
- $about_box = gtkpack_(new Gtk::VBox(0,10),
- 1, gtkpack_(new Gtk::HBox(0,0),
- 1, gtktext_insert(gtkset_editable($text, 1), "
- Copyright (C) 2002 by MandrakeSoft
- Stew Benedict sbenedict\@mandrakesoft.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
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- 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.
-
- Thanks:
- - LTSP Project http://www.ltsp.org
- - Michael Brown <mbrown\@fensystems.co.uk>
-
-"),
- 0, new Gtk::VScrollbar($text->vadj),
- ),
- 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -spread),
- gtksignal_connect(new Gtk::Button(_("OK")), clicked =>
- sub { ${$central_widget}->destroy(); create_fontsel() }),
- ),
- )
- );
- $central_widget = \$about_box;
- $status_box->show_all();
-}
-
-sub help {
- my $text = new Gtk::Text(undef, undef);
- my $help_box;
- gtkpack($status_box,
- $help_box = gtkpack_(new Gtk::VBox(0,10),
- 1, gtkpack_(new Gtk::HBox(0,0),
- 1, gtktext_insert(gtkset_editable($text, 1), "drakTermServ Overview
-
- - Create Etherboot Enabled Boot Images:
- To boot a kernel via etherboot, a special kernel/initrdrd image must be created.
- mkinitrd-net does much of this work and drakTermServ is just a graphical interface
- to help manage/customize these images.
-
- - Maintain /etc/dhcpd.conf:
- To net boot clients, each client needs a dhcpd.conf entry, assigning an IP address
- and net boot images to the machine. drakTermServ helps create/remove these entries.
-
- A typical dhcpd.conf stanza to support a diskless client looks like:
-
- host curly {
- hardware ethernet 00:20:af:2f:f7:9d;
- fixed-address 192.168.192.3;
- filename \"i386/boot/boot-3c509.2.4.18-6mdk.nbi\";
- }
-
- While you can use a pool of IP addresses, rather than setup a specific entry for
- a client machine, using a fixed address scheme facilitates using the functionality
- of client-specific configuration files that ClusterNFS provides.
-
- Note: You must stop/start the server after adding or changing clients/
-
- - Maintain /etc/exports:
- Clusternfs allows export of the root filesystem to diskless clients. drakTermServ
- sets up the correct entry to allow anonymous access to the root filesystem from
- diskless clients.
-
- A typical exports entry for clusternfs is:
-
- / (ro,all_squash)
-
- - Maintain /etc/shadow\$\$CLIENT\$\$:
- For users to be able to log into the system from a diskless client, their entry in
- /etc/shadow needs to be duplicated in /etc/shadow\$\$CLIENTS\$\$. drakTermServ helps
- in this respect by adding or removing system users from this file.
-
- - Per client /etc/X11XF86Config-4\$\$IP-ADDRESS\$\$:
- Through clusternfs, each diskless client can have it's own unique configuration files
- on the root filesystem of the server. In the future drakTermServ will help create these
- files.
-
- - Per client system configuration files:
- Through clusternfs, each diskless client cand have it's own unique configuration files
- on the root filesystem of the server. In the future, drakTermServ can help create files
- such as /etc/modules.conf, /etc/sysconfig/mouse, /etc/sysconfig/keyboard on a per-client
- basis.
-
- - /etc/xinetd.d/tftp:
- drakTermServ will configure this file to work in conjunction with the images created 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:
-
- service tftp
- (
- disable = no
- socket_type = dgram
- protocol = udp
- wait = yes
- user = root
- server = /usr/sbin/in.tftpd
- server_args = -s /var/lib/tftpboot
- }
-
- The changes here from the default installation are changing the disable flag to
- 'no' and changing the directory path to /var/lib/tftpboot, where mkinitrd-net
- puts it's images.
-
- - 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 images,
- based on the NIC in the client machine.
-
- A basic example of creating a boot floppy for a 3Com 3c509 manually:
-
- cat /usr/lib/etherboot/boot1a.bin /\
- /usr/lib/etherboot/lzrom/3c509.lzrom > /dev/fd0
-
-
-"),
- 0, new Gtk::VScrollbar($text->vadj),
- ),
- 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -spread),
- gtksignal_connect(new Gtk::Button(_("OK")), clicked =>
- sub { ${$central_widget}->destroy(); }),
- ),
- )
- );
- $central_widget = \$help_box;
- $status_box->show_all();
-}
-
-sub make_boot {
- #- make a boot image on floppy or iso from etherboot images
- my $boot_box;
- my $rom_path = "/usr/lib/etherboot";
- my @nics = all("/usr/lib/etherboot/lzrom");
- my $list_nics = new Gtk::List();
- my $nic;
-
- foreach (@nics) {
- my $t = $_;
- $list_nics->add(gtkshow(gtksignal_connect(new Gtk::ListItem($t),
- select => sub { $nic = $t; })));
- }
- $list_nics->set_selection_mode('single');
-
- gtkpack($status_box,
- $boot_box = gtkpack_(new Gtk::VBox(0,10),
- 0, gtkadd(new Gtk::HBox(0,10),
- new Gtk::HBox(0,5),
- createScrolledWindow($list_nics),
- gtkadd(new Gtk::VBox(1,10),
- new Gtk::HBox(0,20),
- gtksignal_connect(new Gtk::Button(_("Boot Floppy")), clicked =>
- sub {write_eb_image($nic, $rom_path, "floppy"); }),
- gtksignal_connect(new Gtk::Button(_("Boot ISO")), clicked =>
- sub {write_eb_image($nic, $rom_path, "iso"); }),
- new Gtk::HBox(0,20),
- ),
- new Gtk::HBox(0,5),
- ),
- ),
- );
-
- $central_widget = \$boot_box;
- $boot_box->show_all();
-}
-
-sub make_nbi {
- my $nbi_box;
- my @kernels = grep(/vmlinuz/, all("/boot"));
- my $kernel;
- my $nic;
-
- #- just a static list for the moment
- #- method in mknbi-net is much better
- my @nics = ("3c509", "3c59x", "3c90x", "8139cp", "8139too", "acenic", "airo",
- "aironet4500_card","bcm5700", "dgrs", "dl2k", "dmfe", "e100",
- "e1000", "eepro100", "epic100", "fealnx", "hamachi", "hp100",
- "hysdn", "natsemi", "natsemi_old", "ne", "ne2k-pci", "ns83820",
- "pcnet32", "prism2_pci", "prism2_plx", "rcpci", "sis900",
- "starfire", "sundance", "sungem", "sunhme", "tlan", "tulip-old",
- "via-rhine", "winbond-840", "xircom_cb", "xircom_tulip_cb", "yellowfin");
-
- #- kernel/module info in tree view
- my $tree_kernels = new Gtk::Tree();
-
- foreach (@kernels){
- my $t = $_;
- my $t_kernel= new_with_label Gtk::TreeItem($t);
- gtksignal_connect($t_kernel, select => sub { $kernel = $t;
- $nic = ''; });
- $tree_kernels->append($t_kernel);
-
- my $k_detail = new Gtk::Tree();
- $t_kernel->set_subtree($k_detail);
-
- foreach (@nics) {
- my $m = $_;
- my $k_det_nic = new_with_label Gtk::TreeItem($m);
- gtksignal_connect($k_det_nic, select => sub { $nic = $m;
- $kernel = $t; });
- $k_detail->append($k_det_nic);
- $k_det_nic->show();
- }
- }
-
- # existing nbi images in list
- my $list_nbis = new Gtk::List();
- my @nbis = grep(/\.nbi/, all("/var/lib/tftpboot"));
- my $nbi;
-
- foreach (@nbis) {
- my $t = $_;
- $list_nbis->add(gtkshow(gtksignal_connect(new Gtk::ListItem($t),
- select => sub { $nbi = $t; })));
- }
- $list_nbis->set_selection_mode('single');
-
- gtkpack($status_box,
- $nbi_box = gtkpack_(new Gtk::VBox(1,10),
- 0, gtkadd(new Gtk::HBox(0,10),
- createScrolledWindow($tree_kernels),
- gtkadd(new Gtk::VBox(1,10),
- gtksignal_connect(new Gtk::Button(_("Build Whole Kernel -->")), clicked =>
- sub { if ($kernel) {
- $in->ask_warn('',_("This will take a few minutes."));
- cursor_wait();
- system("/usr/bin/mknbi-set -k /boot/$kernel");
- $list_nbis->clear_items();
- @nbis = grep(/\.nbi/, all("/var/lib/tftpboot"));
- foreach (@nbis) {
- my $t = $_;
- $list_nbis->add(gtkshow(gtksignal_connect(new Gtk::ListItem($t),
- select => sub { $nbi = $t; })));
- }
- cursor_norm();
- } else {
- $in->ask_warn('',_("No kernel selected!")) if !($kernel);
- }
- }),
- gtksignal_connect(new Gtk::Button(_("Build Single NIC -->")), clicked =>
- sub { if ($nic) {
- system("/usr/bin/mknbi-set -k /boot/$kernel -r $nic");
- $list_nbis->clear_items();
- @nbis = grep(/\.nbi/, all("/var/lib/tftpboot"));
- foreach (@nbis) {
- my $t = $_;
- $list_nbis->add(gtkshow(gtksignal_connect(new Gtk::ListItem($t),
- select => sub { $nbi = $t; })));
- }
- } else {
- $in->ask_warn('',_("No nic selected!"));
- }
- }),
- gtksignal_connect(new Gtk::Button(_("Build All Kernels -->")), clicked =>
- sub { $in->ask_warn('',_("This will take a few minutes."));
- cursor_wait();
- system("/usr/bin/mknbi-set");
- $list_nbis->clear_items();
- @nbis = grep(/\.nbi/, all("/var/lib/tftpboot"));
- foreach (@nbis) {
- my $t = $_;
- $list_nbis->add(gtkshow(gtksignal_connect(new Gtk::ListItem($t),
- select => sub { $nbi = $t; })));
- }
- cursor_norm();
- }),
- new Gtk::HBox(1,1),
- gtksignal_connect(new Gtk::Button(_("<-- Delete")), clicked =>
- sub { my $nbi = "/var/lib/tftpboot/" . $nbi;
- my $result = unlink("$nbi") || warn("Can't delete $nbi...");
- if ($result eq 1) {
- $list_nbis->remove_items($list_nbis->selection);
- }
- }),
- gtksignal_connect(new Gtk::Button(_("Delete All NBIs")), clicked =>
- sub { cursor_wait();
- foreach (grep(/\.nbi/, all("/var/lib/tftpboot"))) {
- my $nbi = "/var/lib/tftpboot/" . $_;
- my $result = unlink("$nbi") || warn("Can't delete $nbi...");
- #- wanted to walk through these and delete
- #- but can't figure out how to get the item from
- #- the label :(
- }
- $list_nbis->clear_items();
- cursor_norm();
- }),
- new Gtk::HBox(1,1),
- ),
- createScrolledWindow($list_nbis),
- ),),
- );
-
- $central_widget = \$nbi_box;
- $nbi_box->show_all();
-}
-
-sub maintain_users {
- #- copy users from /etc/shadow to /etc/shadow$$CLIENT$$ to allow ts login
- my $user_box;
- my @sys_users = cat_("/etc/shadow");
- my @ts_users = cat_("/etc/shadow\$\$CLIENT\$\$");
-
- #- use /homes to filter system daemons
- my @homes = all("/home");
-
- my $list_sys_users = new Gtk::List();
- my $sys_user;
-
- foreach (@sys_users) {
- my ($s_label, $dummy) = split(/:/, $_, 2);
- if (grep(/$s_label/, @homes)) {
- $list_sys_users->add(gtkshow(gtksignal_connect(new Gtk::ListItem($s_label),
- select => sub { $sys_user = $s_label; })));
- }
- }
- $list_sys_users->set_selection_mode('single');
-
- my $list_ts_users = new Gtk::List();
- my $ts_user;
-
- foreach (@ts_users) {
- my ($t_label, $dummy) = split(/:/, $_, 2);
- my @system_entry = grep(/$t_label/, @sys_users);
- $t_label = $t_label . " !!!" if ($_ ne $system_entry[0]);
- $list_ts_users->add(gtkshow(gtksignal_connect(new Gtk::ListItem($t_label),
- select => sub { $ts_user = $t_label; })));
- }
- $list_ts_users->set_selection_mode('single');
-
- gtkpack($status_box,
- $user_box = gtkpack_(new Gtk::VBox(0,10),
- 0, gtkadd(new Gtk::Label( "!!! 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 Gtk::HBox(0,20),
- createScrolledWindow($list_sys_users),
- gtkadd(new Gtk::VBox(1,10),
- new Gtk::HBox(0,10),
- gtksignal_connect(new Gtk::Button(_("Add User -->")), clicked =>
- sub { my $result = adduser(0, $sys_user);
- if ($result eq 0) {
- $list_ts_users->add(gtkshow(gtksignal_connect(new Gtk::ListItem($sys_user),
- select => sub { $ts_user = $sys_user;
- $list_ts_users->show(); })));
- }
- }),
- gtksignal_connect(new Gtk::Button(_("<-- Del User")), clicked =>
- sub { deluser(0, $ts_user);
- $list_ts_users->remove_items($list_ts_users->selection);
- }),
- new Gtk::HBox(0,10),
- ),
- createScrolledWindow($list_ts_users),
- ),),
- );
-
- $central_widget = \$user_box;
- $user_box->show_all();
-}
-
-sub maintain_clients {
- #- add client machines to Terminal Server config
- my $client_box;
- my %clients = read_dhcpd_conf();
- my $client;
-
- #- client info in tree view
- my $tree_clients = new Gtk::Tree();
- foreach my $key(keys(%clients)){
- my $t = $key;
- my $t_client= new_with_label Gtk::TreeItem($t);
- gtksignal_connect($t_client, select => sub { $client = $t; });
- $tree_clients->append($t_client);
-
- my $c_detail = new Gtk::Tree();
- $t_client->set_subtree($c_detail);
-
- my $c_det_hw = new_with_label Gtk::TreeItem($clients{$key}->{hardware});
- $c_detail->append($c_det_hw);
- $c_det_hw->show();
-
- my $c_det_ip = new_with_label Gtk::TreeItem($clients{$key}->{address});
- $c_detail->append($c_det_ip);
- $c_det_ip->show();
-
- my $c_det_nbi = new_with_label Gtk::TreeItem($clients{$key}->{filename});
- $c_detail->append($c_det_nbi);
- $c_det_nbi->show();
- }
- $tree_clients->set_selection_mode('single');
-
- #- entry boxes for client data entry
- my $label_host = new Gtk::Label("Client Name:");
- $label_host->set_justify(left);
- my $entry_host = new Gtk::Entry(20);
- my $label_mac = new Gtk::Label("MAC Address:");
- $label_mac->set_justify(left);
- my $entry_mac = new Gtk::Entry(20);
- my $label_ip = new Gtk::Label("IP Address:");
- $label_ip->set_justify(left);
- my $entry_ip = new Gtk::Entry(20);
- my $label_nbi = new Gtk::Label("Kernel Netboot Image:");
- $label_nbi->set_justify(left);
- my $entry_nbi = new Gtk::Combo();
-
- my @images = grep(/\.nbi/, all("/var/lib/tftpboot/"));
- $entry_nbi->set_popdown_strings(@images);
- $entry_nbi->set_value_in_list(1, 0);
-
- gtkpack($status_box,
- my $client_box = gtkpack_(new Gtk::VBox(1,10),
- 0, gtkadd(new Gtk::HBox(0,10),
- gtkadd(new Gtk::VBox(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(new Gtk::VBox(1,10),
- new Gtk::HBox(1,1),
- gtksignal_connect(new Gtk::Button(_("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 ne '' && $mac ne '' && $ip ne '' && $nbi ne '') {
-
- my $result = addclient(0, $hostname, $mac, $ip, $nbi);
-
- if ( $result eq 0 ) {
- my $t_client= new_with_label Gtk::TreeItem($hostname);
- gtksignal_connect($t_client, select => sub { $client = $hostname; });
- $tree_clients->append($t_client);
-
- my $c_detail = new Gtk::Tree();
- $t_client->set_subtree($c_detail);
-
- my $c_det_hw = new_with_label Gtk::TreeItem($mac);
- $c_detail->append($c_det_hw);
- $c_det_hw->show();
-
- my $c_det_ip = new_with_label Gtk::TreeItem($ip);
- $c_detail->append($c_det_ip);
- $c_det_ip->show();
-
- my $c_det_nbi = new_with_label Gtk::TreeItem($nbi);
- $c_detail->append($c_det_nbi);
- $c_det_nbi->show();
- $t_client->show();
- }
- }
- }),
- gtksignal_connect(new Gtk::Button(_("<-- Del Client")), clicked =>
- sub { my $result = delclient(0, $client);
- if ( $result eq 0 ) {
- $tree_clients->remove_items($tree_clients->selection);
- }
- }),
- gtksignal_connect(new Gtk::Button(_("dhcpd Config...")), clicked =>
- sub { ${$central_widget}->destroy(); dhcpd_config(); }),
- new Gtk::HBox(1,1),
- ),
- createScrolledWindow($tree_clients),
- ),),
- );
-
- $central_widget = \$client_box;
- $client_box->show_all();
-}
-
-sub dhcpd_config {
- #- do main dhcp server config
- my $dhcpd_box;
- my @netmask = ();
- my @broadcast = ();
- my @netconfig = ();
- my @ifconfig = ();
- my @ifvalues = ();
- my @resolve = ();
- my @nserve = ();
- my %netconfig;
- my @subnet = ();
- my @nservers = ();
-
- #- entry boxes for data entry
- my $box_subnet = new Gtk::HBox(0,0);
- my $label_subnet = new Gtk::Label("Subnet:");
- $label_subnet->set_justify(right);
- my $entry_subnet = new Gtk::Entry(20);
- $box_subnet->pack_end($entry_subnet, 0, 0, 10);
- $box_subnet->pack_end($label_subnet, 0, 0, 10);
-
- my $box_netmask = new Gtk::HBox(0,0);
- my $label_netmask = new Gtk::Label("Netmask:");
- $label_netmask->set_justify(left);
- my $entry_netmask = new Gtk::Entry(20);
- $box_netmask->pack_end($entry_netmask, 0, 0, 10);
- $box_netmask->pack_end($label_netmask, 0, 0, 10);
-
- my $box_routers = new Gtk::HBox(0,0);
- my $label_routers = new Gtk::Label("Routers:");
- $label_routers->set_justify(left);
- my $entry_routers = new Gtk::Entry(20);
- $box_routers->pack_end($entry_routers, 0, 0, 10);
- $box_routers->pack_end($label_routers, 0, 0, 10);
-
- my $box_subnet_mask = new Gtk::HBox(0,0);
- my $label_subnet_mask = new Gtk::Label("Subnet Mask:");
- $label_subnet_mask->set_justify(left);
- my $entry_subnet_mask = new Gtk::Entry();
- $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 Gtk::HBox(0,0);
- my $label_broadcast = new Gtk::Label("Broadcast Address:");
- $label_broadcast->set_justify(left);
- my $entry_broadcast = new Gtk::Entry(20);
- $box_broadcast->pack_end($entry_broadcast, 0, 0, 10);
- $box_broadcast->pack_end($label_broadcast, 0, 0, 10);
-
- my $box_domain = new Gtk::HBox(0,0);
- my $label_domain = new Gtk::Label("Domain Name:");
- $label_domain->set_justify(left);
- my $entry_domain = new Gtk::Entry(20);
- $box_domain->pack_end($entry_domain, 0, 0, 10);
- $box_domain->pack_end($label_domain, 0, 0, 10);
-
- my $box_name_servers = new Gtk::HBox(0,0);
- my $box_name_servers_entry = new Gtk::VBox(0,0);
- my $label_name_servers = new Gtk::Label("Name Servers:");
- $label_name_servers->set_justify(left);
- my $entry_name_server1 = new Gtk::Entry();
- my $entry_name_server2 = new Gtk::Entry();
- my $entry_name_server3 = new Gtk::Entry();
- $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);
-
- #- grab some default entries from the running system
-
- if ( -e "/etc/sysconfig/network") {
- %netconfig = getVarsFromSh("/etc/sysconfig/network");
- $entry_domain->set_text($netconfig{DOMAINNAME});
- }
-
- if ( -e "/etc/sysconfig/network-scripts/ifcfg-eth0") {
- %netconfig = getVarsFromSh("/etc/sysconfig/network-scripts/ifcfg-eth0");
- $entry_netmask->set_text($netconfig{NETMASK});
- $entry_subnet_mask->set_text($netconfig{NETMASK});
-
- }
-
- @ifconfig = grep(/inet/, `/sbin/ifconfig eth0`);
- @ifvalues = split(/[: \t]+/, $ifconfig[0]);
- $entry_broadcast->set_text($ifvalues[5]);
-
- @broadcast = split(/\./, $ifvalues[5]);
- @netmask = split(/\./, $netconfig{NETMASK});
-
- foreach (0..3) {
- #- wasn't evaluating the & as expected
- my $val1= $broadcast[$_] + 0;
- my $val2 = $netmask[$_] + 0;
- $subnet[$_] = $val1 & $val2;
- }
-
- $entry_subnet->set_text(join(".", @subnet));
-
- my @route = grep(/^0.0.0.0/, `/sbin/route -n`);
- @ifvalues = split(/[ \t]+/, $route[0]);
- $entry_routers->set_text($ifvalues[1]);
-
- @resolve = cat_("/etc/resolv.conf");
- my $i = 1;
- chop(@resolve);
-
- foreach (@resolve) {
- @ifvalues = split(/ /, $_);
- if (($ifvalues[0] =~ /nameserver/) && ($i lt 4)){
- $nservers[$i] = $ifvalues[1]; $i++;
- }
- }
-
- $entry_name_server1->set_text($nservers[1]);
- $entry_name_server2->set_text($nservers[2]);
- $entry_name_server3->set_text($nservers[3]);
-
- gtkpack($status_box,
- $dhcpd_box = gtkpack_(new Gtk::HBox(1,10),
- 0, gtkadd((new Gtk::VBox),
- gtkadd($box_subnet),
- gtkadd($box_netmask),
- gtkadd($box_routers),
- gtkadd($box_subnet_mask),
- gtkadd($box_broadcast),
- gtkadd($box_domain),
- gtkadd($box_name_servers),
- ),
- 0, gtkadd(new Gtk::VBox(0,0),
- new Gtk::Label("dhcpd Server Configuration\n\n
- Most of these values were extracted
- from your running system. You can
- modify as needed."),
- gtksignal_connect(new Gtk::Button(_("Write Config")), clicked =>
- sub { write_dhcpd_config(
- $entry_subnet->get_text(),
- $entry_netmask->get_text(),
- $entry_routers->get_text(),
- $entry_subnet_mask->get_text(),
- $entry_broadcast->get_text(),
- $entry_domain->get_text(),
- $entry_name_server1->get_text(),
- $entry_name_server2->get_text(),
- $entry_name_server3->get_text()
- );}),
- new Gtk::HBox(0,10),
- ),
- ),
- );
-
- $central_widget = \$dhcpd_box;
- $dhcpd_box->show_all();
-}
-
-sub write_dhcpd_config {
- my( $subnet, $netmask, $routers, $subnet_mask, $broadcast, $domain, $ns1, $ns2, $ns3) = @_;
-
- $nfs_subnet = $subnet;
- $nfs_mask = $subnet_mask;
-
- open(FHANDLE, "> /etc/dhcpd.conf");
- print FHANDLE "#dhcpd.conf - generated by drakTermServ\n\n";
- print FHANDLE "ddns-update-style none;\n\n";
- print FHANDLE "# Long leases (48 hours)\ndefault-lease-time 172800;\nmax-lease-time 172800;\n\n";
- print FHANDLE "# Include Etherboot definitions and defaults\ninclude \"/etc/dhcpd.conf.etherboot.include\";\n\n";
- print FHANDLE "# Network-specific section\n\n";
-
- print FHANDLE "subnet $subnet netmask $netmask {\n";
- print FHANDLE "\toption routers $routers;\n" if $routers;
- print FHANDLE "\toption subnet-mask $subnet_mask;\n" if $subnet_mask;
- print FHANDLE "\toption broadcast-address $broadcast;\n" if $broadcast;
- print FHANDLE "\toption domain-name \"$domain\";\n" if $domain;
-
- my $ns_string = "\toption domain-name-servers " . $ns1 if $ns1;
- $ns_string = $ns_string . ", " . $ns2 if $ns2;
- $ns_string = $ns_string . ", " . $ns3 if $ns3;
- $ns_string = $ns_string . ";\n" if $ns_string;
- print FHANDLE $ns_string if $ns_string;
-
- print FHANDLE "}\n\n";
-
- print FHANDLE "# Include client machine configurations\ninclude \"/etc/dhcpd.conf.etherboot.clients\";\n";
- close FHANDLE
-}
-
-sub write_eb_image {
- #- write a bootable etherboot CD image or floppy
- my ($nic, $rom_path, $type) = @_;
- if ($type eq 'floppy') {
- my $in = interactive->vnew;
- if ( -e "/dev/fd0" ) {
- my $result = $in->ask_okcancel(_("Please insert floppy disk:"));
- return if !($result);
- $result = system("cat $rom_path/boot1a.bin $rom_path/lzrom/$nic > /dev/fd0") if $result;
- if ($result) {
- $in->ask_warn('',_("Couldn't access the floppy!"))
- } else {
- $in->ask_warn('',_("Floppy can be removed now"))
- }
- } else {
- $in->ask_warn('',_("No floppy drive available!"));
- }
- } else {
- mkdir_p("/tmp/eb");
- system("cat $rom_path/boot1a.bin $rom_path/lzrom/$nic > /tmp/eb/eb.img");
- system("dd if=/dev/zero of=/tmp/eb/eb.img bs=512 seek=72 count=2808");
- system("mkisofs -b eb.img -o /tmp/$nic.iso /tmp/eb");
- rm_rf("/tmp/eb");
- if ( -e "/tmp/eb.iso" ) {
- $in->ask_warn('',_("Etherboot ISO image is %s", "/tmp/$nic.iso"))
- } else {
- $in->ask_warn('',_("Something went wrong!"))
- }
- }
-}
-
-sub enable_ts {
- #- setup default config files for terminal server
-
- my $cmd_line = @_;
-
- @buff = ();
- $buff[0] = "Enabling Terminal Server...\n\n";
- $buff[1] = "\tChecking default /etc/dhcpd.conf...\n";
- my @my_conf = cat_("/etc/dhcpd.conf");
- if ($my_conf[0] !~ /drakTermServ/) {
- if ($cmd_line eq 1) {
- print("No /etc/dhcpd.conf built yet - use GUI to create!!\n");
- return;
- } else {
- $in->ask_warn('',_("Need to create /etc/dhcpd.conf first!"));
- #$central_widget->destroy;
- dhcpd_config();
- return;
- }
- }
- my $buff_index = toggle_chkconfig("on", "dhcpd", 2);
- $buff[$buff_index] = "\tSetting up default /etc/exports...\n";
- cp_af("/etc/exports", "/etc/exports.mdkTS");
- open(FHANDLE, "> /etc/exports");
- print FHANDLE "#/etc/exports - generated by drakTermServ\n\n";
- print FHANDLE "/\t(ro,all_squash)\n";
- print FHANDLE "/home\t$nfs_subnet/$nfs_mask(rw,root_squash)\n";
- close FHANDLE;
- $buff_index = toggle_chkconfig("on", "clusternfs", $buff_index+1);
- $buff_index = toggle_chkconfig("on", "tftp", $buff_index);
- $buff_index = service_change("xinetd", "restart", $buff_index);
- $buff[$buff_index] = "\n\tDone!";
-
- if ($cmd_line == 1){
- print "@buff\n";
- return;
- }
-
- show_status(@buff);
-}
-
-sub disable_ts {
- #- restore pre-terminal server configs
- my $cmd_line = @_;
-
- @buff = ();
- $buff[0] = "Disabling Terminal Server...\n\n";
- $buff[1] = "\tRestoring original /etc/dhcpd.conf...\n";
- cp_af("/etc/dhcpd.conf.mdkTS", "/etc/dhcpd.conf");
- my $buff_index = toggle_chkconfig("off", "dhcpd", 2);
- $buff[$buff_index] = "\tRestoring default /etc/exports...\n";
- cp_af("/etc/exports.mdkTS", "/etc/exports");
- $buff_index = toggle_chkconfig("off", "clusternfs", $buff_index+1);
- $buff_index = toggle_chkconfig("off", "tftp", $buff_index);
- $buff_index = service_change("xinetd", "restart", $buff_index);
- $buff[$buff_index] = "\n\tDone!";
-
- if ($cmd_line == 1){
- print "@buff\n";
- return;
- }
-
- show_status(@buff);
-}
-
-sub toggle_chkconfig {
- #- change service config
- my ($state, $service, $buff_index) = @_;
- system("/sbin/chkconfig $service $state");
- $buff[$buff_index] = "\tTurning $service $state...\n";
- $buff_index++;
- $buff_index;
-}
-
-sub service_change {
- my ($service, $command, $buff_index) = @_;
- system("/sbin/service $service $command > /tmp/drakTSservice.status 2>&1");
- open(STATUS, "/tmp/drakTSservice.status");
- while(<STATUS>) {
- my ($phrase, $result) = split(':',$_);
- $result = "[ OK ]" if ($result =~ /OK/);
- $result = "[ FAIL ]" if ($result =~ /FAIL/);
- $buff[$buff_index] = "\t$phrase:\t\t\t" . $result . "\n";
- $buff_index++;
- }
- close STATUS;
- unlink "/tmp/drakTSservice.status" or warn("Can't delete /tmp/drakTSservice.status\n");
- $buff_index;
-}
-
-sub start_ts {
- #- start the terminal server
- my $cmd_line = @_;
-
- @buff = ();
- $buff[0] = "Starting Terminal Server...\n\n";
- my $buff_index = service_change("dhcpd", "start", 2);
- $buff_index = service_change("clusternfs", "start", $buff_index);
- $buff[$buff_index] = "\n\tDone!";
-
- if ($cmd_line == 1){
- print "@buff\n";
- return;
- }
-
- show_status(@buff);
-}
-
-sub stop_ts {
- #- stop the terminal server
- my $cmd_line = @_;
-
- @buff = ();
- $buff[0] = "Stopping Terminal Server...\n\n";
- my $buff_index = service_change("dhcpd", "stop", 2);
- $buff_index = service_change("clusternfs", "stop", $buff_index);
- $buff[$buff_index] = "\n\tDone!";
-
- if ($cmd_line == 1){
- print "@buff\n";
- return;
- }
-
- show_status(@buff);
-
-}
-
-sub show_status {
- #- just a generic routine to display an array of text in the GUI screen
- my @buff = @_;
-
- my $text = new Gtk::Text(undef, undef);
- my $status_t_box;
- gtkpack($status_box,
- $status_t_box = gtkpack_(new Gtk::VBox(0,10),
- 1, gtkpack_(new Gtk::HBox(0,0),
- 1, gtktext_insert(gtkset_editable($text, 1), "@buff"),
- ),
- ),
- );
-
- $central_widget = \$status_t_box;
- $status_box->show_all();
-}
-
-sub adduser {
- my ($cmd_line, $username) = @_;
- my @active_users = cat_("/etc/shadow");
- my @ts_users = cat_("/etc/shadow\$\$CLIENT\$\$");
- my $is_user = grep(/$username/, @active_users);
- my $add_fail = 0;
- my $in_already;
-
- if ($is_user) {
- my @shadow_entry = grep(/$username/, @active_users);
- my $is_ts_user = grep(/$username/, @ts_users);
- if ($is_ts_user) {
- my @ts_shadow = grep(/$username/, @ts_users);
- if ($shadow_entry[0] eq $ts_shadow[0]) {
- $in_already = 1;
- } else {
- #in but password changed
- print "$username passwd bad in Terminal Server - rewriting...\n";
- deluser($cmd_line, $username);
- adduser($cmd_line, $username);
- }
- } else {
- # new ts user
- open(FHANDLE, ">> /etc/shadow\$\$CLIENT\$\$");
- print FHANDLE "$shadow_entry[0]" or $add_fail = 1;
- close FHANDLE;
- $in_already = 0;
- }
- }
-
- if ($cmd_line == 1){
- print "$username is not a user..\n" if !($is_user);
- print "$username is already a Terminal Server user\n" if $in_already;
- if ($add_fail== 1 || $in_already || !$is_user) {
- print "Addition of $username to Terminal Server failed!\n";
- } else {
- print "$username added to Terminal Server\n";
- }
- return;
- } else {
- $in_already;
- }
-}
-
-sub deluser {
- # del a user from the shadow$$CLIENT$$ file
- my ($cmd_line, $username) = @_;
- my $i;
- my $user;
- my $user_deleted;
-
- my @ts_users = cat_("/etc/shadow\$\$CLIENT\$\$");
- my $is_ts_user = grep(/$username/, @ts_users);
-
- if ($is_ts_user) {
- $i = 0;
- foreach $user (@ts_users) {
- if ($user =~ /$username/) {
- splice (@ts_users, $i, 1);
- $user_deleted = 1;
- break;
- }
- $i++;
- }
- open(FHANDLE, "> /etc/shadow\$\$CLIENT\$\$");
- foreach $user (@ts_users) {
- print FHANDLE "$user";
- }
- close FHANDLE;
- }
-
- if ($cmd_line == 1){
- if ($user_deleted) {
- print "Deleted $username...\n";
- } else {
- print "$username not found...\n";
- }
- return;
- }
-}
-
-sub addclient {
- #- add a new client entry after checking for dups
- my ($cmd_line, $hostname, $mac, $ip, $nbi) = @_;
-
- my $host_in_use = 0;
- my $mac_in_use = 0;
- my $ip_in_use = 0;
- my $client;
-
- my %ts_clients = read_dhcpd_conf();
-
- foreach $client(keys(%ts_clients)){
- $host_in_use = 1 if ($hostname eq $client);
- $mac_in_use = 1 if ($mac eq $ts_clients{$client}->{hardware});
- $ip_in_use = 1 if ($ip eq $ts_clients{$client}->{address});
- }
-
- if ($cmd_line == 1){
- print "$hostname already in use\n" if $host_in_use;
- print "$mac already in use\n" if $mac_in_use;
- print "$ip already in use\n" if $ip_in_use;
- if ($host_in_use || $mac_in_use || $ip_in_use) {
- return;
- }
- }
-
- if (!$host_in_use && !$mac_in_use && !$ip_in_use) {
- $ts_clients{$hostname}->{hardware} = $mac;
- $ts_clients{$hostname}->{address} = $ip;
- $ts_clients{$hostname}->{filename} = $nbi;
-
- my $clients = "/etc/dhcpd.conf.etherboot.clients";
- open(CLIENT, ">> $clients") || warn ("Can't open $clients!");
- print_client_entry("CLIENT", $hostname, %ts_clients);
- close CLIENT;
- 0;
- }
-}
-
-sub delclient {
- #- find a client and delete the entry in dhcpd.conf
- my ($cmd_line, $hostname) = @_;
- my $client;
- my $host_found;
-
- my %ts_clients = read_dhcpd_conf();
-
- foreach $client(keys(%ts_clients)){
- if ($hostname eq $client) {
- $host_found = 1;
- delete $ts_clients{$client};
- write_dhcpd_conf(%ts_clients);
- return 0;
- }
- }
-
- if ($cmd_line == 1){
- print "$hostname not found...\n" if (!$host_found);
- return;
- }
-}
-
-sub print_client_entry {
- #- print a client entry, in proper format
- my ($handle, $client, %ts_clients) = @_;
-
- print $handle "host $client {\n";
- print $handle "\thardware ethernet\t$ts_clients{$client}->{hardware};\n";
- print $handle "\tfixed-address\t\t$ts_clients{$client}->{address};\n";
- print $handle "\tfilename\t\t\"$ts_clients{$client}->{filename}\";\n";
- print $handle "}\n";
-}
-
-sub write_dhcpd_conf {
- my %ts_clients = @_;
- my $clients = "/etc/dhcpd.conf.etherboot.clients";
- my $key;
-
- open(CLIENT, "> $clients") || warn ("Can't open $clients!");
- foreach $key(keys(%ts_clients)){
- print_client_entry("CLIENT", $key, %ts_clients);
- }
- close CLIENT
-}
-
-sub read_dhcpd_conf {
- my $clients = "/etc/dhcpd.conf.etherboot.clients";
- my %ts_clients;
- my $hostname;
-
- #- read and parse current client entries
- open(CLIENTS, $clients) || warn("Can't open $clients\n");
- while(<CLIENTS>) {
- my ($name, $val, $val2) = split(' ',$_);
- $val = $val2 if ($name =~ /hardware/);
- $val =~ s/[;"]//g;
- if ($name !~ /}/) {
- if ($name =~ /host/) {
- $hostname = $val;
- } else {
- $name = "address" if ($name =~ /fixed-address/);
- $ts_clients{$hostname}->{$name} = $val;
- }
- }
- }
- close CLIENTS;
- %ts_clients;
-}
diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst
deleted file mode 100755
index 54e0fd139..000000000
--- a/perl-install/standalone/drakautoinst
+++ /dev/null
@@ -1,439 +0,0 @@
-#!/usr/bin/perl
-
-#
-# Guillaume Cottenceau (gc@mandrakesoft.com)
-#
-# Copyright 2001 MandrakeSoft
-#
-# This software may be freely redistributed under the terms of the GNU
-# public license.
-#
-# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use common;
-use interactive;
-use devices;
-use detect_devices;
-use steps;
-use commands;
-use fs;
-use Data::Dumper;
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-
-
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: drakautoinst [--version]\n";
-/-version/ and die 'version: $Id$ '."\n";
-$::direct = /-direct/;
-$::direct = 1; #DEBUG
-
-my $in = 'interactive'->vnew('su', 'default');
-
-begin:
-$::isEmbedded and kill USR2, $::CCPID;
-
-my $imagefile = "/root/drakx/replay_install.img";
--f $imagefile or $in->ask_okcancel(_("Error!"),
- _("I can't find needed image file `%s'.", $imagefile), 1), quit_global($in, 0);
-
-$::direct or $in->ask_okcancel(_("Auto Install Configurator"),
-_("You are about to configure an Auto Install floppy. This feature is somewhat dangerous and must be used circumspectly.
-
-With that feature, you will be able to replay the installation you've performed on this computer, being interactively prompted for some steps, in order to change their values.
-
-For maximum safety, the partitioning and formatting will never be performed automatically, whatever you chose during the install of this computer.
-
-Do you want to continue?"), 1) or quit_global($in, 0);
-
-
-my @manual_steps = qw(doPartitionDisks formatPartitions);
-my @all_steps;
-my @choices;
-
-my $st = \%steps::installSteps;
-
-for (my $f = $st->{first}; $f; $f = $st->{$f}{next}) {
- next if member($f, @manual_steps);
- my $def_choice = 'replay';
- push @choices, { label => _($st->{$f}{text}), val => \$def_choice, list => [ _('replay'), _('manual') ] };
- push @all_steps, [ $f, \$def_choice ];
-}
-
-$in->ask_from(_("Automatic Steps Configuration"),
- _("Please choose for each step whether it will replay like your install, or it will be manual"),
- \@choices
- ) or quit_global($in, 0);
-
-${$_->[1]} eq _('manual') and push @manual_steps, $_->[0] foreach @all_steps;
-
-my $mountdir = "/root/tmp/drakautoinst-mountdir"; -d $mountdir or mkdir $mountdir, 0755;
-my $floppy = detect_devices::floppy();
-my $dev = devices::make($floppy);
-$in->ask_okcancel('', _("Insert a blank floppy in drive %s", $floppy), 1) or quit_global($in, 0);
-{
- my $w = $in->wait_message('', _("Creating auto install floppy"));
- commands::dd("if=$imagefile", "of=$dev", "bs=1440", "count=1024");
- common::sync();
-}
-fs::mount($dev, $mountdir, 'vfat', 0);
-my $cfgfile = "$mountdir/auto_inst.cfg";
-eval(cat_($cfgfile));
-my $o_old = $o;
-
-if (!$::isEmbedded && $in->isa('interactive::gtk')) {
- require Gtk;
- init Gtk;
- require my_gtk;
- import my_gtk qw(:helpers :wrappers);
-
- my %tree;
- $struct_gui{$_} = 'General' foreach qw(lang isUpgrade autoExitInstall timezone default_packages mkbootdisk);
- $struct_gui{$_} = 'Security' foreach qw(crypto security);
- $struct_gui{$_} = 'Harddrive' foreach qw(partitions manualFstab useSupermount partitioning);
- $struct_gui{$_} = 'Network' foreach qw(intf netc netcnx);
- $struct_gui{$_} = 'Users' foreach qw(superuser users authentication);
- $struct_gui{$_} = 'Hardware' foreach qw(keyboard mouse X printer wacom nomouseprobe);
-
- %pixmap = ( lang => 'language',
- isUpgrade => '',
- security => 'security',
- autoExitInstall => '',
- timezone => '',
- default_packages => '',
- partitions => 'harddrive',
- manualFstab => 'partition',
- useSupermount => '',
- partitioning => 'partition',
- intf => 'network',
- netc => 'network',
- netcnx => 'network',
- superuser => 'user',
- users => 'user',
- authentication => '',
- keyboard => 'keyboard',
- mouse => 'mouse',
- X => 'X',
- printer => 'printer',
- wacom => '',
- );
-
- member($_, keys %struct_gui) and push @{$tree{$struct_gui{$_}}}, [$_ , $pixmap{$_}, h2widget($o->{$_}, "\$o->\{$_\}") ] foreach (keys %$o);
-
- my $W = my_gtk->new(_('$o edition'));
- my @box_to_hide;
- my $nb_pages=0;
- my $notebook = new Gtk::Notebook;
- $notebook->set_show_border(0);
- $notebook->set_show_tabs(0);
- $notebook->append_page(gtkpack_(gtkset_border_width(new Gtk::VBox(0,0), 10),
- 1, new Gtk::VBox(0,0),
- 0, gtkpack_(new Gtk::HBox(0,0),
- 1, new Gtk::VBox(0,0),
- 0, gtkadd(gtkset_shadow_type(new Gtk::Frame, 'etched-in'),
- new Gtk::Pixmap(gtkcreate_png('mdk_logo'))),
- 1, new Gtk::VBox(0,0),
- ),
- 0, _("\nWelcome.\n\nThe parameters of the auto-install are available in the sections on the left"),
- 1, new Gtk::VBox(0,0),
- ), undef);
- $notebook->show_all;
- $notebook->set_page(0);
-
- gtkadd($W->{window},
- gtkpack_(new Gtk::VBox(0,5),
- 1, gtkpack_(new Gtk::HBox(0,0),
- 0, gtkadd(gtkset_usize(gtkset_shadow_type(new Gtk::Frame, 'in'), 130, 470),
- gtkpack_(new Gtk::VBox(0,0),
- map {
- my $box = new Gtk::VBox(0,0);
- push @box_to_hide, $box;
- $box->{vis} = 0;
- my @button_to_hide;
- 0, gtksignal_connect(new Gtk::Button($_), clicked => sub {
- if($box->{vis}) { $box->hide(); $box->{vis} = 0; $notebook->set_page(0); }
- else {
- $_->hide, $_->{vis}=0 foreach @box_to_hide;
- $box->show; $box->{vis} = 1;
- $box->{active_function} and $box->{active_function}->();
- }
- }), 1, gtkpack__($box,
- map {
- my $button = gtkset_relief(new Gtk::ToggleButton(), 'none');
- push @button_to_hide, $button;
- my $gru = $_->[0];
- $notebook->append_page(gtkshow($_->[2]), undef);
- $nb_pages++;
- my $local_page = $nb_pages;
- my $function = sub { $notebook->set_page($local_page) };
- gtksignal_connect($button, toggled => sub {
- $button->get_active() and $function->()
- });
- my $b;
- if ($_->[1] ne "") { $b = new Gtk::Pixmap(gtkcreate_png($_->[1]))} else { $b = ()};
- gtksignal_connect(gtkadd($button,
- gtkpack__(new Gtk::VBox(0,3),
- $b,
- _($_->[0]),
- )
- ), released => sub {
- $button->get_active() or $button->set_active(1),return;
- $_->set_active(0) foreach @button_to_hide;
- $button->set_active(1);
- $box->{active_function} = $function;
- $function->();
- })
- } @{$tree{$_}}
- )
- } keys(%tree)
- )
- ),
- 1, $notebook,
- ),
- 0, new Gtk::HSeparator,
- 0, gtkadd(gtkset_border_width(gtkset_layout(new Gtk::HButtonBox, 'end'), 5),
- gtksignal_connect(new Gtk::Button(_("Accept")), clicked => sub { Gtk->main_quit; }),
- gtksignal_connect(new Gtk::Button(_("Cancel")), clicked => sub { $o = $o_old; Gtk->main_quit; quit_global($in, 0) }),
- )
- )
- );
- $_->hide foreach @box_to_hide;
-# $W->{window}->show_all;
-# gtkadd($W->{window},
-# gtkpack_($W->create_box_with_title(_("Edit variables")),
-# 1, my $notebook = create_notebook( map { $_, h2widget($o->{$_}, "\$o->\{$_\}") } keys %$o ),
-# 0, gtkpack(gtkset_border_width(new Gtk::HBox(0,0),5), $W->create_okcancel),
-# ),
-# );
-# $notebook->set_tab_pos('left');
-# $::isEmbedded and Gtk->main_iteration while Gtk->events_pending;
- $::isEmbedded and kill (12, $::CCPID);
- $W->main;
-# $W->destroy();
-}
-
-my $str = join('',
-"#!/usr/bin/perl -cw
-#
-# Special file generated by ``drakautoinst''.
-#
-# You should check the syntax of this file before using it in an auto-install.
-# You can do this with 'perl -cw auto_inst.cfg.pl' or by executing this file
-# (note the '#!/usr/bin/perl -cw' on the first line).
-",
- Data::Dumper->Dump([$o], ['$o']), q(
-package install_steps_auto_install;
-$graphical = 1;
-), Data::Dumper->Dump([\@manual_steps], ['$msteps']),
-q(push @graphical_steps, @$msteps;
-), "\0");
-$str =~ s/ {8}/\t/g; #- replace all 8 space char by only one tabulation, this reduces file size so much :-)
-output($cfgfile, $str);
-
-fs::umount($mountdir);
-
-$in->ask_okcancel(_("Congratulations!"),
-_("The floppy has been successfully generated.
-You may now replay your installation."));
-
-quit_global($in, 0);
-
-
-sub quit_global {
- my ($in, $exitcode) = @_;
- $::isEmbedded ? kill USR1, $::CCPID : $in->exit($exitcode);
- goto begin;
-}
-
-
-
-sub h2widget {
- my ($k, $label) = @_;
- my $w;
- if(ref($k) =~ /HASH/) {
- my $vb;
- my @widget_list;
- my $i = -1;
- my @list_keys = keys(%{$k});
- if (ref(${$k}{$list_keys[0]}) =~ /HASH/) {
- $i++;
- my ($button_add, $button_remove);
- $w = gtkpack_(new Gtk::VBox(0,0),
- 1, createScrolledWindow(gtkpack__($vb = new Gtk::VBox(0,10),
- $widget_list[$i] = create_packtable({ col_spacings => 10, row_spacings => 3 },
- map {
- my $e;
- $e = h2widget(${$k}{$_}, "$label\{$_\}");
- [ "$_ : ", $e ] } @list_keys
- ),
- )
- ),
- control_buttons(${$k}{$list_keys[0]},
- sub { my ($vb, $widget_list2, $ref_local_k, $i) = @_;
- my @widget_list = @{$widget_list2};
- my $field = $in->ask_from_entry(_("Auto Install"), ("Enter the name of the new field you want to add")) or return undef;
- $field eq '' and return undef;
- gtkpack__($vb,
- $widget_list[$i] = create_packtable({ col_spacings => 10, row_spacings => 3 },
- [ "$field : ", h2widget($ref_local_k, "$label\{$field\}")])
- );
- @{$widget_list2} = @widget_list;
- },
- $vb, \$i, \@widget_list)
- );
- } else {
- $w = create_packtable({ col_spacings => 10, row_spacings => 3 },
- map { create_entry_element(${$k}{$_}, "$label\{$_\}", $_) } @list_keys
- )
- }
- } elsif(ref($k) =~ /ARRAY/) {
- my $vb;
- my @widget_list;
- my $i = -1;
- $w = gtkpack_(new Gtk::VBox(0,0),
- 1, createScrolledWindow(
- gtkpack__($vb = new Gtk::VBox(0,5),
- map { $i++; $widget_list[$i] = h2widget($_, "$label\[$i\]") } @{$k},
- )
- ),
- control_buttons(@{$k}[0],
- sub { my ($vb, $widget_list2, $ref_local_k, $i) = @_;
- my @widget_list = @{$widget_list2};
- gtkpack__($vb, $widget_list[$i] = h2widget($ref_local_k, "$label\[$i\]"));
- @{$widget_list2} = @widget_list;
- },
- $vb, \$i, \@widget_list)
- );
- } else {
- $label =~ /\$o->\{(.+)\}/;
- $w = create_packtable({ col_spacings => 10, row_spacings => 3 },
- create_entry_element($k, $label, $1))
- }
- return $w;
-}
-
-
-sub create_entry_element {
- my ($text, $value, $label) = @_;
- my $e;
- if(ref ($text) =~ /HASH/) {
- return ([ "$label : ", h2widget($text, $label) ]);
- } elsif (ref ($text) =~ /ARRAY/) {
- return ([ "$label : ", h2widget($text, $label) ]);
- } else {
- $e = new Gtk::Entry;
- $e->{value} = $value;
- my $tag = Gtk->timeout_add(1000, sub { $e->set_text($text); 0 });
- gtksignal_connect($e, changed => sub {
- my $exe = $e->{value} . "='" . $e->get_text() . "'";
- print "EXEC : $exe\n ";
- eval "$exe";
- });
- }
- [ $label ? "$label : " : "" , $e ]
-}
-
-sub control_buttons {
- my ($ref_local_k, $local_gui, $vb, $j, $widget_list2) = @_;
- 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 Gtk::HButtonBox, 'spread'), 5),
- gtksignal_connect($button_add = new Gtk::Button(_("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 Gtk::Button(_("Remove the last item")), clicked => sub {
- $i>=0 or return;
- $widget_list[$i]->destroy();
- $i--;
- $i>=0 or $button_remove->set_sensitive(0);
- }
- )
- )
-}
-
-#-------------------------------------------------
-#- $Log$
-#- Revision 1.19 2002/07/23 10:35:55 tvignaud
-#- - Big Move 1: interactive::* hierarchy
-#-
-#- Revision 1.18 2002/03/06 20:17:51 damien
-#- corrected HASH and ARRAY label
-#-
-#- Revision 1.17 2002/01/29 22:38:31 gc
-#- move /root/* files (ddebug.log, install.log, report.bug,
-#- auto_inst.cfg.pl, replay_install.img) to /root/drakx/,
-#- and also save stage1.log there
-#-
-#- Revision 1.16 2002/01/18 20:22:20 gc
-#- - write the 'common' part of the 'explanations' stuff,
-#- with nice help from Pixel for the tough Perl part
-#- - move 'use standalone' up in all standalone apps,
-#- to comply to 'explanations'
-#-
-#- Revision 1.15 2002/01/08 10:21:15 fpons
-#- removed stupid invocation of _("$_"), is it correct code to change it to $_ only ?
-#-
-#- Revision 1.14 2001/11/05 16:07:21 damien
-#- typo
-#-
-#- Revision 1.13 2001/10/30 20:11:31 damien
-#- corrected ref($in) =~ /gtk/
-#-
-#- Revision 1.12 2001/10/30 17:00:05 damien
-#- updated
-#-
-#- Revision 1.11 2001/10/26 13:45:11 damien
-#- progress bar hack
-#-
-#- Revision 1.10 2001/10/25 11:59:58 damien
-#- simple variables handled, code compression.
-#-
-#- Revision 1.9 2001/10/25 11:17:03 damien
-#- The new and shiny drakautoinst is coming. P|-|34R
-#-
-#- Revision 1.8 2001/10/25 02:18:24 damien
-#- The new drakautoinst is coming. P|-|34R
-#-
-#- Revision 1.7 2001/09/18 17:35:50 gc
-#- have "manual" and "replay" translated
-#-
-#- Revision 1.6 2001/09/14 17:30:23 siegel
-#- Check exisence of "/root/replay_install.img" before anything else ...
-#-
-#- Revision 1.5 2001/08/29 21:58:24 gc
-#- quit_global
-#-
-#- Revision 1.4 2001/08/26 14:34:10 gc
-#- require -> use
-#-
-#- Revision 1.3 2001/08/18 17:52:21 prigaux
-#- big renaming of ask_from_entries_refH in ask_from and ask_from_entries_refH_powered in ask_from_
-#-
-#- Revision 1.2 2001/08/13 19:08:27 gc
-#- ouch! use lib from /usr/lib/libDrakX, rather than from ..
-#-
-#- Revision 1.1 2001/08/13 19:06:50 gc
-#- initial revision for drakautoinst
-#- - put %installSteps in a separate package (steps.pm) (for drakxtools)
-#- - use additional fields {auto} and {noauto}, by step, to ease interactive auto install and oem stuff
-#- - in install2.pm, perform each step either from the interactive class or from install_steps, according to the {auto} flag
-#- - id, tell each step to not try to be automatic if {noauto}
-#- - in the install, have auto install bootdisk created in install_any so we can always write a bootdisk (from install_steps) for further use from drakautoinst in standalone
-#- - interactive version of install_steps_auto_install is now inheriting from the interactive class, so we can click on a previous automatic step and have it interactively during an interactive auto install
-#-
-#-
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup
deleted file mode 100755
index 7736a2e17..000000000
--- a/perl-install/standalone/drakbackup
+++ /dev/null
@@ -1,5149 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (C) 2001 MandrakeSoft by Sebastien DUPONT <dupont_s@epita.fr>
-# Redistribution of this file is permitted under the terms of the GNU
-# Public License (GPL)
-#
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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.
-#
-#________________________________________________________________
-#
-# Description:
-#
-# Drakbackup is used to backup your system.
-# During the configuration you can select
-# - System files,
-# - Users files,
-# - Other files.
-# or All your system ... and Other (like windows Partitions)
-#
-# Drakbackup allows you to backup your system on:
-# - Harddrive.
-# - NFS.
-# - CDROM (CDRW), DVDROM (with autoboot, rescue and autoinstall.).
-# - FTP.
-# - Rsync.
-# - Webdav.
-# - Tape.
-#
-# Drakbackup allows you to Restore your system on
-# choosen directory.
-#
-# Per default all backup will be stored on your
-# /var/lib/drakbackup directory
-#
-# Configuration file:
-# /etc/drakconf/drakbackup/drakbakup.conf
-#
-#________________________________________________________________
-#
-# Backup files formats:
-#
-# no incremental backup:
-# backup_sys_date_hour.tar.*
-# backup_user_toto_date_hour.tar.*
-# backup_other_date_hour.tar.*
-#
-# first incremental backup: (if backup_base* does not exist )
-#
-# backup_base_sys_date_hour.tar.*
-# backup_base_user_toto_date_hour.tar.*
-# backup_base_other_date_hour.tar.*
-#
-# other incremental backup: (if backup_base* already exist )
-#
-# backup_incr_sys_date_hour.tar.*
-# backup_incr_user_toto_date_hour.tar.*
-# backup_incr_other_date_hour.tar.*
-#
-#________________________________________________________________
-#
-# REQUIRE: cron if daemon
-# cdrecord & mkisofs
-# perl Net::FTP
-# ssh-askpass
-#
-# BUGS :
-# restore->other_media->next->previous => crash ...
-# selection des sources a inclure dans le backup cd.
-# help -> ok after install_rpm
-#
-# TODO:
-# 1 - print ftp problem for user.
-# 2 - calcul disk space.
-# use quota.
-# 3 - ssh & rsync -> expect or .identity.pub/authorized_keys
-# 4 - write on cd --> ! change Joliet to HFS for Apple
-# 5 - cd writer detection -> cdrw: /sys/dev/cdrom/info /scsi/host0/bus0/target4/lun0
-# /proc/sys/dev/cdrom/
-# 6 - total backup.( all partitions wanted, windows partitions for example!)
-# dump use for total backup.
-# 7 - custom deamon
-# 8 - placer README dans $save_path -> prevenir des danger de supprimer la premier version
-# explain configuration file variables (mainly for non X users)
-# 9 - webdav
-# 10- backend : --resore_all, --restore_sys, --restore_users
-# --build_cd_autoinst
-# --backup_now --backup_default_now
-# 11- tape device support
-# 12- cpio use !!
-# 13- boot floppy disk (with dialog)
-# 14- build autoboot with backup and install cd
-# 15- use .backupignore like on CVS
-# 16- afficher les modif dans un fichier texte du meme nom
-# pour afficher durant le restore.
-# 17- futur: could be possible to restore a specific file
-# or directory at specific date.
-# 18- possible all files each time from directory.
-#
-# DONE TODAY:
-#________________________________________________________________
-
-use Gtk;
-use lib qw(/usr/lib/libDrakX );
-
-use standalone
- ; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use my_gtk qw(:helpers :wrappers);
-use common;
-use strict;
-use Time::localtime;
-
-my $in = 'interactive'->vnew( '', 'default' );
-$::isEmbedded = ( $::XID, $::CCPID ) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-
-if ( "@ARGV" =~ /--help|-h/ ) {
- print q(Backup and Restore application
-
---default : save default directories.
---debug : show all debug messages.
---show-conf : list of files or directories to backup.
---daemon : use daemon configuration.
---help : show this message.
---version : show version name.
-);
- exit(0);
-}
-
-if ( "@ARGV" =~ /--version/ ) {
- print "DrakBakckup Version 1.0\n";
- exit(0);
-}
-
-# Backend Options.
-my $central_widget;
-my $previous_widget;
-my $current_widget;
-my $interactive;
-my $up_box;
-my $advanced_box;
-my $box2;
-my $cfg_file_exist = 0;
-my @all_user_list;
-my $list_other;
-my $DEBUG = 0;
-my $restore_sys = 1;
-my $restore_user = 1;
-my $restore_other = 1;
-my $restore_step_sys_date = "";
-my @user_backuped = ();
-my @sys_backuped = ();
-my $sys_backuped = 0;
-my $other_backuped = 0;
-my @user_list_to_restore = ();
-my @sys_list_to_restore = ();
-my $cd_devive_entry;
-my $custom_help;
-my $button_box;
-my $button_box_tmp;
-my $next_widget;
-my $sav_next_widget;
-my $system_state;
-my $restore_state;
-my $save_path_entry;
-my $restore_find_path_entry;
-my $pbar;
-my $pbar1;
-my $pbar2;
-my $pbar3;
-my $the_time;
-my @user_list_to_restore2 = ();
-my @data_backuped = ();
-my $label_tail;
-my @list_to_build_on_cd = ();
-my $restore_path = "/";
-my $restore_other_path = 0;
-my $restore_other_src;
-my $path_to_find_restore;
-my $other_media_hd;
-my $backup_bef_restore = 0;
-my $table;
-my @user_list_backuped = ();
-my @files_corrupted = ();
-my $remove_user_before_restore = 1;
-my @file_list_to_send_by_ftp = ();
-my $results;
-
-# config. FILES -> Default PATH & Global variables.
-my @sys_files = ("/etc");
-my @user_list;
-my @list_other = ();
-my $cfg_file = "/etc/drakxtools/drakbackup/drakbackup.conf";
-my $save_path = "/var/lib/drakbackup";
-my $comp_mode = 0;
-my $backup_sys = 1;
-my $backup_user = 1;
-my $backup_daemon = 1;
-my $backup_sys_versions = 1;
-my $backup_user_versions = 1;
-my $backup_other_versions = 0;
-my $what_no_browser = 1;
-my $cdrw = 0;
-my $net_proto = '';
-my $host_path = '';
-my $login_user = '';
-my $daemon = 0;
-my $ssh_daemon = 0;
-my $ftp_daemon = 0;
-my $hd_daemon = 0;
-my $cd_daemon = 0;
-my $hd_quota = 0;
-my $where_net_ftp = 0;
-my $where_net_ssh = 0;
-my $where_net = 0;
-my $where_hd = 1;
-my $where_cd = 0;
-my $where_tape = 0;
-my $cd_time = 650;
-my $when_space;
-my $cd_with_install_boot = 0;
-my $cd_devive = '';
-my $host_name = '';
-my $backupignore = 0;
-my $auth_choice = 0;
-my $remember_pass = 0;
-my $passwd_user = '';
-my $save_device_tape = ();
-my $cdrw_erase = 0;
-my $no_critical_sys = 1;
-my $send_mail = 0;
-my $user_mail;
-my @user_info;
-
-foreach (@ARGV) {
- /--default/ and backend_mode();
- /--daemon/ and daemon_mode();
- /--show-conf/ and show_conf();
- /--debug/ and $DEBUG = 1, next;
-}
-
-sub show_conf {
- print "DrakBakckup configuration:\n\n";
- read_conf_file();
- system_state();
- print $system_state . "\n";
- exit(0);
-}
-
-sub backend_mode {
- build_backup_files();
- exit(0);
-}
-
-sub daemon_mode {
- $daemon = 1;
- build_backup_files();
- exit(0);
-}
-
-interactive_mode();
-
-sub all_user_list {
- my ( $uname, $uid );
- @all_user_list = ();
- setpwent();
- do {
- @user_info = getpwent();
- ( $uname, $uid ) = @user_info[ 0, 2 ];
- push ( @all_user_list, $uname )
- if ( $uid > 500 )
- and !( $uname eq "nobody" );
- } while (@user_info);
-}
-
-sub the_time {
- $the_time = "_";
- $the_time .= localtime->year() + 1900;
- if ( localtime->mon() < 9 ) { $the_time .= "0"; }
- $the_time .= localtime->mon() + 1;
- if ( localtime->mday() < 10 ) { $the_time .= "0"; }
- $the_time .= localtime->mday();
- $the_time .= "_";
- if ( localtime->hour() < 10 ) { $the_time .= "0"; }
- $the_time .= localtime->hour();
- if ( localtime->min() < 10 ) { $the_time .= "0"; }
- $the_time .= localtime->min();
- if ( localtime->sec() < 10 ) { $the_time .= "0"; }
- $the_time .= localtime->sec();
-}
-
-sub save_conf_file {
- my @cfg_list = (
- "SYS_FILES=@sys_files\n", "HOME_FILES=@user_list\n",
- "OTHER_FILES=@list_other\n", "PATH_TO_SAVE=$save_path\n",
- "HOST_PATH=$host_path\n", "NET_PROTO=$net_proto\n",
- "CD_TIME=$cd_time\n", "USER_MAIL=$user_mail\n",
- "DAEMON_TIME_SPACE=$when_space\n", "CDRW_DEVICE=$cd_devive\n",
- "LOGIN=$login_user\n", "TAPE_DEVICE=$save_device_tape\n",
- "HOST_NAME=$host_name\n"
- );
- $no_critical_sys and push @cfg_list, "NO_CRITICAL_SYS\n";
- $no_critical_sys or push @cfg_list, "CRITICAL_SYS\n";
- $send_mail and push @cfg_list, "SEND_MAIL\n";
- $backup_sys_versions and push @cfg_list, "SYS_INCREMENTAL_BACKUPS\n";
- $backup_user_versions and push @cfg_list, "USER_INCREMENTAL_BACKUPS\n";
- $backup_other_versions and push @cfg_list, "OTHER_INCREMENTAL_BACKUPS\n";
- $cdrw_erase and push @cfg_list, "CDRW_ERASE\n";
- $where_net_ftp and push @cfg_list, "USE_NET_FTP\n";
- $where_net_ssh and push @cfg_list, "USE_NET_SSH\n";
- $remember_pass and push @cfg_list, "LOGIN=$login_user\n";
- $remember_pass and push @cfg_list, "PASSWD=$passwd_user\n";
- $remember_pass and push @cfg_list, "REMEMBER_PASS\n";
- $auth_choice or push @cfg_list, "AUTH_CHOICE=0\n";
- if ( $auth_choice == 1 ) { push @cfg_list, "AUTH_CHOICE=1\n"; }
- if ( $auth_choice == 2 ) { push @cfg_list, "AUTH_CHOICE=2\n"; }
- $cd_with_install_boot and push @cfg_list, "CD_WITH_INSTALL_BOOT\n";
- $ssh_daemon and push @cfg_list, "SSH_DAEMON\n";
- $ftp_daemon and push @cfg_list, "FTP_DAEMON\n";
- $hd_daemon and push @cfg_list, "HD_DAEMON\n";
- $cd_daemon and push @cfg_list, "CD_DAEMON\n";
- $hd_quota and push @cfg_list, "HD_QUOTA\n";
- $where_hd and push @cfg_list, "USE_HD\n";
- $where_cd and push @cfg_list, "USE_CD\n";
- $where_net and push @cfg_list, "USE_NET\n";
- $cdrw and push @cfg_list, "CDRW\n";
- $what_no_browser or push @cfg_list, "BROWSER_CACHE\n";
- $backup_sys or push @cfg_list, "NO_SYS_FILES\n";
- if ($comp_mode) { push @cfg_list, "OPTION_COMP=TAR.BZ2\n" }
- else { push @cfg_list, "OPTION_COMP=TAR.GZ\n" }
- output_p( $cfg_file, @cfg_list );
- system("chmod 600 $cfg_file");
- save_cron_files();
-}
-
-sub read_cron_files {
- my $daemon_found = 0;
- foreach (qw(hourly daily weekly monthly)) {
- if ( -f "/etc/cron.$_/drakbackup" ) {
- $when_space = $_;
- $daemon_found = 1;
- last;
- }
-
- }
- !$daemon_found and $backup_daemon = 0;
-}
-
-sub save_cron_files {
- my @cron_file = ( "#!/bin/sh\n", "\n", "/usr/sbin/drakbackup --daemon" );
-
- if ($backup_daemon) {
- foreach (qw(hourly daily weekly monthly)) {
- -f "/etc/cron.$_/drakbackup" and rm_rf("/etc/cron.$_/drakbackup");
- }
- output_p( "/etc/cron.$when_space/drakbackup", @cron_file );
- system("chmod +x /etc/cron.$when_space/drakbackup");
- }
- else {
- foreach (qw(hourly daily weekly monthly)) {
- -f "/etc/cron.$_/drakbackup" and rm_rf("/etc/cron.$_/drakbackup");
- }
- }
-}
-
-sub read_conf_file {
- if ( -e $cfg_file ) {
- open( CONF_FILE, "<" . "$cfg_file" )
- || print "You must be root to read configuration file. \n";
- while (<CONF_FILE>) {
- next unless /\S/;
- next if /^#/;
- chomp;
- if (/^SYS_FILES/) {
- s/^SYS_FILES=//gi;
- @sys_files = split ( ' ', $_ );
- }
- if (/^HOME_FILES/) {
- s/^HOME_FILES=//gi;
- @user_list = split ( ' ', $_ );
- }
- if (/^OTHER_FILES/) {
- s/^OTHER_FILES=//gi;
- @list_other = split ( ' ', $_ );
- }
- if (/^PATH_TO_SAVE/) { s/^PATH_TO_SAVE=//gi; $save_path = $_; }
- if (/^NO_SYS_FILES/) { $backup_sys = 0; }
- if (/^NO_USER_FILES/) { $backup_user = 0; }
- if (/^OPTION_COMP/) {
- s/^OPTION_COMP=//gi;
- /TAR.GZ/ and $comp_mode = 0;
- /TAR.BZ2/ and $comp_mode = 1;
- }
- if (/^BROWSER_CACHE/) { $what_no_browser = 0; }
- if (/^CDRW/) { $cdrw = 1; }
- if (/^NET_PROTO/) { s/^NET_PROTO=//gi; $net_proto = $_; }
- if (/^HOST_PATH/) { s/^HOST_PATH=//gi; $host_path = $_; }
- if (/^SSH_DAEMON/) { $ssh_daemon = 1; }
- if (/^FTP_DAEMON/) { $ftp_daemon = 1; }
- if (/^HD_DAEMON/) { $hd_daemon = 1; }
- if (/^CD_DAEMON/) { $cd_daemon = 1; }
- if (/^HD_QUOTA/) { $hd_quota = 1; }
- if (/^USE_HD/) { $where_hd = 1; }
- if (/^USE_CD/) { $where_cd = 1; }
- if (/^USE_NET/) { $where_net = 1; }
- if (/^USE_TAPE/) { $where_tape = 1; }
- if (/^CD_TIME/) { s/^CD_TIME=//gi; $cd_time = $_; }
-
- if (/^DAEMON_TIME_SPACE/) {
- s/^DAEMON_TIME_SPACE=//gi;
- $when_space = $_;
- }
- if (/^CD_WITH_INSTALL_BOOT/) { $cd_with_install_boot = 1; }
- if (/^CDRW_DEVICE/) { s/^CDRW_DEVICE=//gi; $cd_devive = $_; }
- if (/^HOST_NAME/) { s/^HOST_NAME=//gi; $host_name = $_; }
- if (/^AUTH_CHOICE/) { s/^AUTH_CHOICE=//gi; $auth_choice = $_; }
- if (/^REMEMBER_PASS/) { $remember_pass = 1; }
- if (/^LOGIN/) {
- s/^LOGIN=//gi;
- $login_user = $_;
- $remember_pass = 1;
- }
- if (/^PASSWD/) {
- s/^PASSWD=//gi;
- $passwd_user = $_;
- $remember_pass = 1;
- }
- if (/^USER_MAIL/) { s/^USER_MAIL=//gi; $user_mail = $_; }
- if (/^USE_NET_FTP/) { $where_net_ftp = 1; }
- if (/^SEND_MAIL/) { $send_mail = 1; }
- if (/^USE_NET_SSH/) { $where_net_ssh = 1; }
- if (/^TAPE_DEVICE/) { s/TAPE_DEVICE=//gi; $save_device_tape = $_; }
- if (/^CDRW_ERASE/) { $cdrw_erase = 1; }
- if (/^SYS_INCREMENTAL_BACKUPS/) { $backup_sys_versions = 1; }
- if (/^USER_INCREMENTAL_BACKUPS/) { $backup_user_versions = 1; }
- if (/^OTHER_INCREMENTAL_BACKUPS/) { $backup_other_versions = 1; }
- if (/^NO_CRITICAL_SYS/) { $no_critical_sys = 1; }
- if (/^CRITICAL_SYS/) { $no_critical_sys = 0; }
- }
- read_cron_files();
- $cfg_file_exist = 1;
- }
- else { $cfg_file_exist = 0; }
- close CONF_FILE;
-}
-
-sub complete_results {
- system_state();
- $results .=
-"***********************************************************************\n\n";
- $daemon or $results .= _("\n DrakBackup Report \n\n");
- $daemon
- and $results .=
- _("\n DrakBackup Daemon Report\n\n\n");
- $results .=
-"***********************************************************************\n\n";
- $results .= $system_state;
- $results .=
-"\n\n***********************************************************************\n\n";
- $results .= _("\n DrakBackup Report Details\n\n\n");
- $results .=
-"***********************************************************************\n\n";
-}
-
-sub ftp_client {
- use Net::FTP;
- my $ftp;
-
- $DEBUG
- and print "file list to send : $_\n " foreach @file_list_to_send_by_ftp;
- if ( $DEBUG && $interactive ) {
- $ftp = Net::FTP->new( "$host_name", Debug => 1 ) or return (1);
- }
- elsif ($interactive) {
- $ftp = Net::FTP->new( "$host_name", Debug => 0 ) or return (1);
- }
- else { $ftp = Net::FTP->new( "$host_name", Debug => 0 ) or return (1); }
- $ftp->login( "$login_user", "$passwd_user" );
- $ftp->cwd("$host_path");
- foreach (@file_list_to_send_by_ftp) {
- $pbar->set_value(0);
- $interactive and progress( $pbar, 0.5, $_ );
- $interactive and $pbar->set_show_text($_);
- $ftp->put("$_");
- $interactive and progress( $pbar, 0.5, $_ );
- $interactive and $pbar->set_show_text($_);
- $interactive
- and
- progress( $pbar3, 1 / @file_list_to_send_by_ftp, _("total progess") );
- }
- $ftp->quit;
- return (0);
-}
-
-sub ssh_client {
- system("scp @file_list_to_send_by_ftp root\@petra:.");
-}
-
-sub write_on_cd {
-
- # system("cdrecord ");
-}
-
-sub build_iso {
-
- # system("mkisofs -r -J -T -v -V 'Drakbackup' -o drakbackup.iso /var/lib/drakbackup");
-}
-
-sub build_cd {
- build_iso();
-}
-
-sub send_mail {
- my ($result) = @_;
- my $datem = `date`;
-
- open F, "|/usr/sbin/sendmail -f$user_mail $user_mail" or return (1);
- print F "From: drakbackup\n";
- print F "To: $user_mail \n";
- print F "Subject: DrakBackup report on $datem \n";
- print F "\n";
- print F "$result\n";
- close F or return (1);
- return (0);
-}
-
-sub build_backup_files {
- my $path_name;
- my $tar_cmd;
- my $more_recent;
- my $tar_cmd_sys;
- my $tar_cmd_user;
- my $tar_cmd_other;
- my $tar_ext;
- my $vartemp;
- my $base_sys_exist = 0;
- my $base_user_exist = 0;
- my $base_other_exist = 0;
- my @list_temp = ();
- my @list_other_;
- my @dir_content = ();
- my $file_date;
- $results = "";
-
- read_conf_file();
- the_time();
- $send_mail and complete_results();
- -d $save_path or mkdir_p($save_path);
- if ($comp_mode) {
- $DEBUG and $tar_cmd = "tar cv --use-compress-program /usr/bin/bzip2 ";
- $DEBUG or $tar_cmd = "tar c --use-compress-program /usr/bin/bzip2 ";
- $tar_ext = "tar.bz2";
- }
- else {
- $DEBUG and $tar_cmd = "tar cvpz ";
- $DEBUG or $tar_cmd = "tar cpz ";
- $tar_ext = "tar.gz";
- }
- $tar_cmd_sys = $tar_cmd;
- $tar_cmd_user = $tar_cmd;
- $tar_cmd_other = $tar_cmd;
- $no_critical_sys
- and $tar_cmd_sys .=
- "--exclude passwd --exclude fstab --exclude group --exclude mtab";
- $what_no_browser
- and $tar_cmd_user .= "--exclude NewCache --exclude Cache --exclude cache";
-
- -d $save_path and @dir_content = all($save_path);
- grep ( /^backup\_base\_sys/, @dir_content ) and $base_sys_exist = 1;
-
- if ( ( $where_hd && !$daemon ) || ( $daemon && $hd_daemon ) ) {
- $interactive and progress( $pbar, 0.5, _("Backup system files...") );
- if ($backup_sys) {
- if ($backup_sys_versions) {
- if ( grep /^backup\_incr\_sys/, @dir_content ) {
- my @more_recent = grep /^backup\_incr\_sys/,
- sort @dir_content;
- $more_recent = pop @more_recent;
- $DEBUG and print "more recent file: $more_recent\n";
- system(
-"find @sys_files -cnewer $save_path/$more_recent \! -type d -print > $save_path/list_incr_sys$the_time.txt"
- );
- if ( !cat_("$save_path/list_incr_sys$the_time.txt") ) {
- system("rm $save_path/list_incr_sys$the_time.txt");
- }
- else {
- system(
-"$tar_cmd_sys -f $save_path/backup_incr_sys$the_time.$tar_ext -T $save_path/list_incr_sys$the_time.txt"
- );
- push @file_list_to_send_by_ftp,
- "$save_path/backup_incr_sys$the_time.$tar_ext";
- push @file_list_to_send_by_ftp,
- "$save_path/list_incr_sys$the_time.txt";
- $results .=
-"\nfile: $save_path/backup_incr_sys$the_time.$tar_ext\n";
- $results .=
- cat_("$save_path/list_incr_sys$the_time.txt");
- }
- }
- elsif ( grep /^backup\_base\_sys/, @dir_content ) {
- my @more_recent = grep /^backup\_base\_sys/,
- sort @dir_content;
- $more_recent = pop @more_recent;
- $DEBUG and print "more recent file: $more_recent\n";
- system(
-"find @sys_files -cnewer $save_path/$more_recent \! -type d -print > $save_path/list_incr_sys$the_time.txt"
- );
- if ( !cat_("$save_path/list_incr_sys$the_time.txt") ) {
- system("rm $save_path/list_incr_sys$the_time.txt");
- }
- else {
- system(
-"$tar_cmd_sys -f $save_path/backup_incr_sys$the_time.$tar_ext -T $save_path/list_incr_sys$the_time.txt"
- );
- push @file_list_to_send_by_ftp,
- "$save_path/backup_incr_sys$the_time.$tar_ext";
- push @file_list_to_send_by_ftp,
- "$save_path/list_incr_sys$the_time.txt";
- $results .=
-"\nfile: $save_path/backup_incr_sys$the_time.$tar_ext\n";
- $results .=
- cat_("$save_path/list_incr_sys$the_time.txt");
- }
- }
- else {
- system(
-"$tar_cmd_sys -f $save_path/backup_base_sys$the_time.$tar_ext @sys_files"
- );
- push @file_list_to_send_by_ftp,
- "$save_path/backup_base_sys$the_time.$tar_ext";
- $results .=
- "\nfile: $save_path/backup_base_sys$the_time.$tar_ext\n";
- }
- }
- else {
-
- # system("cd $save_path && rm -f backup_sys* backup_base_sys* backup_incr_sys*");
- system(
-"$tar_cmd_sys -f $save_path/backup_sys$the_time.$tar_ext @sys_files"
- );
- push @file_list_to_send_by_ftp,
- "$save_path/backup_sys$the_time.$tar_ext";
- $results .= "\nfile: $save_path/backup_sys$the_time.$tar_ext\n";
- }
- }
-
- $interactive and progress( $pbar, 0.5, _("Backup system files...") );
- $interactive
- and progress( $pbar3, 0.3, _("Hard Disk Backup files...") );
-
- if (@list_other) {
- system("cd $save_path && rm -f backup_other* ");
- system(
-"$tar_cmd_other -f $save_path/backup_other$the_time.$tar_ext @list_other"
- );
- push @file_list_to_send_by_ftp,
- "$save_path/backup_other$the_time.$tar_ext";
- $results .= "\nfile: $save_path/backup_other$the_time.$tar_ext\n";
-
- #old foreach (@list_other) { push @list_other_, $_ . "\n"; }
- @list_other_ = map { "$_\n" } @list_other;
- output_p( $save_path . '/list_other', @list_other_ );
- }
-
- $interactive and progress( $pbar1, 1, _("Backup User files...") );
- $interactive
- and progress( $pbar3, 0.3, _("Hard Disk Backup Progress...") );
-
- if ($backup_user) {
- foreach (@user_list) {
- my $user = $_;
- $path_name = return_path($user);
- if ($backup_user_versions) {
- if ( grep( /^backup\_incr\_user\_$user\_/, @dir_content ) )
- {
- my @more_recent = grep /^backup\_incr\_user\_$user\_/,
- sort @dir_content;
- $more_recent = pop @more_recent;
- $DEBUG and print "more recent file: $more_recent\n";
- system(
-"find $path_name -cnewer $save_path/$more_recent \! -type d -print > $save_path/list_incr_user_$user$the_time.txt"
- );
- if (
- !cat_(
- "$save_path/list_incr_user_$user$the_time.txt"
- )
- )
- {
- system(
-"rm $save_path/list_incr_user_$user$the_time.txt"
- );
- }
- else {
- system(
-"$tar_cmd_user -f $save_path/backup_incr_user_$user$the_time.$tar_ext -T $save_path/list_incr_user_$user$the_time.txt"
- );
- push @file_list_to_send_by_ftp,
-"$save_path/backup_incr_user_$user$the_time.$tar_ext";
- push @file_list_to_send_by_ftp,
- "$save_path/list_incr_user_$user$the_time.txt";
- $results .=
-" \nfile: $save_path/backup_incr_user_$user$the_time.$tar_ext\n";
- $results .= cat_(
- "$save_path/list_incr_user_$user$the_time.txt");
- }
- }
- elsif ( grep /^backup\_base\_user\_$user\_/, @dir_content )
- {
- my @more_recent = grep /^backup\_base\_user\_$user\_/,
- sort @dir_content;
- $more_recent = pop @more_recent;
- $DEBUG and print "more recent file: $more_recent\n";
- system(
-"find $path_name -cnewer $save_path/$more_recent \! -type d -print > $save_path/list_incr_user_$user$the_time.txt"
- );
- if (
- !cat_(
- "$save_path/list_incr_user_$user$the_time.txt"
- )
- )
- {
- system(
-"rm $save_path/list_incr_user_$user$the_time.txt"
- );
- }
- else {
- system(
-"$tar_cmd_user -f $save_path/backup_incr_user_$user$the_time.$tar_ext -T $save_path/list_incr_user_$user$the_time.txt"
- );
- push @file_list_to_send_by_ftp,
-"$save_path/backup_incr_user_$user$the_time.$tar_ext";
- push @file_list_to_send_by_ftp,
- "$save_path/list_incr_user_$user$the_time.txt";
- $results .=
-"\nfile: $save_path/backup_incr_user_$user$the_time.$tar_ext\n";
- $results .= cat_(
- "$save_path/list_incr_user_$user$the_time.txt");
- }
- }
- else {
- system(
-"$tar_cmd_user -f $save_path/backup_base_user_$user$the_time.$tar_ext $path_name"
- );
- push @file_list_to_send_by_ftp,
- "$save_path/backup_base_user_$user$the_time.$tar_ext";
- $results .=
-"\nfile: $save_path/backup_base_user_$user$the_time.$tar_ext\n";
- }
- }
- else {
- system(
-"cd $save_path && rm -f backup_user_$_* backup_base_user_$_* backup_incr_user_$_*"
- );
- system(
-"$tar_cmd_user -f $save_path/backup_user_$_$the_time.$tar_ext $path_name"
- );
- push @file_list_to_send_by_ftp,
- "$save_path/backup_user_$_$the_time.$tar_ext";
- $results .=
-"\nfile: $save_path/backup_user_$user$the_time.$tar_ext\n";
- }
- }
- }
- $interactive and progress( $pbar2, 1, _("Backup Other files...") );
- $interactive
- and progress( $pbar3, 0.4, _("Hard Disk Backup files...") );
- }
-
- if ( ( $where_net_ssh && !$daemon ) || ( $daemon && $ssh_daemon ) ) {
-
- #ssh_client();
- }
- if ( ( $where_net_ftp && !$daemon ) || ( $daemon && $ftp_daemon ) ) {
- $results .= _( "file list send by FTP : %s\n ", $_ )
- foreach @file_list_to_send_by_ftp;
- $interactive and build_backup_ftp_status();
- if ( ftp_client() ) {
- $results .= _(
-"\n FTP connexion problem: It was not possible to send your backup files by FTP.\n"
- );
- $interactive and client_ftp_pb();
- }
- }
- if ( ( $where_cd && !$daemon ) || ( $daemon && $cd_daemon ) ) {
- build_cd();
- }
- if ($send_mail) {
- if ( send_mail("$results") ) {
- $interactive and send_mail_pb();
- $interactive or print _(" Error during mail sending. \n");
- }
- }
-}
-
-my @list_of_rpm_to_install;
-
-sub require_rpm {
- my $all_rpms_found = 1;
- my $res;
- my @file_cache = cat_("/var/log/rpmpkgs");
- @list_of_rpm_to_install = ();
-
- # my($pkg) = @_;
- foreach my $pkg (@_) {
- $res = grep /$pkg/, @file_cache;
-
- # $res = system("rpm -qa | grep $_");
- if ( $res == 0 ) {
- $all_rpms_found = 0;
- push @list_of_rpm_to_install, $pkg;
- }
- }
- return ($all_rpms_found);
-}
-
-sub list_remove {
- my ( $widget, $list ) = @_;
- my @to_remove;
- push @to_remove, $list->child_position($_) foreach ( $list->selection );
- splice @list_other, $_, 1 foreach ( reverse sort @to_remove );
- $list->remove_items( $list->selection );
-}
-
-sub file_ok_sel {
- my ( $widget, $file_selection ) = @_;
- my $file_name = $file_selection->get_filename();
- if ( !member( $file_name, @list_other ) ) {
- push ( @list_other, $file_name );
- $list_other->add( gtkshow( new Gtk::ListItem($file_name) ) );
- }
-}
-
-sub filedialog_where_hd {
- my $file_dialog;
-
- $file_dialog = gtksignal_connect(
- new Gtk::FileSelection( _("File Selection") ),
- destroy => sub { $file_dialog->destroy(); }
- );
- $file_dialog->ok_button->signal_connect(
- clicked => sub {
- $save_path_entry->set_text( $file_dialog->get_filename() );
- $file_dialog->destroy();
- }
- );
- $file_dialog->cancel_button->signal_connect(
- clicked => sub { $file_dialog->destroy() } );
- $file_dialog->show();
-}
-
-sub filedialog_restore_find_path {
- my $file_dialog;
-
- $file_dialog = gtksignal_connect(
- new Gtk::FileSelection( _("File Selection") ),
- destroy => sub { $file_dialog->destroy(); }
- );
- $file_dialog->ok_button->signal_connect(
- clicked => sub {
- $restore_find_path_entry->set_text( $file_dialog->get_filename() );
- $file_dialog->destroy();
- }
- );
- $file_dialog->cancel_button->signal_connect(
- clicked => sub { $file_dialog->destroy() } );
- $file_dialog->show();
-}
-
-sub filedialog {
- my $file_dialog;
-
- $file_dialog = gtksignal_connect(
- new Gtk::FileSelection( _("File Selection") ),
- destroy => sub { $file_dialog->destroy(); }
- );
- $file_dialog->ok_button->signal_connect(
- clicked => \&file_ok_sel,
- $file_dialog
- );
- $file_dialog->ok_button->child->set( _("Add") );
- $file_dialog->cancel_button->signal_connect(
- clicked => sub { $file_dialog->destroy() } );
- $file_dialog->cancel_button->child->set( _("Close") );
- $file_dialog->set_filename(
- _("Select the files or directories and click on 'Add'") );
- $file_dialog->show();
-}
-
-################################################ ADVANCED ################################################
-
-sub check_list {
- foreach (@_) {
- my $ref = $_->[1];
- gtksignal_connect(
- gtkset_active( $_->[0], ${$ref} ),
- toggled => sub { invbool $ref }
- );
- }
-}
-
-sub fonction_env {
- (
- $central_widget, $current_widget, $previous_widget,
- $custom_help, $next_widget
- )
- = @_;
-}
-
-# sub redraw_during_check {
-# my ($tmp1, $tmp2) = @_;
-# gtksignal_connect(gtkset_active($tmp1, $tmp2), toggled => sub {
-# # invbool \$tmp2;
-# print "tmp2 bef = $tmp2\n";
-# $tmp2 = $tmp2 ? 0 : 1;
-# ${$central_widget}->destroy();
-# print "tmp2 after = $tmp2\n";
-# $current_widget->();
-# return ($tmp2);
-# });
-# }
-
-sub advanced_what_sys {
- my $box_what_sys;
-
- gtkpack(
- $advanced_box,
- $box_what_sys = gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- _("\nPlease check all options that you need.\n"),
- 1,
- _(
-"These options can backup and restore all files in your /etc directory.\n"
- ),
- 0,
- my $check_what_sys = new Gtk::CheckButton(
- _("Backup your System files. ( /etc directory )")
- ),
- 0,
- my $check_what_versions = new Gtk::CheckButton(
- _("Use incremental backup (do not replace old backups)")
- ),
- 0,
- my $check_what_critical = new Gtk::CheckButton(
- _("Do not include critical files (passwd, group, fstab)")
- ),
- 0,
- _(
-"With this option you will be able to restore any version\n of your /etc directory."
- ),
- 1,
- new Gtk::VBox( 0, 15 ),
- ),
- );
- check_list(
- [ $check_what_sys, \$backup_sys ],
- [ $check_what_critical, \$no_critical_sys ],
- [ $check_what_versions, \$backup_sys_versions ]
- );
- fonction_env( \$box_what_sys, \&advanced_what_sys, \&advanced_what,
- "what" );
- $up_box->show_all();
-}
-
-sub advanced_what_user {
- my ($previous_function) = @_, my $box_what_user;
- my %check_what_user;
-
- all_user_list();
- gtkpack(
- $advanced_box,
- $box_what_user = gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 0,
- _(
-"Please check all users that you want to include in your backup."
- ),
- 0,
- new Gtk::HSeparator,
- 1,
- createScrolledWindow(
- gtkpack__(
- new Gtk::VBox( 0, 0 ),
- map {
- my $name = $_;
- my @user_list_tmp;
- my $b = new Gtk::CheckButton($name);
- if ( grep /^$name$/, @user_list ) {
- $check_what_user{$_}[1] = 1;
- gtkset_active( $b, 1 );
- }
- else {
- $check_what_user{$_}[1] = 0;
- gtkset_active( $b, 0 );
- }
- $b->signal_connect(
- toggled => sub {
- if ( $check_what_user{$name}[1] ) {
- $check_what_user{$name}[1] = 0;
- @user_list_tmp =
- grep( !/^$name$/, @user_list );
- @user_list = @user_list_tmp;
- }
- else {
- $check_what_user{$name}[1] = 1;
- if ( !member( $name, @user_list ) ) {
- push @user_list, $name;
- }
- }
- }
- );
- $b
- } (@all_user_list)
- ),
- ),
- 0,
- my $check_what_browser =
- new Gtk::CheckButton( _("Do not include the browser cache") ),
- 0,
- my $check_what_user_versions = new Gtk::CheckButton(
- _("Use Incremental Backups (do not replace old backups)")
- ),
- ),
- );
- check_list(
- [ $check_what_browser, \$what_no_browser ],
- [ $check_what_user_versions, \$backup_user_versions ]
- );
- if ($previous_function) {
- fonction_env( \$box_what_user, \&advanced_what_user,
- \&$previous_function, "what", \&$previous_function );
- }
- else {
- fonction_env( \$box_what_user, \&advanced_what_user, \&advanced_what,
- "what" );
- }
- $up_box->show_all();
-}
-
-sub advanced_what_other {
- my $box_what_other;
- $list_other = new Gtk::List();
- $list_other->set_selection_mode( -extended );
- $list_other->add( gtkshow( new Gtk::ListItem($_) ) ) foreach (@list_other);
-
- gtkpack(
- $advanced_box,
- $box_what_other = gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 4 ),
- 1, createScrolledWindow($list_other),
- ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::HButtonBox, -spread ),
- gtksignal_connect(
- new Gtk::Button( _("Add") ),
- clicked => sub { filedialog() }
- ),
- gtksignal_connect(
- new Gtk::Button( _("Remove Selected") ),
- clicked => \&list_remove,
- $list_other
- ),
- ),
- 0,
- gtkset_sensitive(
- my $check_what_other_versions = new Gtk::CheckButton(
- _("Use Incremental Backups (do not replace old backups)")
- ),
- 0
- ),
- ),
- );
- check_list( [ $check_what_other_versions, \$backup_other_versions ] );
- fonction_env( \$box_what_other, \&advanced_what_other, \&advanced_what,
- "what" );
- $up_box->show_all();
-}
-
-sub advanced_what_entire_sys {
- my $box_what;
-
- my ( $pix_user_map, $pix_user_mask ) = gtkcreate_png("user");
- my ( $pix_other_map, $pix_other_mask ) = gtkcreate_png("net_u");
- my ( $pix_sys_map, $pix_sys_mask ) = gtkcreate_png("bootloader");
-
- gtkpack(
- $advanced_box,
- $box_what = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtksignal_connect(
- my $button_what_other = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- message_underdevel();
- }
- ),
- 1,
- gtksignal_connect(
- my $button_what_all = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- message_underdevel();
- }
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- $button_what_other->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_sys_map, $pix_sys_mask ),
- new Gtk::Label( _("Linux") ),
- new Gtk::HBox( 0, 5 )
- )
- );
- $button_what_all->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_user_map, $pix_user_mask ),
- new Gtk::Label( _("Windows (FAT32)") ),
- new Gtk::HBox( 0, 5 )
- )
- );
- fonction_env( \$box_what, \&advanced_what_entire_sys, \&advanced_what, "" );
- $up_box->show_all();
-}
-
-sub advanced_what {
- my $box_what;
- my ( $pix_user_map, $pix_user_mask ) = gtkcreate_png("ic82-users-40");
- my ( $pix_other_map, $pix_other_mask ) = gtkcreate_png("ic82-others-40");
- my ( $pix_sys_map, $pix_sys_mask ) = gtkcreate_png("ic82-system-40");
- my ( $pix_sysp_map, $pix_sysp_mask ) = gtkcreate_png("ic82-systemeplus-40");
-
- gtkpack(
- $advanced_box,
- $box_what = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtksignal_connect(
- my $button_what_sys = new Gtk::Button(),
- clicked =>
- sub { $box_what->destroy(); advanced_what_sys(); }
- ),
- 1,
- gtksignal_connect(
- my $button_what_user = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- advanced_what_user();
- }
- ),
- 1,
- gtksignal_connect(
- my $button_what_other = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- advanced_what_other();
- }
- ),
-
- # 1, gtksignal_connect(my $button_what_all = new Gtk::Button(),
- # clicked => sub { ${$central_widget}->destroy(); advanced_what_entire_sys(); }),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- $button_what_sys->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_sys_map, $pix_sys_mask ),
- new Gtk::Label( _("System") ),
- new Gtk::HBox( 0, 5 )
- )
- );
- $button_what_user->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_user_map, $pix_user_mask ),
- new Gtk::Label( _("Users") ),
- new Gtk::HBox( 0, 5 )
- )
- );
- $button_what_other->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_other_map, $pix_other_mask ),
- new Gtk::Label( _("Other") ),
- new Gtk::HBox( 0, 5 )
- )
- );
-
- # $button_what_all->add(gtkpack(new Gtk::HBox(0,10),
- # new Gtk::Pixmap($pix_sysp_map, $pix_sysp_mask),
- # new Gtk::Label(_("An Entire System")),
- # new Gtk::HBox(0, 5)
- # ));
-
- fonction_env( \$box_what, \&advanced_what, \&advanced_box, "" );
- $up_box->show_all();
-}
-
-sub advanced_where_net_ftp {
- my ($previous_function) = @_, my $box_where_net;
-
- gtkpack(
- $advanced_box,
- $box_where_net = gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 0,
- new Gtk::HSeparator,
- 0,
- my $check_where_net_ftp =
- new Gtk::CheckButton( _("Use FTP connection to backup") ),
- 0,
- new Gtk::HSeparator,
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label( _("Please enter the host name or IP.") ),
- $where_net_ftp
- ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- my $host_name_entry = new Gtk::Entry(),
- $where_net_ftp
- ),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please enter the directory to\n put the backup on this host."
- )
- ),
- $where_net_ftp
- ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- my $host_path_entry = new Gtk::Entry(),
- $where_net_ftp
- ),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label( _("Please enter your login") ),
- $where_net_ftp
- ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- my $login_user_entry = new Gtk::Entry(),
- $where_net_ftp
- ),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label( _("Please enter your password") ),
- $where_net_ftp
- ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- my $passwd_user_entry = new Gtk::Entry(),
- $where_net_ftp
- ),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- my $check_remember_pass =
- new Gtk::CheckButton( _("Remember this password") ),
- $where_net_ftp
- ),
- ),
- ),
- );
- $passwd_user_entry->set_visibility(0);
- $passwd_user_entry->set_text($passwd_user);
- $passwd_user_entry->signal_connect( 'changed',
- sub { $passwd_user = $passwd_user_entry->get_text() } );
- $host_path_entry->set_text($host_path);
- $host_name_entry->set_text($host_name);
- $login_user_entry->set_text($login_user);
- $host_name_entry->signal_connect( 'changed',
- sub { $host_name = $host_name_entry->get_text() } );
- $host_path_entry->signal_connect( 'changed',
- sub { $host_path = $host_path_entry->get_text() } );
- $login_user_entry->signal_connect( 'changed',
- sub { $login_user = $login_user_entry->get_text() } );
- check_list( [ $check_remember_pass, \$remember_pass ] );
- gtksignal_connect(
- gtkset_active( $check_where_net_ftp, $where_net_ftp ),
- toggled => sub {
- invbool \$where_net_ftp;
- ${$central_widget}->destroy();
- $current_widget->();
- }
- );
- if ($previous_function) {
- fonction_env( \$box_where_net, \&advanced_where_net_ftp,
- \&$previous_function, "ftp" );
- }
- else {
- fonction_env( \$box_where_net, \&advanced_where_net_ftp,
- \&advanced_where, "ftp" );
- }
- $up_box->show_all();
-}
-
-sub advanced_where_net_ssh {
- my ($previous_function) = @_, my $box_where_ssh;
-
- gtkpack(
- $advanced_box,
- $box_where_ssh = gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- gtkpack(
- new Gtk::HBox( 0, 15 ),
- new Gtk::VBox( 0, 15 ),
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtksignal_connect(
- new Gtk::Button("rsync"),
- clicked => sub {
- ${$central_widget}->destroy();
- message_underdevel();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button("WebDav"),
- clicked => sub {
- ${$central_widget}->destroy();
- message_underdevel();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button("scp"),
- clicked => sub {
- ${$central_widget}->destroy();
- message_underdevel();
- }
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- new Gtk::VBox( 0, 15 ),
- ),
- ),
- );
-
- # test si x11
- #print system("xterm -fn 7x14 -bg black -fg white -e ssh-keygen -f ~/.ssh/identity-backup && scp") . "\n";
-
- if ($previous_function) {
- fonction_env( \$box_where_ssh, \&advanced_where_net_ssh,
- \&$previous_function, "ssh" );
- }
- else {
- fonction_env( \$box_where_ssh, \&advanced_where_net_ssh,
- \&advanced_where, "ssh" );
- }
- $up_box->show_all();
-}
-
-sub advanced_where_net {
- my ($previous_function) = @_, my $box_where_net;
-
- gtkpack(
- $advanced_box,
- $box_where_net = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("FTP Connection") ),
- clicked => sub {
- $box_where_net->destroy();
- if ($previous_function) {
- advanced_where_net_ftp( \&$previous_function );
- }
- else {
- advanced_where_net_ftp();
- }
- }
- ),
- if_(
- 0,
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Secure Connection") ),
- clicked => sub {
- $box_where_net->destroy();
- if ($previous_function) {
- advanced_where_net_ssh( \&$previous_function );
- }
- else {
- advanced_where_net_ssh();
- }
- }
- )
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- if ($previous_function) {
- fonction_env( \$box_where_net, \&advanced_where_net,
- \&$previous_function, "remote" );
- }
- else {
- fonction_env(
- \$box_where_net, \&advanced_where_net,
- \&advanced_where, "remote"
- );
- }
- $up_box->show_all();
-}
-
-sub advanced_where_cd {
- my ($previous_function) = @_, my $box_where_cd;
- my $combo_where_cd_time = new Gtk::Combo();
- $combo_where_cd_time->set_popdown_strings( "650", "700", "750", "800" );
-
- gtkpack(
- $advanced_box,
- $box_where_cd = gtkpack_(
- new Gtk::VBox( 0, 6 ),
- 0,
- my $check_where_cd =
- new Gtk::CheckButton( _("Use CD/DVDROM to backup") ),
- 0,
- new Gtk::HSeparator,
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label( _("Please choose your CD space") ),
- $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_sensitive(
- gtkset_usize( $combo_where_cd_time, 200, 20 ), $where_cd
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _("Please check if you are using CDRW media")
- ),
- $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_sensitive(
- my $check_cdrw = new Gtk::CheckButton(), $where_cd
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _("Please check if you want to erase your CDRW before")
- ),
- $cdrw && $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_sensitive(
- my $check_cdrw_erase = new Gtk::CheckButton(),
- $cdrw && $where_cd
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please check if you want to include\n install boot on your CD."
- )
- ),
- $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_sensitive(
- my $check_cd_with_install_boot = new Gtk::CheckButton(),
- $where_cd
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please enter your CD Writer device name\n ex: 0,1,0"
- )
- ),
- $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- $cd_devive_entry = new Gtk::Entry(), $where_cd
- ),
- 200, 20
- ),
- ),
- ),
- );
-
- foreach ( [ $check_cdrw_erase, \$cdrw_erase ],
- [ $check_cd_with_install_boot, \$cd_with_install_boot ] )
- {
- my $ref = $_->[1];
- gtksignal_connect( gtkset_active( $_->[0], ${$ref} ),
- toggled => sub { ${$ref} = ${$ref} ? 0 : 1; } );
- }
- gtksignal_connect(
- gtkset_active( $check_where_cd, $where_cd ),
- toggled => sub {
- $where_cd = $where_cd ? 0 : 1;
- ${$central_widget}->destroy();
- $current_widget->();
- }
- );
- gtksignal_connect(
- gtkset_active( $check_cdrw, $cdrw ),
- toggled => sub {
- $cdrw = $cdrw ? 0 : 1;
- ${$central_widget}->destroy();
- $current_widget->();
- }
- );
- $cd_devive_entry->set_text($cd_devive);
- $cd_devive_entry->signal_connect( 'changed',
- sub { $cd_devive = $cd_devive_entry->get_text(); } );
- $combo_where_cd_time->entry->set_text($cd_time);
- $combo_where_cd_time->entry->signal_connect( 'changed',
- sub { $cd_time = $combo_where_cd_time->entry->get_text() } );
-
- if ($previous_function) {
- fonction_env( \$box_where_cd, \&advanced_where_cd, \&$previous_function,
- "" );
- }
- else {
- fonction_env( \$box_where_cd, \&advanced_where_cd, \&advanced_where,
- "" );
- }
- $up_box->show_all();
-}
-
-sub advanced_where_tape {
- my ($previous_function) = @_, my $box_where_tape;
- my $button;
- my $adj = new Gtk::Adjustment 550.0, 1.0, 10000.0, 1.0, 5.0, 0.0;
- my ( $pix_fs_map, $pix_fs_mask ) = gtkcreate_png("filedialog");
-
- gtkpack(
- $advanced_box,
- $box_where_tape = gtkpack_(
- new Gtk::VBox( 0, 6 ),
- 0,
- new Gtk::HSeparator,
- 0,
- my $check_where_tape =
- new Gtk::CheckButton( _("Use tape to backup") ),
- 0,
- new Gtk::HSeparator,
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _("Please enter the device name to use for backup")
- ),
- $where_tape
- ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- my $save_device_tape_entry = new Gtk::Entry(),
- $where_tape
- ),
- 200, 20
- ),
- ),
- 0,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please enter the maximum size\n allowed for Drakbackup"
- )
- ),
- $where_tape
- ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- my $spinner = new Gtk::SpinButton( $adj, 0, 0 ),
- $where_tape
- ),
- 200, 20
- ),
- ),
- 0,
- gtkpack_( new Gtk::HBox( 0, 10 ), ),
- ),
- );
- gtksignal_connect(
- gtkset_active( $check_where_tape, $where_tape ),
- toggled => sub {
- $where_tape = $where_tape ? 0 : 1;
- ${$central_widget}->destroy();
- $current_widget->();
- }
- );
- $save_device_tape_entry->set_text($save_device_tape);
- $save_device_tape_entry->signal_connect( 'changed',
- sub { $save_device_tape = $save_device_tape_entry->get_text() } );
- if ($previous_function) {
- fonction_env( \$box_where_tape, \&advanced_where_tape,
- \&$previous_function, "" );
- }
- else {
- fonction_env( \$box_where_tape, \&advanced_where_tape, \&advanced_where,
- "" );
- }
- $up_box->show_all();
-}
-
-sub advanced_where_hd {
- my ($previous_function) = @_, my $box_where_hd;
- my $button;
- my $adj = new Gtk::Adjustment 550.0, 1.0, 10000.0, 1.0, 5.0, 0.0;
- my ( $pix_fs_map, $pix_fs_mask ) = gtkcreate_png("ic82-dossier-32");
-
- gtkpack(
- $advanced_box,
- $box_where_hd = gtkpack_(
- new Gtk::VBox( 0, 6 ),
- 0, new Gtk::HSeparator,
-
- # 0, my $check_where_hd = new Gtk::CheckButton( _("Use Hard Disk to backup") ),
- # 0, new Gtk::HSeparator,
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label( _("Please enter the directory to save:") ),
- $where_hd
- ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- $save_path_entry = new Gtk::Entry(), $where_hd
- ),
- 152, 20
- ),
- 0,
- gtkset_sensitive(
- $button = gtksignal_connect(
- new Gtk::Button(),
- clicked => sub {
- filedialog_where_hd();
- }
- ),
- $where_hd
- ),
- ),
- 0,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please enter the maximum size\n allowed for Drakbackup"
- )
- ),
- $where_hd
- ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- my $spinner = new Gtk::SpinButton( $adj, 0, 0 ),
- $where_hd
- ),
- 200,
- 20
- ),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_sensitive(
- my $check_where_hd_quota =
- new Gtk::CheckButton( _("Use quota for backup files.") ),
- $where_hd
- ),
- 0,
- new Gtk::VBox( 0, 6 ),
- ),
- ),
- );
- foreach ( [ $check_where_hd_quota, \$hd_quota ] ) {
- my $ref = $_->[1];
- gtksignal_connect( gtkset_active( $_->[0], ${$ref} ),
- toggled => sub { ${$ref} = ${$ref} ? 0 : 1; } );
- }
-
- # gtksignal_connect(gtkset_active($check_where_hd, $where_hd), toggled => sub {
- # $where_hd = $where_hd ? 0 : 1;
- # $where_hd = 1;
- # ${$central_widget}->destroy();
- # $current_widget->();
- # });
- $button->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_fs_map, $pix_fs_mask )
- )
- );
- $save_path_entry->set_text($save_path);
- $save_path_entry->signal_connect( 'changed',
- sub { $save_path = $save_path_entry->get_text() } );
- if ($previous_function) {
- fonction_env( \$box_where_hd, \&advanced_where_hd, \&$previous_function,
- "" );
- }
- else {
- fonction_env( \$box_where_hd, \&advanced_where_hd, \&advanced_where,
- "" );
- }
- $up_box->show_all();
-}
-
-sub advanced_where {
- my $box_where;
- my ( $pix_net_map, $pix_net_mask ) = gtkcreate_png("ic82-network-40");
- my ( $pix_cd_map, $pix_cd_mask ) = gtkcreate_png("ic82-CD-40");
- my ( $pix_hd_map, $pix_hd_mask ) = gtkcreate_png("ic82-discdurwhat-40");
- my ( $pix_tape_map, $pix_tape_mask ) = gtkcreate_png("ic82-tape-40");
-
- gtkpack(
- $advanced_box,
- $box_where = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtksignal_connect(
- my $button_where_net = new Gtk::Button(),
- clicked => sub {
-
- # $box_where->destroy(); advanced_where_net(); }),
- $box_where->destroy();
- advanced_where_net_ftp();
- }
- ),
-
- # 1, gtksignal_connect(my $button_where_cd = new Gtk::Button(), clicked => sub {
- # ${$central_widget}->destroy();
- # if (require_rpm("mkisofs", "cdrecord", "toto")) { advanced_where_cd(); }
- # else {
- # print "have to install @list_of_rpm_to_install...\n";
- # ${$central_widget}->destroy();
- # install_rpm(\&advanced_where);
- # }
- # }),
- 1,
- gtksignal_connect(
- my $button_where_hd = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- advanced_where_hd();
- }
- ),
-
- # 1, gtksignal_connect(my $button_where_tape = new Gtk::Button(), clicked => sub {
- # ${$central_widget}->destroy(); message_underdevel();}), #advanced_where_tape(); }),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- $button_where_net->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_net_map, $pix_net_mask ),
- new Gtk::Label( _("Network") ),
- new Gtk::HBox( 0, 5 )
- )
- );
-
- # $button_where_cd->add(gtkpack(new Gtk::HBox(0,10),
- # new Gtk::Pixmap($pix_cd_map, $pix_cd_mask),
- # new Gtk::Label(_("CDROM / DVDROM")),
- # new Gtk::HBox(0, 5)
- # ));
- $button_where_hd->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_hd_map, $pix_hd_mask ),
- new Gtk::Label( _("HardDrive / NFS") ),
- new Gtk::HBox( 0, 5 )
- )
- );
-
- # $button_where_tape->add(gtkpack(new Gtk::HBox(0,10),
- # new Gtk::Pixmap($pix_tape_map, $pix_tape_mask),
- # new Gtk::Label(_("Tape")),
- # new Gtk::HBox(0, 5)
- # ));
- fonction_env( \$box_where, \&advanced_where, \&advanced_box, "" );
- $up_box->show_all();
-}
-
-sub advanced_when {
- my $box_when;
- my $check_where_cd_daemon;
- my $check_where_hd_daemon;
- my $check_where_ssh_daemon;
- my $check_where_ftp_daemon;
- my ( $pix_time_map, $pix_time_mask ) = gtkcreate_png("ic82-when-40");
- my $combo_when_space = new Gtk::Combo();
- my %trans = (
- _("hourly") => 'hourly',
- _("daily") => 'daily',
- _("weekly") => 'weekly',
- _("monthly") => 'monthly'
- );
- my %trans2 = (
- 'hourly' => _("hourly"),
- 'daily' => _("daily"),
- 'weekly' => _("weekly"),
- 'monthly' => _("monthly")
- );
- $combo_when_space->set_popdown_strings( _("hourly"), _("daily"),
- _("weekly"), _("monthly") );
-
- gtkpack(
- $advanced_box,
- $box_when = gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 1,
- new Gtk::Pixmap( $pix_time_map, $pix_time_mask ),
- 0,
- my $check_when_daemon = new Gtk::CheckButton( _("Use daemon") ),
- 1,
- new Gtk::HBox( 0, 10 ),
- ),
- 0,
- new Gtk::HSeparator,
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please choose the time \ninterval between each backup"
- )
- ),
- $backup_daemon
- ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive( $combo_when_space, $backup_daemon ),
- ),
- 0,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label( _("Please choose the\nmedia for backup.") ),
- $backup_daemon
- ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkpack_(
- new Gtk::VBox( 0, 10 ),
-
- # 0, gtkset_sensitive($check_where_cd_daemon = new Gtk::CheckButton(_("Use CD/DVDROM with daemon")), $backup_daemon),
- 0,
- gtkset_sensitive(
- $check_where_hd_daemon =
- new Gtk::CheckButton(
- _("Use Hard Drive with daemon") ),
- $backup_daemon
- ),
-
- # 0, gtkset_sensitive($check_where_ssh_daemon = new Gtk::CheckButton( _("Use SSH with daemon")), $backup_daemon),
- 0,
- gtkset_sensitive(
- $check_where_ftp_daemon =
- new Gtk::CheckButton( _("Use FTP with daemon") ),
- $backup_daemon
- ),
- ),
- ),
- 0,
- new Gtk::HSeparator,
- 1,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please be sure that the cron daemon is included in your services."
- )
- ),
- $backup_daemon
- ),
- ),
- );
-
- check_list(
- [ $check_where_hd_daemon, \$hd_daemon ],
- [ $check_where_ftp_daemon, \$ftp_daemon ]
- );
-
- # check_list([$check_where_hd_daemon, \$hd_daemon], [$check_where_ftp_daemon, \$ftp_daemon],
- # [$check_where_cd_daemon, \$cd_daemon],[$check_where_ssh_daemon, \$ssh_daemon] );
- gtksignal_connect(
- gtkset_active( $check_when_daemon, $backup_daemon ),
- toggled => sub {
- $backup_daemon = $backup_daemon ? 0 : 1;
- ${$central_widget}->destroy();
- advanced_when();
- }
- );
- $combo_when_space->entry->set_text( $trans2{$when_space} );
- $combo_when_space->entry->signal_connect( 'changed',
- sub { $when_space = $trans{ $combo_when_space->entry->get_text() }; } );
- fonction_env( \$box_when, \&advanced_when, \&advanced_box, "" );
- $up_box->show_all();
-}
-
-sub advanced_options {
- my $box_options;
- my ( $pix_options_map, $pix_options_mask ) =
- gtkcreate_png("ic82-moreoption-40");
-
- gtkpack(
- $advanced_box,
- $box_options = gtkpack_(
- new Gtk::VBox( 0, 15 ),
-
- # 0, gtkpack_(new Gtk::HBox(0,10),
- # 1, new Gtk::VBox(0,10),
- # 1, new Gtk::Pixmap($pix_options_map, $pix_options_mask),
- # 1, _("Please choose correct options to backup."),
- # 1, new Gtk::VBox(0,10),
- # ),
- # 0, new Gtk::HSeparator,
- # 0, gtkpack_(new Gtk::VBox(0,10),
- # 0, gtkset_sensitive(my $check_tar_bz2 = new Gtk::CheckButton( _("Use Tar and bzip2 (very slow) [Please be careful if you\n (un)select this option, as all your old backups will be deleted.]") ), 0),
- # 0, gtkset_sensitive(my $check_backupignore = new Gtk::CheckButton( _("Use .backupignore files")), 0),
- 0,
- new Gtk::VBox( 0, 10 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- my $check_mail = new Gtk::CheckButton(
- _("Send mail report after each backup to :")
- ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- my $mail_entry = new Gtk::Entry(),
- ),
-
- # ),
- ),
- );
- check_list( [ $check_mail, \$send_mail ] );
-
- # check_list([$check_mail, \$send_mail], [$check_tar_bz2, \$comp_mode], [$check_backupignore, \$backupignore]);
- $mail_entry->set_text($user_mail);
- $mail_entry->signal_connect( 'changed',
- sub { $user_mail = $mail_entry->get_text() } );
- fonction_env( \$box_options, \&advanced_options, \&advanced_box,
- "options" );
- $up_box->show_all();
-}
-
-sub advanced_box {
- my $box_adv;
- my ( $pix_hd_map, $pix_hd_mask ) = gtkcreate_png("ic82-discdurwhat-40");
- my ( $pix_time_map, $pix_time_mask ) = gtkcreate_png("ic82-when-40");
- my ( $pix_net_map, $pix_net_mask ) = gtkcreate_png("ic82-where-40");
- my ( $pix_options_map, $pix_options_mask ) =
- gtkcreate_png("ic82-moreoption-40");
-
- gtkpack(
- $advanced_box,
- $box_adv = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtksignal_connect(
- my $button_what = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- advanced_what();
- }
- ),
- 1,
- gtksignal_connect(
- my $button_where = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- advanced_where();
- }
- ),
- 1,
- gtksignal_connect(
- my $button_when = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- advanced_when();
- }
- ),
- 1,
- gtksignal_connect(
- my $button_options = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- advanced_options();
- }
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- $button_what->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_hd_map, $pix_hd_mask ),
- new Gtk::Label( _("What") ),
- new Gtk::HBox( 0, 5 )
- )
- );
- $button_where->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_net_map, $pix_net_mask ),
- new Gtk::Label( _("Where") ),
- new Gtk::HBox( 0, 5 )
- )
- );
- $button_when->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_time_map, $pix_time_mask ),
- new Gtk::Label( _("When") ),
- new Gtk::HBox( 0, 5 )
- )
- );
- $button_options->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_options_map, $pix_options_mask ),
- new Gtk::Label( _("More Options") ),
- new Gtk::HBox( 0, 5 )
- )
- );
- fonction_env( \$box_adv, \&advanced_box, \&interactive_mode_box, "" );
- $up_box->show_all();
-}
-
-################################################ WIZARD ################################################
-
-sub wizard_step3 {
- my $box2;
- my $text = new Gtk::Text( undef, undef );
- system_state();
- gtktext_insert( $text, $system_state );
- button_box_restore_main();
-
- gtkpack(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 10 ), 0,
- _("Drakbackup Configuration"), 1,
- createScrolledWindow($text),
- ),
- ),
- );
- fonction_env( \$box2, \&wizard_step3, \&wizard_step2, "" );
- button_box_wizard_end();
- $up_box->show_all();
-}
-
-sub wizard_step2 {
- my $box2;
-
- gtkpack(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- _("Please choose where you want to backup"),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 0,
- my $check_wizard_hd =
- new Gtk::CheckButton( _("on Hard Drive") ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_sensitive(
- gtksignal_connect(
- new Gtk::Button( _("Configure") ),
- clicked => sub {
- ${$central_widget}->destroy();
- to_ok();
- advanced_where_hd( \&wizard_step2 );
- to_normal();
- }
- ),
- $where_hd
- ),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 0,
- my $check_wizard_net =
- new Gtk::CheckButton( _("across Network") ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_sensitive(
- gtksignal_connect(
- new Gtk::Button( _("Configure") ),
- clicked => sub {
- ${$central_widget}->destroy();
- to_ok();
- advanced_where_net( \&wizard_step2 );
- to_normal();
- }
- ),
- $where_net
- ),
- ),
-
- # 0, gtkpack_(new Gtk::HBox(0, 15),
- # 0, my $check_wizard_cd = new Gtk::CheckButton(_("on CDROM")),
- # 1, new Gtk::VBox(0, 5),
- # 0, gtkset_sensitive(gtksignal_connect(new Gtk::Button(_("Configure")),
- # clicked => sub {
- # ${$central_widget}->destroy();
- # advanced_where_cd(\&wizard_step2);
- # }), $where_cd ),
- # ),
- # 0, gtkpack_(new Gtk::HBox(0, 15),
- # 0, my $check_wizard_tape = new Gtk::CheckButton(_("on Tape Device")),
- # 1, new Gtk::VBox(0, 5),
- # 0, gtkset_sensitive(gtksignal_connect(new Gtk::Button(_("Configure")),
- # clicked => sub {
- # ${$central_widget}->destroy();
- # advanced_where_tape(\&wizard_step2);
- # }), $where_tape),
- # ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- $where_net = $where_net_ssh || $where_net_ftp;
- foreach (
- [ $check_wizard_hd, \$where_hd ],
-
- # [$check_wizard_cd, \$where_cd],
- # [$check_wizard_tape, \$where_tape],
- [ $check_wizard_net, \$where_net ]
- )
- {
- my $ref = $_->[1];
- gtksignal_connect(
- gtkset_active( $_->[0], ${$ref} ),
- toggled => sub {
- ${$ref} = ${$ref} ? 0 : 1;
- $where_hd = 1;
- if ( !$where_hd && !$where_cd && !$where_net ) {
- $next_widget = \&message_noselect_box;
- }
- else { $next_widget = \&wizard_step3; }
- if ( !$where_net ) { $where_net_ssh = 0; $where_net_ftp = 0; }
- else { $where_net_ftp = 1; }
- ${$central_widget}->destroy();
- wizard_step2();
- }
- );
- }
- if ( !$where_hd && !$where_cd && !$where_net ) {
- fonction_env( \$box2, \&wizard_step2, \&wizard, "",
- \&message_noselect_box );
- }
- else {
- fonction_env( \$box2, \&wizard_step2, \&wizard, "", \&wizard_step3 );
- }
- button_box_wizard();
- $up_box->show_all();
-}
-
-sub wizard {
- my $box2;
-
- gtkpack(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- _("Please choose what you want to backup"),
- 0,
- my $check_wizard_sys =
- new Gtk::CheckButton( _("Backup system") ),
- 0,
- my $check_wizard_user =
- new Gtk::CheckButton( _("Backup Users") ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Select user manually") ),
- clicked => sub {
- ${$central_widget}->destroy();
- advanced_what_user( \&wizard );
- }
- ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- foreach (
- [ $check_wizard_sys, \$backup_sys ],
- [ $check_wizard_user, \$backup_user ]
- )
- {
- my $ref = $_->[1];
- gtksignal_connect(
- gtkset_active( $_->[0], ${$ref} ),
- toggled => sub {
- ${$ref} = ${$ref} ? 0 : 1;
- if ( $backup_sys || $backup_user && @user_list ) {
- $next_widget = \&wizard_step2;
- }
- else { $next_widget = \&message_noselect_what_box; }
- }
- );
- }
- if ( $backup_sys || $backup_user && @user_list ) {
- fonction_env( \$box2, \&wizard, \&interactive_mode_box, "",
- \&wizard_step2 );
- }
- else {
- fonction_env( \$box2, \&wizard, \&interactive_mode_box, "",
- \&message_noselect_what_box );
- }
- button_box_wizard();
- $up_box->show_all();
-}
-
-################################################ RESTORE ################################################
-
-sub find_backup_to_restore {
-
- # fixme:
- # faire test existance cd
- # faire reponse si non existance de $path_to_find_restore
- my @list_backup = ();
- my @list_backup_tmp2 = ();
- my $to_put;
- @sys_backuped = ();
- my @list_backup_tmp;
- my @user_backuped_tmp;
-
- @user_backuped = ();
- -d $path_to_find_restore and @list_backup_tmp2 = all($path_to_find_restore);
- foreach (@list_backup_tmp2) {
- s/\_base//gi;
- s/\_incr//gi;
- push @list_backup, $_;
- }
- if ( grep /^backup_other/, @list_backup ) { $other_backuped = 1; }
- if ( grep /^backup_sys/, @list_backup ) { $sys_backuped = 1; }
- foreach ( grep /^backup_sys_/, @list_backup ) {
- chomp;
- s/^backup_sys_//gi;
- s/.tar.gz$//gi;
- s/.tar.bz2$//gi;
- my ( $date, $heure ) = /^(.*)_([^_]*)$/;
- my $year = substr( $date, 0, 4 );
- my $month = substr( $date, 4, 2 );
- my $day = substr( $date, 6, 2 );
- my $hour = substr( $heure, 0, 2 );
- my $min = substr( $heure, 2, 2 );
- $to_put = "$day/$month/$year $hour:$min $_";
- push @sys_backuped, $to_put;
- }
- $restore_step_sys_date = $to_put;
- foreach ( grep /^backup_user_/, @list_backup ) {
- chomp;
- s/^backup_user_//gi;
- s/.tar.gz$//gi;
- s/.tar.bz2$//gi;
- my ( $nom, $date, $heure ) = /^(.*)_([^_]*)_([^_]*)$/;
- my $year = substr( $date, 0, 4 );
- my $month = substr( $date, 4, 2 );
- my $day = substr( $date, 6, 2 );
- my $hour = substr( $heure, 0, 2 );
- my $min = substr( $heure, 2, 2 );
-
- # my $to_put = " $nom, (date: $date, hour: $heure)";
- $to_put =
- "$_ user: $nom, date: $day/$month/$year, hour: $hour:$min";
- push @user_backuped, $to_put;
- grep ( /^$nom$/, @user_list_backuped )
- or push @user_list_backuped, $nom;
- }
-}
-
-sub system_state {
- $system_state = ();
-
- if ($cfg_file_exist) {
- $system_state .= _("\nBackup Sources: \n");
- $backup_sys and $system_state .= _("\n- System Files:\n");
- $backup_sys and $system_state .= "\t\t$_\n" foreach @sys_files;
- $backup_user and $system_state .= _("\n- User Files:\n");
- $backup_user and $system_state .= "\t\t$_\n" foreach @user_list;
- @list_other and $system_state .= _("\n- Other Files:\n");
- @list_other and $system_state .= "\t\t$_\n" foreach @list_other;
- $where_hd
- and $system_state .=
- _( "\n- Save on Hard drive on path : %s\n", $save_path );
- $where_net_ftp
- and $system_state .=
- _( "\n- Save on FTP on host : %s\n", $host_name );
- $where_net_ftp
- and $system_state .= _( "\t\t user name: %s\n\t\t on path: %s \n",
- $login_user, $host_path );
- $system_state .= _("\n- Options:\n");
- $backup_sys or $system_state .= _("\tDo not include System Files\n");
- if ($comp_mode) { $system_state .= _("\tBackups use tar and bzip2\n"); }
- else { $system_state .= _("\tBackups use tar and gzip\n"); }
- $system_state .= _( "\n- Daemon (%s) include :\n", $when_space );
- $hd_daemon and $system_state .= _("\t-Hard drive.\n");
- $cd_daemon and $system_state .= _("\t-CDROM.\n");
- $ftp_daemon and $system_state .= _("\t-Network by FTP.\n");
- $ssh_daemon and $system_state .= _("\t-Network by SSH.\n");
- }
- else {
- $system_state =
- _("No configuration, please click Wizard or Advanced.\n");
- }
-}
-
-sub restore_state {
- my @tmp = split ( ' ', $restore_step_sys_date );
- $restore_state = _("List of data to restore:\n\n");
- if ($restore_sys) {
- $restore_state .= "- Restore System Files.\n";
- $restore_state .= " - from date: $tmp[0] $tmp[1]\n";
- }
- if ($restore_user) {
- $restore_state .= "- Restore User Files: \n";
- $restore_state .= "\t\t$_\n" foreach @user_list_to_restore2;
- push @user_list_to_restore,
- ( split ( ',', $_ ) )[0] foreach @user_list_to_restore2;
- }
- if ($restore_other) {
- $restore_state .= "- Restore Other Files: \n";
- -f "$path_to_find_restore/list_other"
- and $restore_state .= "\t\t$_\n" foreach
- split ( "\n", cat_("$path_to_find_restore/list_other") );
- }
- if ($restore_other_path) {
- $restore_state .= "- Path to Restore: $restore_path \n";
- }
-}
-
-sub select_most_recent_selected_of {
- my ($user_name) = @_;
- my @list_tmp2;
- my @tmp = sort @user_list_to_restore2;
- foreach ( grep /$user_name\_/, sort @tmp ) { push @list_tmp2, $_; }
- return pop @list_tmp2;
-}
-
-sub select_user_data_to_restore {
- my $var_eq = 1;
- my @list_backup = ();
- my @list_tmp = ();
- my @list_tmp2 = ();
- @user_list_to_restore = ();
-
- -d $path_to_find_restore
- and my @list_backup_tmp2 = grep /^backup/, all($path_to_find_restore);
- @list_tmp2 = @list_backup_tmp2;
- foreach (@list_backup_tmp2) {
- s/\_base//gi;
- s/\_incr//gi;
- push @list_backup, $_;
- }
- foreach my $var_tmp (@user_list_backuped) {
- $var_eq = 1;
- my $more_recent =
- ( split ( ' ', select_most_recent_selected_of($var_tmp) ) )[0];
- foreach ( grep /^backup\_user\_$var_tmp\_/, sort @list_backup ) {
- s/.tar.gz//gi;
- s/.tar.bz2//gi;
- if ($more_recent) {
- if ( $_ =~ /$more_recent/ ) {
- push @list_tmp, $_;
- $var_eq = 0;
- }
- else { $var_eq and push @list_tmp, $_; }
- }
- }
- }
- foreach my $var_to_restore (@list_tmp) {
- $var_to_restore =~ s/backup_//gi;
- foreach my $var_exist ( sort @list_tmp2 ) {
- if ( $var_exist =~ /$var_to_restore/ ) {
- push @user_list_to_restore, $var_exist;
- }
- }
- }
- $DEBUG
- and print "(incremental restore) real user list to restore : $_ \n"
- foreach (@user_list_to_restore);
-}
-
-sub select_sys_data_to_restore {
- my $var_eq = 1;
- my @list_tmp = ();
- @sys_list_to_restore = ();
-
- -d $path_to_find_restore
- and @list_tmp = grep /^backup/, all($path_to_find_restore);
- my @more_recent = split ( ' ', $restore_step_sys_date );
- my $more_recent = pop @more_recent;
- foreach my $var_exist ( grep /\_sys\_/, sort @list_tmp ) {
- if ( $var_exist =~ /$more_recent/ ) {
- push @sys_list_to_restore, $var_exist;
- $var_eq = 0;
- }
- else { $var_eq and push @sys_list_to_restore, $var_exist; }
- }
- $DEBUG
- and print "sys list to restore: $_\n " foreach (@sys_list_to_restore);
-}
-
-sub valid_backup_test {
- my (@files_list) = @_;
- @files_corrupted = ();
- my $is_corrupted = 0;
- foreach (@files_list) {
- if ( system("gzip -l $path_to_find_restore/$_") > 1 ) {
- push @files_corrupted, $_;
- $is_corrupted = -1;
- }
- }
- return $is_corrupted;
-}
-
-sub restore_aff_backup_problems {
- my $do_restore;
- my $button_restore;
- my $text = new Gtk::Text( undef, undef );
- my ( $pix_warn_map, $pix_warn_mask ) = gtkcreate_png('warning');
- my $restore_pbs_state = _("List of data corrupted:\n\n");
- $restore_pbs_state .= "\t\t$_\n" foreach @files_corrupted;
- $restore_pbs_state .= _("Please uncheck or remove it on next time.");
- gtktext_insert( $text, $restore_pbs_state );
- button_box_restore_main();
-
- gtkpack(
- $advanced_box,
- $do_restore = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 0,
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 15 ), 1,
- new Gtk::VBox( 0, 5 ), 0,
- new Gtk::Pixmap( $pix_warn_map, $pix_warn_mask ), 0,
- _("Backup files are corrupted"), 1,
- new Gtk::VBox( 0, 5 ),
- ),
- 0,
- new Gtk::VBox( 0, 10 ),
- 1,
- createScrolledWindow($text),
- ),
- );
- button_box_restore_pbs_end();
- fonction_env( \$do_restore, \&restore_aff_backup_problems,
- "", "restore_pbs" );
- $up_box->show_all();
-}
-
-sub restore_aff_result {
- my $do_restore;
- my $text = new Gtk::Text( undef, undef );
- gtktext_insert( $text, $restore_state );
- button_box_restore_main();
-
- gtkpack(
- $advanced_box,
- $do_restore = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 0,
- _(" All your selectionned data have been "),
- 0,
- _( " Successfuly Restored on %s ", $restore_path ),
- 1,
- new Gtk::VBox( 0, 10 ),
- ),
- );
- button_box_build_backup_end();
- $central_widget = \$do_restore;
- $up_box->show_all();
-
-}
-
-sub return_path {
- my ($username) = @_;
- my $usr;
- my $home_dir;
- my $passwdfile = "/etc/passwd";
- open( PASSWD, $passwdfile ) or exit 1;
- while ( defined( my $line = <PASSWD> ) ) {
- chomp($line);
- ( $usr, $home_dir ) = ( split ( /:/, $line ) )[ 0, 5 ];
- last if ( $usr eq $username );
- }
- close(PASSWD);
- return $home_dir;
-}
-
-sub restore_backend {
- my $untar_cmd;
- my $exist_problem = 0;
- my $user_dir;
- if ( grep /tar.gz$/, all($path_to_find_restore) ) { $untar_cmd = 0; }
- else { $untar_cmd = 1; }
- if ($restore_user) {
- if ($backup_user_versions) {
- select_user_data_to_restore();
- if ( valid_backup_test(@user_list_to_restore) == -1 ) {
- $exist_problem = 1;
- restore_aff_backup_problems();
- }
- else {
- foreach (@user_list_to_restore) {
- my ( $tnom, $username, $theure2 ) =
- /^(\w+\_\w+\_user_)(.*)_(\d+\_\d+.*)$/;
- $DEBUG
- and print
-"user name to restore: $username, user directory: $user_dir\n";
- if ($remove_user_before_restore) {
- $user_dir = return_path($username);
- -d $user_dir and rm_rf($user_dir);
- }
- $untar_cmd
- or system(
- " tar xfz $path_to_find_restore/$_ -C $restore_path");
- $untar_cmd
- and system(
-"/usr/bin/bzip2 -cd $path_to_find_restore/$_ | tar xf -C $restore_path "
- );
- }
- }
- }
- }
- if ($restore_sys) {
- if ($backup_sys_versions) {
- select_sys_data_to_restore();
- if ( valid_backup_test(@sys_list_to_restore) == -1 ) {
- $exist_problem = 1;
- restore_aff_backup_problems();
- }
- else {
- $untar_cmd
- or
- system("tar xfz $path_to_find_restore/$_ -C $restore_path ")
- foreach @sys_list_to_restore;
- $untar_cmd
- and system(
-"/usr/bin/bzip2 -cd $path_to_find_restore/$_ | tar xf -C $restore_path "
- ) foreach @sys_list_to_restore;
- }
- }
- else {
- $untar_cmd
- or system(
-"tar xfz $path_to_find_restore/backup_sys.tar.gz -C $restore_path "
- );
- $untar_cmd
- and system(
-"/usr/bin/bzip2 -cd $path_to_find_restore/backup_sys.tar.bz2 | tar xf -C $restore_path "
- );
- }
- }
- if ($restore_other) {
- $untar_cmd
- or system(
-"tar xfz $path_to_find_restore/backup_other.tar.gz -C $restore_path "
- );
- $untar_cmd
- and system(
-"/usr/bin/bzip2 -cd $path_to_find_restore/backup_other.tar.bz2 | tar xf -C $restore_path "
- );
- }
- $exist_problem or restore_aff_result();
-}
-
-sub restore_do {
- if ($backup_bef_restore) {
- if ($restore_sys) { $backup_sys = 1; }
- else { $backup_sys = 0; }
- if ($restore_user) {
- $backup_user = 1;
- @user_list = @user_list_to_restore;
- }
- else { $backup_user = 0; }
- build_backup_status();
- read_conf_file();
- build_backup_files();
- $table->destroy();
- }
- restore_do2();
-}
-
-sub restore_do2 {
- my $do_restore;
- my $button_restore;
- my $text = new Gtk::Text( undef, undef );
- restore_state();
- gtktext_insert( $text, $restore_state );
- button_box_restore_main();
-
- gtkpack(
- $advanced_box,
- $do_restore = gtkpack_(
- new Gtk::VBox( 0, 10 ), 0,
- _(" Restore Configuration "), 1,
- createScrolledWindow($text),
- ),
- );
- button_box_restore_end();
- fonction_env( \$do_restore, \&restore_do2, \&restore_box, "restore" );
- $up_box->show_all();
-}
-
-sub restore_step_other {
- my $retore_step_other;
- my $text = new Gtk::Text( undef, undef );
- my $other_rest = cat_("$path_to_find_restore/list_other");
- gtktext_insert( $text, $other_rest );
- gtkpack(
- $advanced_box,
- $retore_step_other = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 1,
- createScrolledWindow($text),
- 0,
- my $check_restore_other_sure =
- new Gtk::CheckButton( _("OK to restore the other files.") ),
- 1,
- new Gtk::VBox( 0, 10 ),
- ),
- );
- check_list( [ $check_restore_other_sure, \$restore_other ] );
- fonction_env( \$retore_step_other, \&restore_step_other, \&restore_step2,
- "restore", \&restore_do );
- $up_box->show_all();
-}
-
-my %check_user_to_restore;
-
-sub restore_step_user {
- my $retore_step_user;
- my @tmp_list = sort @user_backuped;
- @user_backuped = @tmp_list;
-
- gtkpack(
- $advanced_box,
- $retore_step_user = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 0,
- new Gtk::VBox( 0, 10 ),
- 0,
- _(
-"User list to restore (only the most recent date per user is important)"
- ),
- 1,
- createScrolledWindow(
- gtkpack__(
- new Gtk::VBox( 0, 0 ),
- map {
- my $name;
- my $var2;
- my $name_complet = $_;
- $name = ( split ( ' ', $name_complet ) )[0];
- my @user_list_tmp = ();
-
- my $b = new Gtk::CheckButton($name_complet);
- if ( grep $name_complet, @user_list_to_restore2 ) {
- gtkset_active( $b, 1 );
- $check_user_to_restore{$name_complet}[1] = 1;
- }
- else {
- gtkset_active( $b, 0 );
- $check_user_to_restore{$name_complet}[1] = 0;
- }
- $b->signal_connect(
- toggled => sub {
- if ( !$check_user_to_restore{$name_complet}[1] )
- {
- $check_user_to_restore{$name_complet}[1] =
- 1;
- if (
- !grep ( /$name/,
- @user_list_to_restore2 ) )
- {
- push @user_list_to_restore2,
- $name_complet;
- }
- }
- else {
- $check_user_to_restore{$name_complet}[1] =
- 0;
- foreach (@user_list_to_restore2) {
- $var2 = ( split ( ' ', $_ ) )[0];
- if ( $name ne $var2 ) {
- push @user_list_tmp, $_;
- }
- }
- @user_list_to_restore2 = @user_list_tmp;
- }
- }
- );
- $b
- } (@user_backuped)
- ),
- ),
- ),
- );
- if ($restore_other) {
- fonction_env( \$retore_step_user, \&restore_step_user, "", "restore",
- \&restore_step_other );
- }
- else {
- fonction_env( \$retore_step_user, \&restore_step_user, "", "restore",
- \&restore_do );
- }
- $up_box->show_all();
-}
-
-sub restore_step_sys {
- my $restore_step_sys;
- my $combo_restore_step_sys = new Gtk::Combo();
- $combo_restore_step_sys->set_popdown_strings(@sys_backuped);
-
- gtkpack(
- $advanced_box,
- $restore_step_sys = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 0,
- my $check_backup_before =
- new Gtk::CheckButton( _("Backup the system files before:") ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ), 1,
- _("please choose the date to restore"), 0,
- $combo_restore_step_sys, 0,
- new Gtk::HBox( 0, 10 ),
- ),
- 1,
- new Gtk::VBox( 0, 10 ),
- ),
- );
- $combo_restore_step_sys->entry->signal_connect(
- 'changed',
- sub {
- $restore_step_sys_date = $combo_restore_step_sys->entry->get_text();
- }
- );
- $combo_restore_step_sys->entry->set_text($restore_step_sys_date);
- fonction_env( \$restore_step_sys, \&restore_step_sys, "", "restore", );
- if ($restore_user) {
- fonction_env( \$restore_step_sys, \&restore_step_sys, "", "restore",
- \&restore_step_user );
- }
- elsif ($restore_other) {
- fonction_env( \$restore_step_sys, \&restore_step_sys, "", "restore",
- \&restore_step_other );
- }
- else {
- fonction_env( \$restore_step_sys, \&restore_step_sys, "", "restore",
- \&restore_do );
- }
- $up_box->show_all();
-}
-
-sub restore_other_media_hd {
- my ($previous_function) = @_, my $box_where_hd;
- my $button;
- my $adj = new Gtk::Adjustment 550.0, 1.0, 10000.0, 1.0, 5.0, 0.0;
- my ( $pix_fs_map, $pix_fs_mask ) = gtkcreate_png("ic82-dossier-32");
-
- gtkpack(
- $advanced_box,
- $box_where_hd = gtkpack_(
- new Gtk::VBox( 0, 6 ),
- 0,
- new Gtk::HSeparator,
- 0,
- my $check_where_hd =
- new Gtk::CheckButton( _("Use Hard Disk to backup") ),
- 0,
- new Gtk::HSeparator,
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label( _("Please enter the directory to save:") ),
- $where_hd
- ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- $save_path_entry = new Gtk::Entry(), $where_hd
- ),
- 152, 20
- ),
- 0,
- gtkset_sensitive(
- $button = gtksignal_connect(
- new Gtk::Button(),
- clicked => sub {
- filedialog_where_hd();
- }
- ),
- $where_hd
- ),
- ),
- 0,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please enter the maximum size\n allowed for Drakbackup"
- )
- ),
- $where_hd
- ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- my $spinner = new Gtk::SpinButton( $adj, 0, 0 ),
- $where_hd
- ),
- 200,
- 20
- ),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_sensitive(
- my $check_where_hd_quota =
- new Gtk::CheckButton( _("Use quota for backup files.") ),
- $where_hd
- ),
- 0,
- new Gtk::VBox( 0, 6 ),
- ),
- ),
- );
- check_list( [ $check_where_hd_quota, \$hd_quota ] );
- gtksignal_connect(
- gtkset_active( $check_where_hd, $where_hd ),
- toggled => sub {
- $where_hd = $where_hd ? 0 : 1;
- ${$central_widget}->destroy();
- $current_widget->();
- }
- );
- $button->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_fs_map, $pix_fs_mask )
- )
- );
- $save_path_entry->set_text($save_path);
- $save_path_entry->signal_connect( 'changed',
- sub { $save_path = $save_path_entry->get_text() } );
- if ($previous_function) {
- fonction_env( \$box_where_hd, \&advanced_where_hd, \&$previous_function,
- "" );
- }
- else {
- fonction_env( \$box_where_hd, \&advanced_where_hd, \&advanced_where,
- "" );
- }
- $up_box->show_all();
-}
-
-sub restore_find_net {
- my ($previous_function) = @_, my $box_where_net;
-
- gtkpack(
- $advanced_box,
- $box_where_net = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("FTP Connection") ),
- clicked => sub {
- $box_where_net->destroy();
- if ($previous_function) {
- message_underdevel();
-
- # advanced_where_net_ftp(\&$previous_function);
- }
- else {
- advanced_where_net_ftp();
- }
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Secure Connection") ),
- clicked => sub {
- $box_where_net->destroy();
- if ($previous_function) {
- advanced_where_net_ssh( \&$previous_function );
- }
- else {
- advanced_where_net_ssh();
- }
- }
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- if ($previous_function) {
- fonction_env( \$box_where_net, \&advanced_where_net,
- \&$previous_function, "" );
- }
- else {
- fonction_env( \$box_where_net, \&advanced_where_net, \&advanced_where,
- "" );
- }
- $up_box->show_all();
-}
-
-sub restore_other_media {
- my $box_find_restore;
- my $button;
- my $adj = new Gtk::Adjustment 550.0, 1.0, 10000.0, 1.0, 5.0, 0.0;
- my ( $pix_fs_map, $pix_fs_mask ) = gtkcreate_png("ic82-dossier-32");
-
- gtkpack(
- $advanced_box,
- $box_find_restore = gtkpack_(
- new Gtk::VBox( 0, 6 ),
- 0,
- new Gtk::HSeparator,
- 0,
- my $check_other_media_hd =
- new Gtk::CheckButton( _("Restore from Hard Disk.") ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please enter the directory where backups are stored"
- )
- ),
- $other_media_hd
- ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- $restore_find_path_entry = new Gtk::Entry(),
- $other_media_hd
- ),
- 152, 20
- ),
- 0,
- gtkset_sensitive(
- $button = gtksignal_connect(
- new Gtk::Button(),
- clicked => sub {
- filedialog_restore_find_path();
- }
- ),
- $other_media_hd
- ),
- ),
- 1,
- new Gtk::VBox( 0, 6 ),
-
- # 0, new Gtk::HSeparator,
- # 0, my $check_other_media_net = new Gtk::CheckButton( _("Restore from Network") ),
- # 0, new Gtk::VBox(0, 6),
- # 1, gtkpack(new Gtk::HBox(0,10),
- # new Gtk::VBox(0, 6),
- # gtkset_sensitive(gtksignal_connect(new Gtk::Button("Network"), clicked => sub {
- # ${$central_widget}->destroy();
- # restore_find_net(\&restore_other_media);}), !$other_media_hd ),
- # new Gtk::VBox(0, 6),
- # ),
- # 1, new Gtk::VBox(0, 6),
- # 0, new Gtk::HSeparator,
- 0,
- new Gtk::VBox( 0, 6 ),
- ),
- );
- gtksignal_connect(
- gtkset_active( $check_other_media_hd, $other_media_hd ),
- toggled => sub {
- $other_media_hd = $other_media_hd ? 0 : 1;
- ${$central_widget}->destroy();
- $current_widget->();
- }
- );
-
- # gtksignal_connect(gtkset_active($check_other_media_net, !$other_media_hd), toggled => sub {
- # $other_media_hd = $other_media_hd ? 0 : 1;
- # ${$central_widget}->destroy();
- # $current_widget->();
- # });
- $button->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_fs_map, $pix_fs_mask )
- )
- );
- $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, "other_media"
- );
- $up_box->show_all();
-}
-
-sub restore_step2 {
- my $retore_step2;
- my $other_exist;
- my $sys_exist;
- my $user_exist;
-
- if ( -f "$save_path/backup_other*" ) { $other_exist = 1; }
- else { my $other_exist = 0; $restore_other = 0; }
- if ( grep /\_sys\_/, grep /^backup/, all("$save_path/") ) {
- $sys_exist = 1;
- }
- else { my $sys_exist = 0; $restore_sys = 0; }
- if ( grep /\_user\_/, grep /^backup/, all("$save_path/") ) {
- $user_exist = 1;
- }
- else { my $user_exist = 0; $restore_user = 0; }
- $backup_sys_versions || $backup_user_versions and $backup_bef_restore = 1;
-
- gtkpack(
- $advanced_box,
- $retore_step2 = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- my $check_restore_other_src =
- new Gtk::CheckButton(
- _("Select another media to restore from") ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- gtksignal_connect(
- new Gtk::Button( _("Other Media") ),
- clicked => sub {
- ${$central_widget}->destroy();
- restore_other_media();
- }
- ),
- $restore_other_src
- ),
- ),
- 0,
- gtkset_sensitive(
- my $check_restore_sys =
- new Gtk::CheckButton( _("Restore system") ),
- $sys_exist
- ),
- 0,
- gtkset_sensitive(
- my $check_restore_user =
- new Gtk::CheckButton( _("Restore Users") ),
- $user_exist
- ),
- 0,
- gtkset_sensitive(
- my $check_restore_other =
- new Gtk::CheckButton( _("Restore Other") ),
- $other_exist
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- my $check_restore_other_path = new Gtk::CheckButton(
- _("select path to restore (instead of / )")
- ),
- 1,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- my $restore_path_entry = new Gtk::Entry(),
- $restore_other_path
- ),
- ),
- 0,
- gtkset_sensitive(
- my $check_backup_bef_restore = new Gtk::CheckButton(
- _(
-"Do new backup before restore (only for incremental backups.)"
- )
- ),
- $backup_sys_versions || $backup_user_versions
- ),
- 0,
- gtkset_sensitive(
- my $check_remove_user_dir = new Gtk::CheckButton(
- _("Remove user directories before restore.")
- ),
- $sys_exist
- ),
- 1,
- new Gtk::VBox( 0, 10 ),
- ),
- );
- foreach (
- [ $check_restore_sys, \$restore_sys ],
- [ $check_backup_bef_restore, \$backup_bef_restore ],
- [ $check_restore_user, \$restore_user ],
- [ $check_remove_user_dir, \$remove_user_before_restore ],
- [ $check_restore_other, \$restore_other ]
- )
- {
- my $ref = $_->[1];
- gtksignal_connect(
- gtkset_active( $_->[0], ${$ref} ),
- toggled => sub {
- ${$ref} = ${$ref} ? 0 : 1;
- if ( !$restore_sys && !$restore_user && !$restore_other ) {
- $next_widget = \&message_norestore_box;
- }
- elsif ( $restore_sys && $backup_sys_versions ) {
- $next_widget = \&restore_step_sys;
- }
- elsif ($restore_user) { $next_widget = \&restore_step_user; }
- elsif ($restore_other) { $next_widget = \&restore_step_other; }
- 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;
- ${$central_widget}->destroy();
- $current_widget->();
- }
- );
- gtksignal_connect(
- gtkset_active( $check_restore_other_src, $restore_other_src ),
- toggled => sub {
- $restore_other_src = $restore_other_src ? 0 : 1;
- ${$central_widget}->destroy();
- $current_widget->();
- }
- );
- fonction_env( \$retore_step2, \&restore_step2, \&restore_box, "restore" );
- if ( !$restore_sys && !$restore_user && !$restore_other ) {
- $next_widget = \&message_norestore_box;
- }
- elsif ( $restore_sys && $backup_sys_versions ) {
- $next_widget = \&restore_step_sys;
- }
- elsif ($restore_user) { $next_widget = \&restore_step_user; }
- elsif ($restore_other) { $next_widget = \&restore_step_other; }
- else { $next_widget = \&restore_do; }
- $restore_path_entry->set_text($restore_path);
- $restore_path_entry->signal_connect( 'changed',
- sub { $restore_path = $restore_path_entry->get_text(); } );
- $up_box->show_all();
-}
-
-sub restore_box {
- my $retore_box;
- my $retore_box3;
- my $check_restore_sys;
- my $check_restore_user;
- my $check_restore_other;
- $path_to_find_restore = $save_path;
- find_backup_to_restore();
- button_box_restore_main();
-
- if ( $other_backuped || $sys_backuped || @user_backuped ) {
- gtkpack(
- $advanced_box,
- $retore_box = gtkpack_(
- new Gtk::HBox( 0, 1 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Restore all backups") ),
- clicked => sub {
- $retore_box->destroy();
- button_box_restore();
- @user_list_to_restore2 = sort @user_backuped;
- $restore_sys = 1;
- $restore_other = 1;
- $restore_user = 1;
- restore_do();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Custom Restore") ),
- clicked => sub {
- $retore_box->destroy();
- button_box_restore();
- restore_step2();
- }
- ),
- 1,
- new Gtk::VBox( 0, 10 ),
- 1,
- new Gtk::VBox( 0, 10 ),
- ),
- 1,
- new Gtk::HBox( 0, 10 ),
- ),
- );
- }
- else {
- gtkpack(
- $advanced_box,
- $retore_box =
- gtkpack_( new Gtk::HBox( 0, 1 ), message_norestorefile_box(), ),
- ),
- ;
- }
- fonction_env( \$retore_box, \&restore_box, \&interactive_mode_box,
- "restore" );
- $up_box->show_all();
-}
-
-################################################ BUTTON_BOX ################################################
-
-# sub generic_button_box {
-# # 1-n - [button name, fonctions associated]
-# $button_box_tmp->destroy();
-# gtkpack($button_box,
-# $button_box_tmp = gtkpack_(new Gtk::HButtonBox,
-# 0, gtksignal_connect(new Gtk::Button($_->[0]), clicked => sub {$_->[1]}) foreach (@_),
-# } ), );
-# }
-
-sub button_box_adv {
- $button_box_tmp->destroy();
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- new Gtk::HButtonBox,
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Cancel") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&$current_widget, $custom_help );
- }
- ),
- 1,
- new Gtk::HBox( 0, 1 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Previous") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $previous_widget->();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Save") ),
- clicked => sub {
- ${$central_widget}->destroy();
- save_conf_file();
- $previous_widget->();
- }
- ),
- ),
- );
-}
-
-# sub button_box_adv {
-# generic_button_box(["cancel", ${$central_widget}->destroy() ]);
-# }
-
-sub button_box_restore_main {
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- gtkpack_(
- new Gtk::HButtonBox,
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Cancel") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&$current_widget, $custom_help );
- }
- ),
- 1,
- new Gtk::HBox( 0, 1 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Previous") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Ok") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- ),
- ),
- );
-}
-
-sub button_box_backup_end {
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- new Gtk::HButtonBox,
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Cancel") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&$current_widget, $custom_help );
- }
- ),
- 1,
- new Gtk::HBox( 0, 1 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Previous") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $previous_widget->();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Build Backup") ),
- clicked => sub {
- ${$central_widget}->destroy();
- build_backup_status();
- build_backup_files();
- }
- ),
- ),
- );
-}
-
-sub button_box_wizard_end {
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- new Gtk::HButtonBox,
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Cancel") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&$current_widget, $custom_help );
- }
- ),
- 1,
- new Gtk::HBox( 0, 1 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Previous") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $previous_widget->();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Save") ),
- clicked => sub {
- ${$central_widget}->destroy();
- save_conf_file();
- interactive_mode_box();
- }
- ),
- ),
- );
-}
-
-sub button_box_restore_end {
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- new Gtk::HButtonBox,
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Cancel") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&$current_widget, $custom_help );
- }
- ),
- 1,
- new Gtk::HBox( 0, 1 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Previous") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $previous_widget->();
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Restore") ),
- clicked => sub {
- ${$central_widget}->destroy();
- restore_backend();
- }
- ),
- ),
- );
-}
-
-sub button_box_build_backup_end {
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- new Gtk::HButtonBox,
- 1,
- new Gtk::HBox( 0, 5 ),
- 1,
- new Gtk::HBox( 0, 5 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Ok") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
-
- ),
- );
-}
-
-sub button_box_restore_pbs_end {
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- new Gtk::HButtonBox,
- 1,
- new Gtk::HBox( 0, 5 ),
- 1,
- new Gtk::HBox( 0, 5 ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&$current_widget, $custom_help );
- }
- ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Ok") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
-
- ),
- );
-}
-
-sub button_box_build_backup {
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- new Gtk::HButtonBox,
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Cancel") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&$current_widget, $custom_help );
- }
- ),
- 1,
- new Gtk::HBox( 0, 0 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Previous") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $previous_widget->();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Next") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $next_widget->();
- }
- ),
- ),
- );
-}
-
-sub button_box_restore {
-
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- new Gtk::HButtonBox,
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Cancel") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&$current_widget, $custom_help );
- }
- ),
- 1,
- new Gtk::HBox( 0, 0 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( _("Previous") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $previous_widget->();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Next") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $next_widget->();
- }
- ),
- ),
- );
-}
-
-sub button_box_wizard {
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack_(
- new Gtk::HButtonBox,
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Cancel") ),
- clicked => sub {
- ${$central_widget}->destroy();
- interactive_mode_box();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&$current_widget, $custom_help );
- }
- ),
- 1,
- new Gtk::HBox( 0, 0 ),
- 0,
- gtksignal_connect(
- new Gtk::Button( $next_widget ? _("Previous") : _("OK") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $previous_widget ? $previous_widget->() : $next_widget->();
- }
- ),
- if_(
- $next_widget,
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Next") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $next_widget ? $next_widget->() : $previous_widget->();
- }
- )
- ),
- ),
- );
-}
-
-sub button_box_main {
- $button_box_tmp->destroy();
-
- gtkpack(
- $button_box,
- $button_box_tmp = gtkpack(
- gtkset_layout( new Gtk::HButtonBox, -start ),
- gtksignal_connect(
- new Gtk::Button( _("Close") ),
- clicked => sub {
- Gtk->main_quit();
- }
- ),
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked => sub {
- ${$central_widget}->destroy();
- adv_help( \&interactive_mode_box, $custom_help );
- }
- ),
- ),
- );
-}
-
-################################################ MESSAGES ################################################
-
-sub message_norestorefile_box {
- $box2->destroy();
- my ( $pix_warn_map, $pix_warn_mask ) = gtkcreate_png('warning');
-
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack(
- new Gtk::HBox( 0, 15 ),
- new Gtk::VBox( 0, 5 ),
- new Gtk::Pixmap( $pix_warn_map, $pix_warn_mask ),
- _(
-"Please Build backup before to restore it...\n or verify that your path to save is correct."
- ),
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- button_box_restore_main();
- $central_widget = \$box2;
- $up_box->show_all();
-}
-
-sub send_mail_pb {
- $table->destroy();
- my ( $pix_warn_map, $pix_warn_mask ) = gtkcreate_png('warning');
-
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- new Gtk::Pixmap( $pix_warn_map, $pix_warn_mask ),
- 0,
- _(
- "Error durind sendmail
- your report mail was not sent
- Please configure sendmail"
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- button_box_restore_main();
- $custom_help = "mail_pb";
- $central_widget = \$box2;
- $up_box->show_all();
-}
-
-sub install_rpm {
- my ($previous_function) = @_, my $box_what_user;
-
- gtkpack(
- $advanced_box,
- $box_what_user = gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 0,
- _("Package List to Install"),
- 0,
- new Gtk::HSeparator,
- 0,
- createScrolledWindow(
- gtkpack__(
- new Gtk::VBox( 0, 0 ),
- map { my $b = new Gtk::Button($_); }
- (@list_of_rpm_to_install)
- ),
- ),
- ),
- );
- fonction_env( \$box_what_user, \&install_rpm, \&$previous_function,
- "what" );
- $up_box->show_all();
-}
-
-sub client_ftp_pb {
- $table->destroy();
- my ( $pix_warn_map, $pix_warn_mask ) = gtkcreate_png('warning');
-
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- new Gtk::Pixmap( $pix_warn_map, $pix_warn_mask ),
- 0,
- _(
- "Error durind sending file via FTP.
- Please correct your FTP configuration."
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- button_box_restore_main();
- $custom_help = "mail_pb";
- $central_widget = \$box2;
- $up_box->show_all();
-}
-
-sub message_norestore_box {
- $box2->destroy();
- my ( $pix_warn_map, $pix_warn_mask ) = gtkcreate_png('warning');
-
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack(
- new Gtk::HBox( 0, 15 ),
- new Gtk::VBox( 0, 5 ),
- new Gtk::Pixmap( $pix_warn_map, $pix_warn_mask ),
- _("Please select data to restore..."),
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- button_box_restore_main();
- $central_widget = \$box2;
- $up_box->show_all();
-}
-
-sub message_noselect_box {
- $box2->destroy();
- my ( $pix_warn_map, $pix_warn_mask ) = gtkcreate_png('warning');
-
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack(
- new Gtk::HBox( 0, 15 ),
- new Gtk::VBox( 0, 5 ),
- new Gtk::Pixmap( $pix_warn_map, $pix_warn_mask ),
- _("Please select media for backup..."),
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- $previous_widget = \&wizard_step2;
- $next_widget = \&wizard_step2;
- $central_widget = \$box2;
- $up_box->show_all();
-}
-
-sub message_noselect_what_box {
- $box2->destroy();
- my ( $pix_warn_map, $pix_warn_mask ) = gtkcreate_png('warning');
-
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack(
- new Gtk::HBox( 0, 15 ),
- new Gtk::VBox( 0, 5 ),
- new Gtk::Pixmap( $pix_warn_map, $pix_warn_mask ),
- _("Please select data to backup..."),
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- $previous_widget = \&wizard;
- $next_widget = \&wizard;
- $central_widget = \$box2;
- $up_box->show_all();
-}
-
-sub message_noconf_box {
- $box2->destroy();
- my ( $pix_warn_map, $pix_warn_mask ) = gtkcreate_png('warning');
-
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack(
- new Gtk::HBox( 0, 15 ),
- new Gtk::VBox( 0, 5 ),
- new Gtk::Pixmap( $pix_warn_map, $pix_warn_mask ),
- _(
-"No configuration file found \nplease click Wizard or Advanced."
- ),
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- button_box_restore_main();
- $central_widget = \$box2;
- $up_box->show_all();
-}
-
-sub message_underdevel {
- $box2->destroy();
- my ( $pix_warn_map, $pix_warn_mask ) = gtkcreate_png('warning');
-
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack(
- new Gtk::HBox( 0, 15 ),
- new Gtk::VBox( 0, 5 ),
- new Gtk::Pixmap( $pix_warn_map, $pix_warn_mask ),
- _("Under Devel ... please wait."),
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- $central_widget = \$box2;
- $up_box->show_all();
-}
-
-################################################ BUILD_BACKUP ################################################
-
-sub progress {
- my ( $progressbar, $incr, $label_text ) = @_;
- my ($new_val) = $progressbar->get_current_percentage;
- $new_val += $incr;
- if ( $new_val > 1 ) { $new_val = 1 }
- $progressbar->update($new_val);
- $progressbar->{label}->set($label_text);
- Gtk->main_iteration while Gtk->events_pending;
-}
-
-sub find_backup_to_put_on_cd {
- my @list_backup_tmp;
- my @data_backuped_tmp;
- @data_backuped = ();
- -d $save_path and my @list_backup = all($save_path);
- foreach ( grep /^backup_other/, @list_backup ) {
- $other_backuped = 1;
- chomp;
- my $tail = ( split ( ' ', `du $save_path/$_` ) )[0];
- s/^backup_other//gi;
- s/.tar.gz$//gi;
- s/.tar.bz2$//gi;
- my @user_date = split ( /\_20/, $_ );
- my @user_date2 = split ( /\_/, $user_date[1] );
- my $to_put =
-" other_data, (tail: $tail ko, date: 20$user_date2[0], hour: $user_date2[1])";
- push @data_backuped, $to_put;
- }
- foreach ( grep /_sys_/, @list_backup ) {
- $sys_backuped = 1;
- chomp;
- my $tail = ( split ( ' ', `du $save_path/$_` ) )[0];
- s/^backup_other//gi;
- s/.tar.gz$//gi;
- s/.tar.bz2$//gi;
- my @user_date = split ( /\_20/, $_ );
- my @user_date2 = split ( /\_/, $user_date[1] );
- my $to_put =
-" system, (tail: $tail ko, date: 20$user_date2[0], hour: $user_date2[1])";
- push @data_backuped, $to_put;
- }
- foreach ( grep /user_/, @list_backup ) {
- chomp;
- my $tail = ( split ( ' ', `du $save_path/$_` ) )[0];
- s/^backup_user_//gi;
- s/.tar.gz$//gi;
- s/.tar.bz2$//gi;
- my @user_date = split ( /\_20/, $_ );
- my @user_date2 = split ( /\_/, $user_date[1] );
- my $to_put =
-" $user_date[0], (tail: $tail ko, date: 20$user_date2[0], hour: $user_date2[1])";
- push @data_backuped, $to_put;
- }
-}
-
-sub build_backup_status {
- $pbar = new Gtk::ProgressBar;
- $pbar1 = new Gtk::ProgressBar;
- $pbar2 = new Gtk::ProgressBar;
- $pbar3 = new Gtk::ProgressBar;
- button_box_build_backup_end();
- gtkpack(
- $advanced_box,
- $table = create_packtable(
- { col_spacings => 10, row_spacings => 5 },
- [""],
- [""],
- [""],
- [""],
- [""],
- [""],
- [""],
- [""],
- [ _("Backup system files") ],
- [ $pbar, $pbar->{label} = new Gtk::Label(' ') ],
- [ _("Backup user files") ],
- [ $pbar1, $pbar1->{label} = new Gtk::Label(' ') ],
- [ _("Backup other files") ],
- [ $pbar2, $pbar2->{label} = new Gtk::Label(' ') ],
- [ _("Total Progress") ],
- [ $pbar3, $pbar3->{label} = new Gtk::Label(' ') ],
- ),
- );
- $custom_help = "options";
- $central_widget = \$table;
- $up_box->show_all();
- Gtk->main_iteration while Gtk->events_pending;
-}
-
-sub build_backup_ftp_status {
- $pbar = new Gtk::ProgressBar;
- $pbar3 = new Gtk::ProgressBar;
- $table->destroy();
- button_box_build_backup_end();
- $pbar->set_value(0);
- $pbar3->set_value(0);
-
- gtkpack(
- $advanced_box,
- $table = gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- _("files sending by FTP"),
- 1,
- new Gtk::VBox( 0, 15 ),
- 1,
- create_packtable(
- { col_spacings => 10, row_spacings => 5 },
-
- # [ $pbar->set_show_text( $show_text );
- [ _("Sending files...") ],
- [""],
- [ $pbar->{label} = new Gtk::Label(' ') ],
- [$pbar],
- [""],
- [ _("Total Progress") ],
- [ $pbar3->{label} = new Gtk::Label(' ') ],
- [$pbar3],
- ),
- 1,
- new Gtk::VBox( 0, 15 ),
- ),
- );
- $custom_help = "options";
- $central_widget = \$table;
- $up_box->show_all();
- Gtk->main_iteration while Gtk->events_pending;
-}
-
-sub build_backup_box_see_conf {
- my $box2;
- my $text = new Gtk::Text( undef, undef );
- system_state();
- gtktext_insert( $text, $system_state );
- button_box_restore_main();
-
- gtkpack(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 10 ), 0,
- _("Drakbackup Configuration"), 1,
- createScrolledWindow($text),
- ),
- ),
- );
- button_box_backup_end();
- $custom_help = "";
- $central_widget = \$box2;
- $current_widget = \&build_backup_box_see_conf;
- $previous_widget = \&build_backup_box;
- $up_box->show_all();
-}
-
-sub build_backup_box_progress {
-
- # build_backup_files();
-}
-
-sub aff_total_tail {
- my @toto = ();
- my $total = 0;
- push @toto, ( split ( ",", $_ ) )[1] foreach @list_to_build_on_cd;
- foreach (@toto) {
- s/\s+\(tail://gi;
- s/\s+//gi;
- s/ko//gi;
- $total += $_;
- }
- $label_tail->set("total tail: $total ko");
-}
-
-my %check_data_to_backup_cd;
-
-sub build_backup_cd_select_data {
- my $retore_step_user;
- find_backup_to_put_on_cd();
- @list_to_build_on_cd = sort @data_backuped;
- @data_backuped = @list_to_build_on_cd;
-
- gtkpack(
- $advanced_box,
- $retore_step_user = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 0,
- new Gtk::VBox( 0, 10 ),
- 0,
- _("Data list to include on CDROM."),
- 1,
- createScrolledWindow(
- gtkpack__(
- new Gtk::VBox( 0, 0 ),
- map {
- my $name = $_;
- my @user_list_tmp = ();
- my $b = new Gtk::CheckButton($name);
- if ( grep $name, @list_to_build_on_cd ) {
- gtkset_active( $b, 1 );
- }
- else {
- gtkset_active( $b, 0 );
- }
- $b->signal_connect(
- toggled => sub {
- if ( !$check_data_to_backup_cd{$name}[1] ) {
- $check_data_to_backup_cd{$name}[1] = 1;
- if (
- !grep ( /$name$/, @list_to_build_on_cd )
- )
- {
- push @list_to_build_on_cd, $name;
- }
- }
- else {
- $check_data_to_backup_cd{$name}[1] = 0;
- foreach (@list_to_build_on_cd) {
- if ( $name ne $_ ) {
- push @user_list_tmp, $_;
- }
- }
- @list_to_build_on_cd = @user_list_tmp;
- }
- aff_total_tail();
- }
- );
- $b
- } (@data_backuped)
- ),
- ),
- 0,
- new Gtk::HSeparator,
- 0,
- $label_tail = new Gtk::Label(" "),
- 0,
- new Gtk::HSeparator,
- ),
- );
- aff_total_tail();
- fonction_env( \$retore_step_user, \&restore_step_user,
- \&build_backup_cd_box, "restore", \&build_backup_box_see_conf );
- $up_box->show_all();
-}
-
-sub build_backup_cd_box {
- my $box_build_backup_cd;
- my $combo_where_cd_time = new Gtk::Combo();
- my $adj = new Gtk::Adjustment 4.0, 1.0, 10000.0, 1.0, 5.0, 0.0;
- $combo_where_cd_time->set_popdown_strings( "650", "700", "750", "800" );
-
- button_box_build_backup();
- gtkpack(
- $advanced_box,
- $box_build_backup_cd = gtkpack_(
- new Gtk::VBox( 0, 6 ),
- 0,
- my $check_where_cd =
- new Gtk::CheckButton( _("Use CD/DVDROM to backup") ),
- 0,
- new Gtk::HSeparator,
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label( _("Please choose your CD space") ),
- $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_usize(
- gtkset_sensitive( $combo_where_cd_time, $where_cd ),
- 100, 20
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label( _("Please enter the cd writer speed") ),
- $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 6 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- my $spinner = new Gtk::SpinButton( $adj, 0, 0 ),
- $where_cd
- ),
- 100, 20
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _("Please check if you are using CDRW media")
- ),
- $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_sensitive(
- my $check_cdrw = new Gtk::CheckButton(), $where_cd
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _("Please check if you want to erase your CDRW before")
- ),
- $cdrw && $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_sensitive(
- my $check_cdrw_erase = new Gtk::CheckButton(),
- $cdrw && $where_cd
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please enter your CD Writer device name (ex: 0,1,0)"
- )
- ),
- $where_cd
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_usize(
- gtkset_sensitive(
- $cd_devive_entry = new Gtk::Entry(), $where_cd
- ),
- 100, 20
- ),
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkset_sensitive(
- new Gtk::Label(
- _(
-"Please check if you want to include install boot on your CD."
- )
- ),
- 0
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 0,
- gtkset_sensitive(
- my $check_cd_with_install_boot = new Gtk::CheckButton(), 0
- ),
- ),
- ),
- );
- foreach ( [ $check_cdrw_erase, \$cdrw_erase ],
- [ $check_cd_with_install_boot, \$cd_with_install_boot ] )
- {
- my $ref = $_->[1];
- gtksignal_connect( gtkset_active( $_->[0], ${$ref} ),
- toggled => sub { ${$ref} = ${$ref} ? 0 : 1; } );
- }
- gtksignal_connect(
- gtkset_active( $check_where_cd, $where_cd ),
- toggled => sub {
- $where_cd = $where_cd ? 0 : 1;
- ${$central_widget}->destroy();
- $current_widget->();
- if ($where_cd) { $next_widget = \&build_backup_cd_select_data; }
- else { $next_widget = \&build_backup_cd_box; }
- }
- );
- gtksignal_connect(
- gtkset_active( $check_cdrw, $cdrw ),
- toggled => sub {
- $cdrw = $cdrw ? 0 : 1;
- ${$central_widget}->destroy();
- $current_widget->();
- }
- );
- if ($where_cd) { $next_widget = \&build_backup_cd_select_data; }
- else { $next_widget = \&build_backup_cd_box; }
- $cd_devive_entry->set_text($cd_devive);
- $cd_devive_entry->signal_connect( 'changed',
- sub { $cd_devive = $cd_devive_entry->get_text(); } );
- $combo_where_cd_time->entry->set_text($cd_time);
- $combo_where_cd_time->entry->signal_connect( 'changed',
- sub { $cd_time = $combo_where_cd_time->entry->get_text() } );
- fonction_env( \$box_build_backup_cd, \&build_backup_cd_box,
- \&build_backup_box, "" );
- $up_box->show_all();
-}
-
-sub build_backup_box {
- $box2->destroy();
- my ( $pix_cd_map, $pix_cd_mask ) = gtkcreate_png("ic82-CD-40");
- my ( $pix_hd_map, $pix_hd_mask ) = gtkcreate_png("ic82-discdurwhat-40");
- my ( $pix_options_map, $pix_options_mask ) =
- gtkcreate_png("ic82-moreoption-40");
-
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtksignal_connect(
- my $button_from_conf_file = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- build_backup_box_see_conf();
- }
- ),
- 0,
- new Gtk::VBox( 0, 5 ),
-
- # 1, gtksignal_connect(my $button_on_cd = new Gtk::Button(),
- # clicked => sub { ${$central_widget}->destroy();
- # $where_cd = 1;
- # build_backup_cd_box();
- # }),
- # 0, new Gtk::VBox(0, 5),
- 1,
- gtksignal_connect(
- my $button_see_conf = new Gtk::Button(),
- clicked => sub {
- ${$central_widget}->destroy();
- build_backup_box_see_conf();
- }
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
-
- $button_from_conf_file->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_hd_map, $pix_hd_mask ),
- new Gtk::Label( _("Backup Now from configuration file") ),
- new Gtk::HBox( 0, 5 )
- )
- );
-
- # $button_on_cd->add(gtkpack(new Gtk::HBox(0,10),
- # new Gtk::Pixmap($pix_cd_map, $pix_cd_mask),
- # new Gtk::Label(_("Backup Now on CDROM")),
- # new Gtk::HBox(0, 5)
- # ));
- $button_see_conf->add(
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::Pixmap( $pix_options_map, $pix_options_mask ),
- new Gtk::Label( _("View Backup Configuration.") ),
- new Gtk::HBox( 0, 5 )
- )
- );
-
- button_box_restore_main();
- fonction_env( \$box2, \&build_backup_box, \&interactive_mode_box,
- "options" );
- $up_box->show_all();
-}
-
-################################################ INTERACTIVE ################################################
-
-sub interactive_mode_box {
- $box2->destroy();
-
- read_conf_file();
- gtkadd(
- $advanced_box,
- $box2 = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 15 ),
- 1,
- new Gtk::VBox( 0, 5 ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Wizard Configuration") ),
- clicked => sub {
- ${$central_widget}->destroy();
- read_conf_file();
- wizard();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Advanced Configuration") ),
- clicked => sub {
- button_box_adv();
- ${$central_widget}->destroy();
- advanced_box();
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Backup Now") ),
- clicked => sub {
- ${$central_widget}->destroy();
- if ($cfg_file_exist) { build_backup_box(); }
- else { message_noconf_box(); }
- }
- ),
- 1,
- gtksignal_connect(
- new Gtk::Button( _("Restore") ),
- clicked =>
- sub { ${$central_widget}->destroy(); restore_box(); }
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- 1,
- new Gtk::VBox( 0, 5 ),
- ),
- );
- button_box_main();
- $custom_help = "main";
- $central_widget = \$box2;
- $up_box->show_all();
-}
-
-sub interactive_mode {
- $interactive = 1;
- my $box;
- my $window1 =
- $::isEmbedded ? new Gtk::Plug($::XID) : new Gtk::Window -toplevel;
- init Gtk;
- $window1->signal_connect( delete_event => sub { Gtk->exit(0) } );
- $window1->set_position(1);
- $window1->set_title( _("Drakbackup") );
- my ( $pix_u_map, $pix_u_mask ) = gtkcreate_png("drakbackup.540x57");
- read_conf_file();
-
- gtkadd(
- $window1,
- gtkpack(
- new Gtk::VBox( 0, 0 ),
- gtkpack(
- gtkset_usize( $up_box = new Gtk::VBox( 0, 5 ), 540, 400 ),
- $box = gtkpack_(
- new Gtk::VBox( 0, 3 ),
- 0,
- new Gtk::Pixmap( $pix_u_map, $pix_u_mask ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 3 ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 0,
- new Gtk::HBox( 0, 5 ),
- 1,
- $advanced_box = gtkpack_(
- new Gtk::HBox( 0, 15 ),
- 1, $box2 = gtkpack_( new Gtk::VBox( 0, 15 ), ),
- ),
- 0,
- new Gtk::HBox( 0, 5 ),
- ),
- ),
- 0,
- new Gtk::HSeparator,
- 0,
- $button_box = gtkpack(
- new Gtk::VBox( 0, 15 ),
- $button_box_tmp = gtkpack( new Gtk::VBox( 0, 0 ), ),
- ),
- ),
- ),
- ),
- );
- interactive_mode_box();
- $custom_help = "main";
- button_box_main();
- $central_widget = \$box2;
- $window1->show_all;
- $window1->realize;
- $window1->show_all();
- Gtk->main;
- Gtk->exit(0);
-}
-
-################################################ HELP & ABOUT ################################################
-
-sub adv_help {
- my ( $function, $custom_help ) = @_,
- my $text = new Gtk::Text( undef, undef );
- my $advanced_box_help;
-
-################################################ help definition ##############################################
-
- my %custom_helps = (
- "options" => _(
- "options description:
-
- In this step Drakbackup allow you to change:
-
- - The compression mode:
-
- If you check bzip2 compression, you will compress
- your data better than gzip (about 2-10 %).
- This option is not checked by default because
- this compression mode needs more time ( about 1000% more).
-
- - The update mode:
-
- This option will update your backup, but this
- option is not really useful because you need to
- decompress your backup before you can update it.
-
- - the .backupignore mode:
-
- Like with cvs, Drakbackup will ignore all references
- included in .backupignore files in each directories.
- ex:
- #> cat .backupignore
- *.o
- *~
- ...
-
-
-"
- ),
- "mail_pb" => _( "
- Some errors during sendmail are caused by
- a bad configuration of postfix. To solve it you have to
- set myhostname or mydomain in /etc/postfix/main.cf
-
-" ),
-
- "what" => _(
- "options description:
-
- - Backup system files:
-
- This option allows you to backup your /etc directory,
- which contains all configuration files. Please be
- careful during the restore step to not overwrite:
- /etc/passwd
- /etc/group
- /etc/fstab
-
- - Backup User files:
-
- This option allows you select all users that you want
- to backup.
- To preserve disk space, it is recommended that you
- do not include web browser's cache.
-
- - Backup Other files:
-
- This option allows you to add more data to save.
- With the other backup it's not possible at the
- moment to select select incremental backup.
-
- - Incremental Backups:
-
- The incremental backup is the most powerful
- option for backup. This option allows you
- to backup all your data the first time, and
- only the changed afterward.
- Then you will be able, during the restore
- step, to restore your data from a specified
- date.
- If you have not selected this option all
- old backups are deleted before each backup.
-
-
-"
- ),
- "restore" => _(
- "restore description:
-
-Only the most recent date will be used ,because with incremental
-backups it is necesarry to restore one by one each older backups.
-
-So if you don't like to restore an user please unselect all his
-check box.
-
-Otherwise, you are able to select only one of this
-
- - Incremental Backups:
-
- The incremental backup is the most powerfull
- option to use backup, this option allow you
- to backup all your data the first time, and
- only the changed after.
- So you will be able during the restore
- step, to restore your data from a specified
- date.
- If you have not selected this options all
- old backups are deleted before each backup.
-
-
-
-"
- ),
- "main" => _(
-" Copyright (C) 2001 MandrakeSoft by DUPONT Sebastien <dupont_s\@epita.fr>"
- )
- . "\n\n"
- . _(
-" 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
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- 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."
- )
- . "\n\n _____________________\n"
- . _(
- "Description:
-
- Drakbackup is used to backup your system.
- During the configuration you can select:
- - System files,
- - Users files,
- - Other files.
- or All your system ... and Other (like Windows Partitions)
-
- Drakbackup allows you to backup your system on:
- - Harddrive.
- - NFS.
- - CDROM (CDRW), DVDROM (with autoboot, rescue and autoinstall.).
- - FTP.
- - Rsync.
- - Webdav.
- - Tape.
-
- Drakbackup allows you to restore your system to
- a user selected directory.
-
- Per default all backup will be stored on your
- /var/lib/drakbackup directory
-
- Configuration file:
- /etc/drakconf/drakbackup/drakbakup.conf
-
-
-Restore Step:
-
- During the restore step, DrakBackup will remove
- your original directory and verify that all
- backup files are not corrupted. It is recommended
- you do a last backup before restoring.
-
-
-"
- ),
- "ftp" => _(
- "options description:
-
-Please be careful when you are using ftp backup, because only
-backups that are already built are sent to the server.
-So at the moment, you need to build the backup on your hard
-drive before sending it to the server.
-
-"
- ),
- "restore_pbs" => _( "
-Restore Backup Problems:
-
-During the restore step, Drakbackup will verify all your
-backup files before restoring them.
-Before the restore, Drakbackup will remove
-your original directory, and you will loose all your
-data. It is important to be careful and not modify the
-backup data files by hand.
-" )
- );
-
- my $default_help =
- _(
-" Copyright (C) 2001 MandrakeSoft by DUPONT Sebastien <dupont_s\@epita.fr>"
- )
- . "\n\n"
- . _(
- " 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
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- 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."
- )
- . "\n\n _____________________\n"
- . _(
- "Description:
-
- Drakbackup is used to backup your system.
- During the configuration you can select
- - System files,
- - Users files,
- - Other files.
- or All your system ... and Other (like Windows Partitions)
-
- Drakbackup allows you to backup your system on:
- - Harddrive.
- - NFS.
- - CDROM (CDRW), DVDROM (with autoboot, rescue and autoinstall.).
- - FTP.
- - Rsync.
- - Webdav.
- - Tape.
-
- Drakbackup allows you to restore your system to
- a user selected directory.
-
- Per default all backup will be stored on your
- /var/lib/drakbackup directory
-
- Configuration file:
- /etc/drakconf/drakbackup/drakbakup.conf
-
-Restore Step:
-
- During the restore step, Drakbackup will remove
- your original directory and verify that all
- backup files are not corrupted. It is recommended
- you do a last backup before restoring.
-
-
-"
- );
-
-################################################ help fonction ##############################################
-
- gtktext_insert( $text, $custom_helps{$custom_help} || $default_help );
- gtkpack(
- $advanced_box,
- $advanced_box_help = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 0 ), 1,
- $text, 0,
- new Gtk::VScrollbar( $text->vadj ),
- ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::HButtonBox, -spread ),
- gtksignal_connect(
- new Gtk::Button( _("OK") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $function->();
- }
- ),
- ),
- )
- );
- $central_widget = \$advanced_box_help;
- $up_box->show_all();
-}
-
-sub to_ok {
- $sav_next_widget = $next_widget;
- $next_widget = undef;
- button_box_wizard();
-}
-
-sub to_normal {
- $next_widget = $sav_next_widget;
-}
diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot
deleted file mode 100755
index 174a40847..000000000
--- a/perl-install/standalone/drakboot
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use common;
-use interactive;
-use any;
-use bootloader;
-use detect_devices;
-use fsedit;
-use fs;
-use c;
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: drakboot [--expert] [--testing]\n";
-
-$::expert = /-expert/;
-$::testing = /-testing/;
-
-my $in = 'interactive'->vnew('su', 'bootloader');
-
-$::lilo_choice = \&lilo_choice;
-
-if ($in->isa('interactive::gtk')) {
- require 'bootlook.pm';
-} else {
- lilo_choice();
-}
-
-!$::isEmbedded and $in->exit(0);
-kill(USR1, $::CCPID);
-goto ask;
-
-sub lilo_choice
-{
- my $bootloader = arch() =~ /ppc/ ? bootloader::read('', '/etc/yaboot.conf') : bootloader::read('', '/etc/lilo.conf');
- local ($_) = `detectloader`;
- $bootloader->{methods} = { lilo => 1, grub => !!/grub/i, if_(arch() =~ /ppc/, yaboot => 1) };
-
- my ($all_hds) = catch_cdie { fsedit::hds([ detect_devices::hds() ], {}) } sub { 1 };
- my $fstab = [ fsedit::get_all_fstab($all_hds) ];
- fs::merge_info_from_fstab($fstab);
-
- $::expert=1;
-
- ask:
- local $::isEmbedded = 0;
- any::setupBootloader($in, $bootloader, $all_hds, $fstab, $ENV{SECURE_LEVEL}) or return;
- eval { bootloader::install('', $bootloader, $fstab, $all_hds->{hds}) };
-
- my $loader = arch() =~ /ppc/ ? "Yaboot" : "LILO";
- if ($@) {
- $in->ask_warn('',
- [ _("Installation of %s failed. The following error occured:", $loader),
- grep { !/^Warning:/ } cat_("/tmp/.error") ]);
- unlink "/tmp/.error";
- goto ask;
- }
-}
diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug
deleted file mode 100755
index 007237b98..000000000
--- a/perl-install/standalone/drakbug
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/bin/perl
-
-# Drak Bug Report
-# Copyright (C) 2002 MandrakeSoft (daouda@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 lib qw(/usr/lib/libDrakX);
-
-use standalone;
-use interactive;
-use MDK::Common;
-require Gtk;
-require Gtk::Gdk::ImlibImage;
-use my_gtk qw(:helpers :wrappers :ask);
-use Config;
-
-Gtk::Gdk::ImlibImage->init;
-
-my $in = 'interactive'->vnew;
-
-$::bugzilla_url = "https://qa.mandrakesoft.com";
-
-my $window_g = new Gtk::Window -toplevel;
-$window_g->set_policy($false,$false,$true);
-$window_g->set_position( 1 );
-$window_g->border_width( 5 );
-$window_g->set_title(_("Mandrake Bug Report Tool"));
-#$window_g->set_usize(540, 350);
-$window_g->signal_connect( "delete_event", \&quit_global);
-
-chomp(my $kernel_release = `uname -r`);
-$kernel_release.="";
-chomp(my $mdk_release = cat_("/etc/mandrake-release"));
-
-my $mdk_app = {
- _("Mandrake Control Center") => 'drakconf',
- _("First Time Wizard") => 'drakfw',
- _("Synchronization tool") => 'draksync',
- _("Standalone Tools") =>['adduserdrake','diskdrake','drakautoinst','drakbackup','drakboot','drakbug','drakfloppy','drakfont','drakgw','drakconnect','drakxservices','drakxtv','keyboardrake','logdrake','mousedrake','net_monitor','printerdrake','scannerdrake','tinyfirewall','XFdrake'],
- _("HardDrake") => 'harddrake2',
- _("Mandrake Online") => ['mdkonline','mdkupdate'],
- _("Menudrake") => 'menudrake',
- _("Msec") => 'msec',
- _("Remote Control") => 'rfbdrake',
- _("Software Manager") => ['rpmdrake','MandrakeUpdate'],
- _("Urpmi") => ['urpmi','urpmq','urpme'],
- _("Windows Migration tool") => 'transfugdrake',
- _("Userdrake") => 'userdrake',
- _("Configuration Wizards") => 'wizdrake',
- };
-my @generic_tool = keys %{$mdk_app};
-my @all_drakxtools = @ { $mdk_app->{_("Standalone Tools")} };
-push(@generic_tool,@all_drakxtools);
-
-gtkpack2__(
- gtkpack2__(my $vbx = new Gtk::VBox(0,5),
- gtkpack(new Gtk::HBox(0,0),
- gtkpack(new Gtk::Label(_("Application:"))),
- gtkpack(gtkcombo_setpopdown_strings(my $comb_app = new Gtk::Combo(),("",@generic_tool))),
- ),
- gtkpack(new Gtk::HBox(0,5),
- gtkpack(new Gtk::Label(_("Package: "))),
- gtkpack(gtkset_text(my $version = new Gtk::Entry(50),"...")),
- ),
- gtkpack(new Gtk::HBox(0,5),
- gtkpack(new Gtk::Label(_("Kernel:"))),
- gtkpack(gtkset_text(my $kernel_rel = new Gtk::Entry(50),"$kernel_release")),
- ),
- gtkpack(new Gtk::HBox(0,0),
- gtkpack(new Gtk::Label(_("Release: "))),
- gtkpack(gtkset_text(my $compiler = new Gtk::Entry(50),"$mdk_release")),
- ),
- gtkpack(new Gtk::HBox(0,0),
- gtkpack(gtkset_justify(new Gtk::Label(_("\n\nTo submit a bug report, click on the button report.\nThis will open a web browser window on https://www.bugzilla.com\n where you'll find a form to fill in.The information displayed above will be \ntransferred to that server\n\n")),"left")),
- ),
- gtkpack(new Gtk::HSeparator),
-
- ),
- );
-$comb_app->entry->signal_connect('changed', sub {
- if (($text = $comb_app->entry->get_text()) ne '') {
- if (member($text,@all_drakxtools)) {chomp($app_choice = `rpm -q drakxtools`) } else {
-
- exists $mdk_app->{$text}[1] ? chomp($which_app =`which '$mdk_app->{$text}[1]'`) : chomp($which_app = `which '$mdk_app->{$text}'`);
- chomp($app_choice = `rpm -qf '$which_app'`);
- }
- $app_choice !~ m/ / ? $version->set_text("$app_choice") : $version->set_text(_("Not installed"));
- }
- }
- );
-my $kernel = $kernel_rel->get_chars(0,-1);
-my $hbx = new Gtk::HBox(0,0);
-my $Close_Button = new Gtk::Button(_("Close"));
-$Close_Button->signal_connect(clicked => sub { Gtk->exit(0)});
-$hbx->pack_start($Close_Button,0,0,0);
-my $Report_Button = new Gtk::Button(_("Report"));
-$Report_Button->signal_connect(clicked => sub { connect_bugzilla("https://qa.mandrakesoft.com/wizard/");});
-$hbx->pack_end($Report_Button,0,0,0);
-$vbx->pack_start($hbx,0,0,0);
-$window_g->add($vbx);
-
-$window_g->show_all();
-Gtk->main();
-Gtk->exit(0);
-in->exit(0);
-
-sub connect_bugzilla {
- my($url) = @_;
- my $w = $in->wait_message('',_("connecting to Bugzilla wizard ..."));
- exec $ENV{BROWSER},$url if $ENV{BROWSER};
- $in->ask_warn('', _("No browser available please! Please install one"));
-}
-
-sub read_app_context {
- my ($name) = @_;
-}
-
-sub quit_global {
- Gtk->exit(0);
-}
-
-
-
diff --git a/perl-install/standalone/drakbug_report b/perl-install/standalone/drakbug_report
deleted file mode 100755
index 6b70acb35..000000000
--- a/perl-install/standalone/drakbug_report
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-
-use MDK::Common;
-use any;
-
-my %other = (
- 'rpm -qa' => join('', sort `rpm -qa`),
- 'mandrake version' => cat_('/etc/redhat-release'),
- 'df' => join('', `df`),
-);
-
-print any::report_bug('', %other);
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
deleted file mode 100755
index aceef3f82..000000000
--- a/perl-install/standalone/drakconnect
+++ /dev/null
@@ -1,694 +0,0 @@
-#!/usr/bin/perl
-
-# DrakConnect
-
-# Copyright (C) 1999-2002 MandrakeSoft (damien@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use common;
-use network::netconnect;
-use network::ethernet;
-use network::tools;
-use network;
-use c;
-use MDK::Common;
-use any;
-use network::isdn;
-use network::adsl;
-use MDK::Common::Globals "network", qw($in $prefix $disconnect_file $connect_prog $connect_file $disconnect_file);
-
-my $xpm_path="/usr/share/libDrakX/pixmaps";
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-$::isWizard = "@ARGV" =~ /--wizard/;
-$::expert = "@ARGV" =~ /--expert/;
-local $_ = join '', @ARGV;
-
-#/-h/ and die "usage: drakconnect[--xf3] [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing]\n";
-
-my $netcnx = {};
-my $netc = {};
-my $intf = {};
-my @conx_type = ('modem', 'isdn_internal', 'isdn_external', 'adsl', 'cable', 'lan' );
-
-#$::wizard_xpm = "/usr/share/pixmaps/internet.xpm";
-
-my $in = 'interactive'->vnew('su', 'network');
-!$::isEmbedded && $in->isa('interactive::gtk') and $::isWizard=1;
-$::Wizard_pix_up = "wiz_drakconnect.png";
-$::Wizard_title = "Network & Internet Configuration";
-
-MDK::Common::Globals::init(
- in => $in,
- prefix => '',
- connect_file => "/etc/sysconfig/network-scripts/net_cnx_up",
- disconnect_file => "/etc/sysconfig/network-scripts/net_cnx_down",
- connect_prog => "/etc/sysconfig/network-scripts/net_cnx_pg"
- );
-
-$::isEmbedded && ref($in) =~ /gtk/ or goto dd;
-require Gtk;
-init Gtk;
-require my_gtk;
-import my_gtk qw(:helpers :wrappers);
-my $expert_mode=0;
-network::netconnect::read_net_conf('', $netcnx, $netc);
-any::load_category_no_message('net', undef);
-my @all_cards = network::ethernet::conf_network_card_backend ($netc, $intf, undef, undef, undef, undef);
-network::netconnect::load_conf($netcnx, $netc, $intf);
-
-my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
-$window1->signal_connect ( delete_event => sub { Gtk->exit(0); });
-$window1->set_position(1);
-$window1->set_title(_("Network configuration (%d adapters)", @all_cards));
-$window1->border_width(10);
-$::isEmbedded or $window1->set_usize(500, 400);
-my $vbox1 = new Gtk::VBox(0,10);
-$window1->add($vbox1);
-my $hbox1 = new Gtk::HBox(0,0);
-$vbox1->pack_start($hbox1,0,0,0);
-$hbox1->pack_start(new Gtk::Label(_("Profile: ")),0,0,0);
-
-my $combo1 = new Gtk::Combo;
-$combo1->set_popdown_strings (network::netconnect::get_profiles());
-my $old_profile=$netcnx->{PROFILE};
-$combo1->entry->set_text($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default");
-$combo1->entry->set_editable(0);
-$hbox1->pack_start($combo1,0,0,0);
-my $button_del = new Gtk::Button(_("Del profile..."));
-$button_del->signal_connect( clicked => sub {
- my $dialog = new Gtk::Dialog();
- $dialog->set_position(1);
- $dialog->vbox->set_border_width(10);
- $dialog->signal_connect ( delete_event => sub { Gtk->main_quit(); });
- $dialog->vbox->pack_start(new Gtk::Label(_("Profile to delete:")),1,1,0);
- my $combo_dialog = new Gtk::Combo;
- $combo_dialog->set_popdown_strings ( grep { ! /default/ } network::netconnect::get_profiles() );
- $combo_dialog->entry->set_editable(0);
- $dialog->vbox->pack_start($combo_dialog,1,1,0);
- my $bbox_dialog = new Gtk::HButtonBox;
- $dialog->action_area->add($bbox_dialog);
- $bbox_dialog->set_layout(-end);
- my $button_ok = new Gtk::Button _("OK");
- $button_ok->signal_connect ( clicked => sub {
- network::netconnect::del_profile($netcnx, $combo_dialog->entry->get_text());
- $netcnx->{PROFILE} eq $combo_dialog->entry->get_text() and $netcnx->{PROFILE}="default";
- Gtk->main_quit();
- });
- $bbox_dialog->add($button_ok );
- my $button_cancel = new Gtk::Button _("Cancel");
- $button_cancel->signal_connect ( clicked => sub { Gtk->main_quit(); });
- $bbox_dialog->add($button_cancel);
- $dialog->show_all;
- $dialog->set_modal(1);
- Gtk->main();
- $dialog->destroy;
- $combo1->entry->set_text((-e "/etc/sysconfig/network-scripts/drakconnect_conf." . $combo1->entry->get_text) ? $combo1->entry->get_text : "default");
- $combo1->set_popdown_strings(network::netconnect::get_profiles());
- apply();
- });
-$hbox1->pack_start($button_del,0,0,5);
-$button_del->set_sensitive(network::netconnect::get_profiles() > 1);
-my $button_new = new Gtk::Button(_("New profile..."));
-$button_new->signal_connect( clicked => sub {
- my $dialog = new Gtk::Dialog();
- $dialog->set_position(1);
- $dialog->vbox->set_border_width(10);
- $dialog->signal_connect ( delete_event => sub { Gtk->main_quit(); });
- $dialog->vbox->pack_start(new Gtk::Label(_("Name of the profile to create (the new profile is created as a copy of the current one) :")),1,1,0);
- my $entry_dialog = new Gtk::Entry;
- $dialog->vbox->pack_start($entry_dialog,1,1,0);
- my $bbox_dialog = new Gtk::HButtonBox;
- $dialog->action_area->add($bbox_dialog);
- $bbox_dialog->set_layout(-end);
- my $button_ok = new Gtk::Button _("OK");
- $button_ok->signal_connect ( clicked => sub {
- network::netconnect::add_profile($netcnx, $entry_dialog->get_text());
- $netcnx->{PROFILE} = $entry_dialog->get_text();
- Gtk->main_quit();
- });
- $bbox_dialog->add($button_ok );
- my $button_cancel = new Gtk::Button _("Cancel");
- $button_cancel->signal_connect ( clicked => sub { Gtk->main_quit(); });
- $bbox_dialog->add($button_cancel);
- $dialog->show_all;
- $dialog->set_modal(1);
- Gtk->main();
- $dialog->destroy;
- $combo1->entry->set_text((-e "/etc/sysconfig/network-scripts/drakconnect_conf." . $netcnx->{PROFILE}) ? $netcnx->{PROFILE} : "default");
- $combo1->set_popdown_strings(network::netconnect::get_profiles());
-});
-$hbox1->pack_start($button_new,0,0,5);
-my $hbox2 = new Gtk::HBox(0,0);
-$vbox1->pack_start($hbox2,0,0,0);
-$hbox2->pack_start(new Gtk::Label(_("Hostname: ")),0,0,0);
-my $hostname = chomp_(`hostname`);
-my $label_host = new Gtk::Label($hostname);
-$hbox2->pack_start($label_host,0,0,0);
-
-#$vbox1->pack_start(new Gtk::HSeparator,1,1,5);
-
-my $frame1 = new Gtk::Frame (_("Internet access"));
-$vbox1->pack_start($frame1,1,1,0);
-my $vbox_frame1 = new Gtk::VBox(0,0);
-$vbox_frame1->set_border_width(5);
-$frame1->add($vbox_frame1);
-my $table1 = new Gtk::Table (3,3, 0);
-$table1->set_border_width(5);
-$table1->set_row_spacings(5);
-$table1->set_col_spacings(5);
-#$table1->border_width(10);
-$vbox_frame1->pack_start($table1,1,1,0);
-#attach (table, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding)
-#$table->attach($button[0], 0, 1, 0, 1, {expand=>1,fill=>1}, {expand=>1,fill=>1},0,0);
-$table1->attach(new Gtk::Label(_("Type:")), 0, 1, 0, 1, 'fill', 'fill',0,0);
-my $label4 = new Gtk::Label($netcnx->{type});
-$table1->attach($label4, 1, 2, 0, 1, 'fill', 'fill',0,0);
-my $label5 = new Gtk::Label($netcnx->{type} eq 'lan' ? _("Gateway:") : _("Interface:"));
-$table1->attach($label5, 0, 1, 1, 2, 'fill', 'fill',0,0);
-my $label6 = new Gtk::Label($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
-$table1->attach($label6, 1, 2, 1, 2, 'fill', 'fill',0,0);
-my $isconnected = -1;
-#-sub connected_local {
-#- print "in connected local\n";
-#- my $w = $in->wait_message('', _("Testing your connection..."), 1);
-#- Gtk->main_iteration while Gtk->events_pending;
-#- $isconnected=connected();
-#-}
-my $label7 = new Gtk::Label(_("Status:"));
-$table1->attach($label7, 0, 1, 2, 3, 'fill', 'fill',0,0);
-my $label8 = new Gtk::Label(_("Testing your connection..."));
-$table1->attach($label8, 1, 2, 2, 3, 'fill', 'fill',0,0);
-
-my $warning_label1 = new Gtk::Label("");
-$vbox_frame1->pack_start($warning_label1,0,0,0);
-my $button2 = new Gtk::Button(_("Wait please"));
-$button2->set_sensitive(0);
-$button2->signal_connect(clicked => sub {
- if (!$isconnected && cat_($connect_prog) =~ m|/usr/bin/kppp| && -e '/usr/bin/kppp') {
- run_program::rooted($prefix, "/usr/bin/kppp &");
- } elsif (!$isconnected) {
- connect_backend();
- } else {
- disconnect_backend();
- }
- update2();
- });
-
-$table1->attach($button2, 2, 3, 2, 3, 'fill', 'fill',0,0);
-
-#$table1->attach($button1, 2, 3, 1, 2, 'fill', 'fill',0,0);
-
-my $hbox_frame1_button = new Gtk::HBox(0,0);
-my $button1 = new Gtk::Button(_("Configure Internet Access..."));
-$button1->signal_connect( clicked => [ \&configure_net, '', $netcnx, $netc, $intf]);
-$hbox_frame1_button->pack_start($button1, 0, 0, 0);
-$vbox_frame1->pack_start($hbox_frame1_button,0,0,0);
-
-#$vbox1->pack_start(new Gtk::HSeparator,1,1,5);
-
-my $frame2 = new Gtk::Frame (_("LAN configuration"));
-$vbox1->pack_start($frame2,1,1,0);
-my $vbox2 = new Gtk::VBox(0,0);
-$vbox2->set_border_width(5);
-$frame2->add($vbox2);
-my $clist1 = new_with_titles Gtk::CList("", _("Interface"), _("IP address"), _("Protocol"), _("Driver"), _("State"));
-$clist1->set_column_auto_resize($_,1) foreach (0..4);
-$clist1->column_titles_passive();
-$clist1->set_shadow_type('etched_out');
-$vbox2->pack_start($clist1, 0, 0, 5);
-#$scrolled1->add_with_viewport($table2);
-
-my $ip_regexp = qr/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
-
-build_clist();
-
-my $hbox3 = new Gtk::HBox(0,0);
-my $button3 = new Gtk::Button(_("Configure Local Area Network..."));
-$button3->signal_connect( clicked => [ \&configure_lan, '', $netcnx, $netc, $intf]);
-$hbox3->pack_start($button3, 0, 0, 0);
-$vbox2->pack_start($hbox3, 0, 0, 0);
-
-#$vbox1->pack_start(new Gtk::HSeparator,0,0,5);
-
-my $bbox0 = new Gtk::HButtonBox;
-$vbox1->pack_start($bbox0,0,0,0);
-$bbox0->set_layout(-end);
-
-
-$bbox0->add(new Gtk::Label(_("Click here to launch the wizard ->")));
-my $button_wizard = new Gtk::Button _("Wizard...");
-$button_wizard->signal_connect( clicked => sub {
- $::isWizard = 1;
- system("drakconnect --wizard");
-# netconnect::intro('', $netcnx, $in);
- $combo1->entry->set_text((-e "/etc/sysconfig/network-scripts/drakconnect_conf." . $combo1->entry->get_text) ? $combo1->entry->get_text : "default");
- network::netconnect::load_conf($netcnx, $netc, $intf);
- update();
- });
-$bbox0->add($button_wizard );
-
-$vbox1->pack_start(new Gtk::HSeparator,0,0,5);
-
-my $bbox1 = new Gtk::HButtonBox;
-$vbox1->pack_start($bbox1,0,0,0);
-$bbox1->set_layout(-end);
-#$bbox1->set_border_width(5);
-
-my $button_expert = new Gtk::Button _("Expert Mode");
-$button_expert->signal_connect ( clicked => sub {
- foreach($button1, $button3) { $expert_mode ? $_->hide() : $_->show() }
- $button_expert->child->set($expert_mode ? _("Expert Mode") : _("Normal Mode"));
- $expert_mode = !$expert_mode;
- });
-$bbox1->add($button_expert );
-
-my $button_apply = new Gtk::Button _("Apply");
-$button_apply->signal_connect ( clicked => sub {
- apply();
- });
-$button_apply->set_sensitive(0);
-$bbox1->add($button_apply);
-
-my $button_cancel = new Gtk::Button _("Cancel");
-$button_cancel->signal_connect ( clicked => sub {
- $combo1->entry->set_text($old_profile);
- update();
- quit_global();
- });
-$bbox1->add($button_cancel);
-my $button_ok = new Gtk::Button _("OK");
-$button_ok->signal_connect ( clicked => sub {
- my $dialog = new Gtk::Dialog();
- $dialog->set_position(1);
- $dialog->vbox->set_border_width(10);
- my $label = new Gtk::Label(_("Please Wait... Applying the configuration"));
- $dialog->signal_connect ( delete_event => sub { Gtk->main_quit(); });
- $dialog->vbox->pack_start($label,1,1,20);
- $dialog->show_all;
- Gtk->main_iteration while Gtk->events_pending;
- apply();
- $dialog->destroy;
- update();
- quit_global();
- });
-$bbox1->add($button_ok);
-$combo1->entry->signal_connect( 'changed', sub {
-# connected() and disconnect_backend();
- network::netconnect::set_profile($netcnx, $combo1->entry->get_text());
- network::netconnect::load_conf($netcnx, $netc, $intf);
- $netcnx->{$_}=$netc->{$_} foreach qw(NET_DEVICE NET_INTERFACE);
- network::netconnect::set_net_conf($netcnx, $netc);
- update();
- $button_apply->set_sensitive(1);
- });
-
-$window1->show_all();
-$_->hide foreach ($button1, $button3);
-Gtk->main_iteration while Gtk->events_pending;
-$::isEmbedded and kill USR2, $::CCPID;
-my $tag = Gtk->timeout_add(4000, \&update2);
-Gtk->main;
-Gtk->exit(0);
-
-dd:
-network::netconnect::intro('', $netcnx, $in);
-$in->exit(0);
-
-sub build_clist {
- foreach my $i (0..$#all_cards) {
- my $ip;
- if (-e "/sbin/ifconfig") {
- local $_=`LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /sbin/ifconfig "eth$i"`;
- /inet addr\:$ip_regexp/; $ip = if_($1 && $2 && $3, "$1.$2.$3.$4");
- $_=`LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /sbin/ifconfig`;
- $state = /eth$i/ ? "up" : "down";
- } else { $ip=$intf->{"eth$_"}{IPADDR}; $state = "n/a"; }
- $clist1->append("", "eth$i", $ip , $intf->{"eth$i"}{BOOTPROTO}, $all_cards[$i]->[1], $state);
- $clist1->set_pixmap ($i, 0, gtkcreate_png("eth_card_mini2.png"));
-
- $clist1->set_selectable($i, 0);
- }
-}
-
-sub apply {
- $old_profile=$netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default";
- network::netconnect::save_conf($netcnx, $netc, $intf);
-
- $netcnx->{type} eq 'modem' and any::pppConfig($in, $netcnx->{$netcnx->{type}}, '');
- $netcnx->{type} eq 'isdn_internal' and network::isdn::isdn_write_config_backend($netcnx->{$netcnx->{type}}, 1, $netc, $netcnx); #$light
- $netcnx->{type} eq 'isdn_external' and any::pppConfig($in, $netcnx->{$netcnx->{type}}, '');
- my $a = $netcnx->{type};
- $a =~ s/adsl_//;
- $netcnx->{type} =~ 'adsl' and network::adsl::adsl_conf_backend($netcnx->{$netcnx->{type}}, $netc, $a, $netcnx);
-
- $netcnx->{dhcp_client} and $netc->{dhcp_client} = $netcnx->{dhcp_client};
- network::configureNetwork2($in, $prefix, $netc, $intf);
- $netcnx->{type} =~ /adsl/ or system("/sbin/chkconfig --del adsl 2> /dev/null");
- $netcnx->{type} !~ /adsl_p/ and system("$prefix/etc/rc.d/init.d/network restart");
- $button_apply->set_sensitive(0);
-}
-
-sub ethisup { `LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /sbin/ifconfig` =~ /eth$_[0]/ }
-
-my $to_update;
-sub update {
- my $h = chomp_(`hostname`);
- $label_host->set ($h);
- $label4->set($netcnx->{type});
- $label5->set($netcnx->{type} eq 'lan' ? _("Gateway:") : _("Interface:"));
- $label6->set($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
- $clist1->freeze();
- $clist1->clear();
- build_clist();
- $clist1->thaw();
- $button_del->set_sensitive(network::netconnect::get_profiles() > 1);
- $isconnected !=-1 or return 1;
- $label8->set($isconnected ? _("Connected") : _("Not connected"));
- $button2->child->set($isconnected ? _("Disconnect...") : _("Connect..."));
- $button2->set_sensitive(1);
- 1;
-}
-
-sub in_ifconfig {
- my ($intf) = @_;
- -e '/sbin/ifconfig' or return 1;
- $intf eq '' and return 1;
- `/sbin/ifconfig` =~ /$intf/;
-}
-
-sub update2 {
- undef $to_update;
- connected_bg(\$to_update);
- if (defined $to_update) {
- $isconnected = $to_update;
- if($isconnected !=-1) {
- if ($isconnected && !in_ifconfig($netcnx->{NET_INTERFACE})) {
- $warning_label1->set(_("Warning, another Internet connection has been detected, maybe using your network"));
- $isconnected=0;
- } else { $warning_label1->set("") }
- $label8->set($isconnected ? _("Connected") : _("Not connected"));
- $button2->child->set($isconnected ? _("Disconnect...") : _("Connect..."));
- $button2->set_sensitive(1);
- }
- }
- update();
- 1;
-}
-
-sub quit_global {
- $::isEmbedded ? kill(USR1, $::CCPID) : Gtk->exit(0);
-}
-
-sub configure_lan {
- my (undef, $prefix, $netcnx, $netc, $intf) = @_;
- my $window = new Gtk::Window -toplevel;
-
- my @card_tab;
-
- if (@all_cards < 1) {
- my $dialog = new Gtk::Dialog();
- $dialog->set_position(1);
- $dialog->vbox->set_border_width(10);
- $dialog->signal_connect ( delete_event => sub { Gtk->main_quit() });
- $dialog->vbox->pack_start(new Gtk::Label(_("You don't have any configured interface.
-Configure them first by clicking on 'Configure'")),1,1,0);
- my $bbox_dialog = new Gtk::HButtonBox;
- $dialog->action_area->add($bbox_dialog);
- $bbox_dialog->set_layout(-end);
- my $button_ok = new Gtk::Button _("OK");
- $button_ok->signal_connect ( clicked => sub { Gtk->main_quit() });
- $bbox_dialog->add($button_ok );
- $dialog->show_all;
- $dialog->set_modal(1);
- Gtk->main();
- $dialog->destroy;
- return;
- }
-
- $window->set_policy (1, 1, 1);
- $window->signal_connect ( delete_event => sub { Gtk->main_quit; });
- $window->set_position(1);
- $window->set_title(_("LAN configuration"));
- $window->border_width(10);
- my $vbox1 = new Gtk::VBox(0,0);
- $window->add($vbox1);
- $vbox1->pack_start(new Gtk::Label(_("LAN Configuration")),0,1,0);
- my $notebook = new Gtk::Notebook;
- $vbox1->pack_start($notebook,0,1,0);
- my @eth_data;
- foreach (0..$#all_cards) {
- my @infos;
- my @conf_data;
- $card_tab[2*$_] = \@infos;
- $card_tab[2*$_+1] = \@conf_data;
- my $vbox_local=new Gtk::VBox(0,0);
- $vbox_local->set_border_width(10);
- $vbox_local->pack_start(new Gtk::Label( _("Adapter %s: %s", $_+1 , "eth$_")),1,1,0);
- # Eth${_}Hostname=$netc->{HOSTNAME}
- # Eth${_}HostAlias=" . do { $netc->{HOSTNAME} =~ /([^\.]*)\./; $1 } . "
- # Eth${_}Driver=$all_cards[$_]->[1]
- @conf_data = ([_("IP address"), \$intf->{"eth$_"}{IPADDR}],
- [_("Netmask"), \$intf->{"eth$_"}{NETMASK}],
- [_("Boot Protocol"), \$intf->{"eth$_"}{BOOTPROTO}, ["static", "dhcp", "bootp"]],
- [_("Started on boot"), \$intf->{"eth$_"}{ONBOOT} , ["yes", "no"]],
- [_("DHCP client"), \$netcnx->{dhcp_client}]
- );
- my $i=0;
- foreach my $j (@conf_data) {
- $infos[2*$i]=new Gtk::HBox(0,0);
- my $l=new Gtk::Label($j->[0]);
- $l->set_justify('left');
- $infos[2*$i]->pack_start($l,1,1,0);
- $vbox_local->pack_start($infos[2*$i],0,0,0);
- if (defined $j->[2]) {
- my $c=new Gtk::Combo();
- $c->set_popdown_strings(@{$j->[2]});
- $infos[2*$i+1]=$c->entry;
- $infos[2*$i+1]->set_editable(0);
- $infos[2*$i]->pack_start($c,0,0,0);
- } else {
- $infos[2*$i+1]=new Gtk::Entry();
- $infos[2*$i]->pack_start($infos[2*$i+1],0,0,0);
- }
- $infos[2*$i+1]->set_text(${$j->[1]});
- $i++;
- }
- my $c = $_;
- my $widget_temp;
- if (-e "$prefix/etc/sysconfig/network-scripts/ifcfg-eth$c") {
- $widget_temp = gtksignal_connect(new Gtk::Button(ethisup($c) ? _("deactivate now") : _("activate now")),
- clicked => sub {
- system("/sbin/if".(ethisup($c)?"down":"up")." eth$c");
- gtkbuttonset($_[0], ethisup($c)?_("deactivate now"):_("activate now"));
- });
- } else {
- $widget_temp = _("This interface has not been configured yet.\nLaunch the configuration wizard in the main window");
- }
- $vbox_local->pack_start(gtkpack__(new Gtk::HBox(0,0),
- $widget_temp
- ),0,0,0);
- # $clist1->append($_+1, "eth$_", $intf->{"eth$_"}{IPADDR}, $intf->{"eth$_"}{BOOTPROTO}, $all_cards[$_]->[1]);
- # $clist1->set_selectable($_, 0);
-# require Data::Dumper;
-# print "------------\n" . Data::Dumper->Dump([$b],['b']) . "\n";
- my $hbox_local = new Gtk::HBox(0,0);
- my $pix = gtkpng("/usr/share/libDrakX/pixmaps/eth_card_mini.png");
- $hbox_local->pack_start($pix,0,0,0);
- $hbox_local->pack_start(new Gtk::Label("eth$_"),0,0,0);
- $hbox_local->show_all;
- $notebook->append_page($vbox_local, $hbox_local);
- }
- my $bbox1 = new Gtk::HButtonBox;
- $vbox1->pack_start($bbox1,0,0,10);
- $bbox1->set_layout(-end);
- my $button_ok = new Gtk::Button( _("OK") );
- $button_ok->signal_connect ( clicked => sub {
- foreach (0..$#all_cards) {
- my $i=0;
- my @infos = @{$card_tab[2*$_]};
- my @conf_data = @{$card_tab[2*$_+1]};
- foreach my $j (@conf_data) {
- ${$j->[1]}=$infos[2*$i+1]->get_text();
- $i++;
- }
- }
- update();
- $button_apply->set_sensitive(1);
- $window->destroy(); Gtk->main_quit;
- });
- $bbox1->add($button_ok);
- my $button_cancel = new Gtk::Button( _("Cancel") );
- $button_cancel->signal_connect ( clicked => sub { $window->destroy(); Gtk->main_quit });
- $bbox1->add($button_cancel);
-
- $window->set_modal(1);
- $window->show_all();
- foreach (0..$#all_cards) {
- my @infos = @{$card_tab[2*$_]};
- $intf->{"eth$_"}{BOOTPROTO} eq "dhcp" or $infos[8]->hide;
- }
- $window->set_position('center_always');
- Gtk->main;
-}
-
-
-sub configure_net {
- my (undef, $prefix, $netcnx, $netc, $intf) = @_;
- if (!$netcnx->{type}) {
- my $dialog = new Gtk::Dialog();
- $dialog->set_position(1);
- $dialog->vbox->set_border_width(10);
- $dialog->signal_connect ( delete_event => sub { Gtk->main_quit(); });
- $dialog->vbox->pack_start(new Gtk::Label(_("You don't have any internet connection.
-Create one first by clicking on 'Configure'")),1,1,0);
- my $bbox_dialog = new Gtk::HButtonBox;
- $dialog->action_area->add($bbox_dialog);
- $bbox_dialog->set_layout(-end);
- my $button_ok = new Gtk::Button _("OK");
- $button_ok->signal_connect ( clicked => sub {
- Gtk->main_quit();
- });
- $bbox_dialog->add($button_ok );
- $dialog->show_all;
- $dialog->set_modal(1);
- Gtk->main();
- $dialog->destroy;
- return;
- }
- my $cnx={};
- my @infos;
- $cnx=$netcnx->{$netcnx->{type}};
- my $auto_detect={};
- my $window = new Gtk::Window -toplevel;
- $window->set_policy (1, 1, 1);
- $window->signal_connect ( delete_event => sub { Gtk->main_quit; });
- $window->set_position(1);
- $window->set_title(_("Internet connection configuration"));
- $window->border_width(10);
- my $vbox1 = new Gtk::VBox(0,0);
- $window->add($vbox1);
- $vbox1->pack_start(new Gtk::Label(_("Internet Connection Configuration")),0,1,0);
-
- $vbox1->pack_start(new Gtk::HSeparator,0,0,5);
- my $table1 = new Gtk::Table (2, 4, 0);
- $table1->set_row_spacings(5);
- $table1->set_col_spacings(5);
- $vbox1->pack_start($table1,0,0,0);
- $table1->attach(new Gtk::Label(_("Profile: ")), 0, 1, 0, 1, 'fill', 'fill',0,0);
- $table1->attach(new Gtk::Label(_($netcnx->{PROFILE})), 1, 2, 0, 1, 'fill', 'fill',0,0);
- $table1->attach(new Gtk::Label(_("Connection type: ")), 0, 1, 1, 2, 'fill', 'fill',0,0);
- $table1->attach(new Gtk::Label(_($netcnx->{type})), 1, 2, 1, 2, 'fill', 'fill',0,0);
-# my $button1 = new Gtk::Button(_("Reconfigure using wizard..."));
-# $table1->attach($button1, 2, 4, 0, 2, 'fill', 'fill',0,0);
- $vbox1->pack_start(new Gtk::HSeparator,0,0,5);
-
- my $frame1 = new Gtk::Frame (_("Parameters"));
- $vbox1->pack_start($frame1,1,1,0);
- my $vbox2 = new Gtk::VBox(0,0);
- $frame1->add($vbox2);
- my $i=0;
- my @conf_data = ([_("Card IRQ"), \$cnx->{irq} ],
- [_("Card mem (DMA)"), \$cnx->{mem} ],
- [_("Card IO"), \$cnx->{io} ],
- [_("Card IO_0"), \$cnx->{io0} ],
- [_("Card IO_1"), \$cnx->{io1} ],
- [_("Your personal phone number"), \$cnx->{phone_in} ],
- [_("Provider name (ex provider.net)"), \$netc->{DOMAINNAME2}],
- [_("Provider phone number"), \$cnx->{phone_out} ],
- [_("Provider dns 1 (optional)"), \$netc->{dnsServer2}],
- [_("Provider dns 2 (optional)"), \$netc->{dnsServer3}],
- [_("Account Login (user name)"), \$cnx->{login} ],
- [_("Account Password"), \$cnx->{passwd} ],
- [_("Dialing mode"), \$cnx->{dialing_mode}, [ "auto", "manual"] ],
- [_("Gateway"), \$netc->{GATEWAY}],
- [_("Connection name"), \$cnx->{connection} ],
- [_("Phone number"), \$cnx->{phone} ],
- [_("Login ID"), \$cnx->{login} ],
- [_("Password"), \$cnx->{passwd} ],
- [_("Authentication"), \$cnx->{auth}, [ _("PAP"), _("Terminal-based"), _("Script-based"), __("CHAP") ] ],
- [_("Domain name"), \$cnx->{domain} ],
- [_("First DNS Server (optional)"), \$cnx->{dns1} ],
- [_("Second DNS Server (optional)"), \$cnx->{dns2} ],
- [_("Ethernet Card"), \$netc->{NET_DEVICE}, [ 'eth0', 'eth1', 'eth2', 'eth3', 'eth4', 'eth5','eth6', 'eth7', 'eth8', 'eth9' ]],
- [_("DHCP Client"), \$netcnx->{dhcp_client}, ["dhcpcd", "dhcpxd", "dhcp-client"] ],
- [_("Connection speed"), \$cnx->{speed}, ["64 Kb/s", "128 Kb/s"]],
- [_("Connection timeout (in sec)"), \$cnx->{huptimeout} ]
-);
- foreach (@conf_data) {
- $infos[2*$i]=new Gtk::HBox(0,0);
- my $l=new Gtk::Label($_->[0]);
- $l->set_justify('left');
- $infos[2*$i]->pack_start($l,1,1,0);
- $vbox2->pack_start($infos[2*$i],0,0,0);
- if (defined $_->[2]) {
- my $c=new Gtk::Combo();
- $c->set_popdown_strings(@{$_->[2]});
- $infos[2*$i+1]=$c->entry;
- $infos[2*$i]->pack_start($c,0,0,0);
- } else {
- $infos[2*$i+1]=new Gtk::Entry();
- $infos[2*$i]->pack_start($infos[2*$i+1],0,0,0);
- #hide password if Entry Password
- if ($_->[0] eq _("Account Password") || $_->[0] eq _("Password")) { $infos[2*$i+1]->set_visibility(0)};
- }
- $infos[2*$i+1]->set_text(${$_->[1]});
- $i++;
- }
- my @mask;
-@mask=(0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0) if $netcnx->{type} eq 'lan';
-@mask=(0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1) if $netcnx->{type} eq'isdn_internal'&& defined $cnx->{vendor} && defined $cnx->{id};
-@mask=(1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1) if $netcnx->{type} eq'isdn_internal'&&(!defined $cnx->{vendor}||!defined $cnx->{id});
-@mask=(0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0) if ($netcnx->{type} eq 'modem'||$netcnx->{type} eq 'isdn_external');
-@mask=(0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0) if $netcnx->{type} =~ 'adsl';
-@mask=(0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0) if $netcnx->{type} eq 'cable';
- $vbox1->pack_start(new Gtk::HSeparator,0,0,5);
-
-
- my $bbox1 = new Gtk::HButtonBox;
- $vbox1->pack_start($bbox1,0,0,0);
- $bbox1->set_layout(-end);
- my $button_ok = new Gtk::Button _("OK");
- $button_ok->signal_connect ( clicked => sub {
- $i=0;
- foreach (@mask) {
- ${$conf_data[$i]->[1]}=$infos[2*$i+1]->get_text() if ($_);
- $i++;
- }
- update();
- $button_apply->set_sensitive(1);
- $window->destroy(); Gtk->main_quit;
- });
- $bbox1->add($button_ok);
- my $button_cancel = new Gtk::Button _("Cancel");
- $button_cancel->signal_connect ( clicked => sub { $window->destroy(); Gtk->main_quit });
- $bbox1->add($button_cancel);
-
- $window->set_modal(1);
- $window->show_all();
- $i=0;
- foreach (@mask) {
- if ($_) { $infos[2*$i]->show }
- else { $infos[2*$i]->hide; }
- $i++;
- }
- $window->set_position('center_always');
- Gtk->main;
-}
diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy
deleted file mode 100755
index 6c59311ec..000000000
--- a/perl-install/standalone/drakfloppy
+++ /dev/null
@@ -1,456 +0,0 @@
-#!/usr/bin/perl -w
-
-# Control-center
-# $Id$
-#
-# Copyright (C) 2001-2002 MandrakeSoft
-# Yves Duret <yduret at mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 POSIX;
-use Gtk;
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use Config;
-use any;
-init Gtk;
-Gtk->set_locale;
-
-#-------------------------------------------------------------
-# i18n routines
-# IMPORTANT: next two routines have to be redefined here to
-# get correct namespace (drakconf instead of libDrakX)
-# (This version is now UTF8 compliant - Sg 2001-08-18)
-#-------------------------------------------------------------
-
-sub _ {
- my $s = shift @_; my $t = translate($s);
- sprintf $t, @_;
-}
-
-sub translate {
- my ($s) = @_;
- $s ? c::dgettext('drakfloppy', $s) : '';
-}
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\S*) (\S*)/;
-if ($::isEmbedded) {
- print "EMBED\n";
- print "XID : $::XID\n";
- print "CCPID : $::CCPID\n";
-}
-
-$in = 'interactive'->vnew('su', 'default');
-local $_ = join '', @ARGV;
-
-/-h/ and die _("usage: drakfloppy\n");
-
-$expert_mode = 0;
-# we have put here the list in order to do $list->clear() when we have to do
-$fixed_font = Gtk::Gdk::Font->fontset_load(_("-misc-Fixed-Medium-r-*-*-*-140-*-*-*-*-*-*,*"));
-my @titles = ( _("Module name"), _("Size") );
-my $list = new_with_titles Gtk::CList( @titles );
-
-my $window = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
-$window->signal_connect( 'delete_event', sub { $::isEmbedded ? kill(USR1, $::CCPID) : Gtk->exit(0) });
-$window->set_title( _("drakfloppy") );
-$window->set_policy(1, 1, 1);
-$window->border_width (5);
-
-### menus definition
-# the menus are not shown
-# but they provides shiny shortcut like C-q
-my @menu_items = (
- { path => _("/_File"), type => '<Branch>' },
- { path => _("/File/_Quit"), accelerator => _("<control>Q"), callback => sub { $::isEmbedded ? kill(USR1, $::CCPID) : Gtk->exit(0) } },
- );
-my $menubar = get_main_menu( $window );
-
-######### menus end
-
-my $global_vbox = new Gtk::VBox();
-
-$::isEmbedded or $global_vbox->pack_start (new Gtk::Label(_("boot disk creation")), 0, 0, 0);
-
-######## up part
-my $up_vbox = new Gtk::VBox (0, 0);
-
-# device part
-my $dev_hbox = new Gtk::HBox (1, 0);
-my $device_combo = new Gtk::Combo();
-my $device_button = new Gtk::Button( _("default") );
-
-$device_combo->set_popdown_strings( "/dev/fd0", "/dev/fd1", );
-$device_button->signal_connect( 'clicked', sub { $device_combo->entry->set_text("/dev/fd0");});
-
-$dev_hbox->pack_start (new Gtk::Label( _("device") ), 0, 0, 0);
-$dev_hbox->pack_start ($device_combo, 0, 0, 0);
-$dev_hbox->pack_start ($device_button, 0, 0, 0);
-$up_vbox->pack_start ($dev_hbox, 0, 0, 0);
-
-# kernel part
-my $ker_hbox = new Gtk::HBox (1, 0);
-my $kernel_combo = new Gtk::Combo();
-my $kernel_button = new Gtk::Button( _("default") );
-$kernel_combo->disable_activate();
-$kernel_combo->set_popdown_strings( do {
- opendir YREP, "/lib/modules" or die _("DrakFloppy Error: %s", $!);
- my @files_modules = grep !/^\.\.?$/, readdir YREP;
- closedir YREP;
- @files_modules;
-});
-#$kernel_combo->entry->set_text(`uname -r`);
-$kernel_combo->entry->signal_connect( "changed", sub { change_tree($kernel_combo->entry->get_text()); $list->clear();});
-$aaaa= `uname -r`;
-chomp ($aaaa);
-$kernel_button->signal_connect( 'clicked', sub { $kernel_combo->entry->set_text($aaaa); $list->clear(); });
-
-$ker_hbox->pack_start (new Gtk::Label( _("kernel version") ), 0, 0, 0);
-$ker_hbox->pack_start ($kernel_combo, 0, 0, 0);
-$ker_hbox->pack_start ($kernel_button, 0, 0, 0);
-$up_vbox->pack_start ($ker_hbox, 0, 0, 5);
-
-# vbox part
-my $up_frame = new Gtk::Frame( _("General") );
-$up_frame->add($up_vbox);
-$global_vbox->pack_start ($up_frame, 1, 1, 0);
-
-### expert mode
-my $expert_main_frame = new Gtk::Frame( _("Expert Area") );
-my $expert_dedans = new Gtk::VBox( 0, 5 );
-$expert_dedans->border_width (5);
-my $expert_button_frame = new Gtk::Frame( _("mkinitrd optional arguments") );
-my $expert_mod_frame = new Gtk::Frame( _("Add a module") );
-my $expert_pane = new Gtk::HPaned();
-$expert_pane->set_handle_size( 10 );
-$expert_pane->set_gutter_size( 8 );
-
-my $expert_button = new Gtk::Button( _("Expert Mode") );
-$expert_button->signal_connect( "clicked", sub {
- if ($expert_mode) {
- $expert_mod_frame->hide();
- $expert_button_frame->hide()
- } else {
- $expert_mod_frame->show();
- $expert_button_frame->show();
- }
- $expert_mode = !$expert_mode;
- });
-
-my $expert_button_vbox = new Gtk::VBox(0, 5);
-my $expert_button_hbox = new Gtk::HBox(0, 5);
-my $expert_button_hbox2 = new Gtk::HBox(0, 5);
-my $force_button = new Gtk::ToggleButton( _("force") );
-my $needed_button = new Gtk::ToggleButton( _("if needed") );
-my $scsi_button = new Gtk::ToggleButton( _("omit scsi modules") );
-my $raid_button = new Gtk::ToggleButton( _("omit raid modules") );
-$expert_button_hbox->pack_start( $force_button, 0, 0, 0 );
-$expert_button_hbox->pack_start( $raid_button, 0, 0, 0 );
-
-$expert_button_hbox2->pack_start( $needed_button, 0, 0, 0 );
-$expert_button_hbox2->pack_start( $scsi_button, 0, 0, 0 );
-
-$expert_button_vbox->pack_start($expert_button_hbox, 0, 0, 0);
-$expert_button_vbox->pack_start($expert_button_hbox2, 0, 0, 0);
-$expert_button_frame->add($expert_button_vbox);
-$expert_dedans->pack_start ($expert_button_frame, 0, 0, 0);
-$expert_mod_frame->add($expert_pane);
-$expert_dedans->pack_start ($expert_mod_frame, 1, 1, 0);
-$expert_main_frame->add($expert_dedans);
-$global_vbox->pack_start ($expert_main_frame, 1, 1, 0);
-
-### the tree
-
-# Create a ScrolledWindow for the tree
-my $tree_scrolled_win = new Gtk::ScrolledWindow();
-$tree_scrolled_win->set_usize( 200, $::isEmbedded ? 0 : 175);
-$expert_pane->add1( $tree_scrolled_win );
-$tree_scrolled_win->set_policy( 'automatic', 'automatic' );
-
-# Create root tree
-my $tree = new Gtk::Tree();
-my $leaf;
-my $root_dir;
-$tree_scrolled_win->add_with_viewport( $tree );
-$tree->set_selection_mode( 'single' );
-$tree->set_view_mode( 'item' );
-
-fill_tree ($kernel_combo->entry->get_text());
-
-# Create a ScrolledWindow for the list
-my $list_scrolled_win = new Gtk::ScrolledWindow( undef, undef );
-my $rmmod_button = new Gtk::Button( _("Remove a module") );
-my $expert_inside_pane2 = new Gtk::VBox (0, 0);
-my $list_selected_row;
-
-$expert_inside_pane2->pack_start ($list_scrolled_win, 1, 1, 0);
-$expert_inside_pane2->pack_start ($rmmod_button, 0, 0, 0);
-$expert_pane->add2( $expert_inside_pane2 );
-$list_scrolled_win->set_policy( 'automatic', 'automatic' );
-$rmmod_button->signal_connect('clicked', sub {$list->remove($list_selected_row);});
-
-# Create list box
-########################################################## from here my $list
-$list->signal_connect('select_row', sub { (undef, $list_selected_row) = @_; });
-$list_scrolled_win->add( $list );
-$list->set_column_justification(1, 'right');
-$list->set_column_width( 0, 200 );
-$list->set_column_width( 1, 50 );
-$list->set_selection_mode( 'single' );
-$list->set_shadow_type( 'none' );
-$list->show();
-
-### output
-my $output_frame = new Gtk::Frame( _("Output") );
-my $output = new Gtk::Text( undef, undef );
-my $vscrollbar = new Gtk::VScrollbar( $output->vadj );
-my $output_hbox = new Gtk::HBox (0, 0);
-$output_hbox->border_width (5);
-$output_hbox->set_usize( 30, 75 );
-$output_hbox->pack_start( $output, 1, 1, 0 );
-$output_hbox->pack_start( $vscrollbar, 0, 0, 0 );
-$output_frame->add ($output_hbox);
-$global_vbox->pack_start ($output_frame, 0, 0, 0);
-
-### final buttons
-my $build_button = new Gtk::Button( _("Build the disk") );
-my $cancel_button = new Gtk::Button( _("Cancel") );
-my $fin_hbox = new Gtk::HBox( 0, 0 );
-$cancel_button->signal_connect( clicked=> sub {$::isEmbedded ? kill(USR1, $::CCPID) : Gtk->exit(0)});
-$build_button->signal_connect('clicked', \&build_it);
-$fin_hbox->pack_end($cancel_button, 0, 0, 0);
-$fin_hbox->pack_end($build_button, 0, 0, 10);
-$fin_hbox->pack_end($expert_button, 0, 0, 10);
-$global_vbox->pack_start ($fin_hbox, 0, 0, 0);
-
-### back to window
-$window->add( $global_vbox );
-
-$window->show_all();
-$expert_mod_frame->hide();
-$expert_button_frame->hide();
-
-Gtk->main_iteration while Gtk->events_pending;
-$::isEmbedded and kill USR2, $::CCPID;
-Gtk->main;
-
-
-
-#-------------------------------------------------------------
-# tree functions
-#-------------------------------------------------------------
-### Subroutines
-
-sub fill_tree {
- ($root_dir) = @_;
- $root_dir = "/lib/modules/" . $root_dir;
- # Create root tree item widget
- $leaf = new_with_label Gtk::TreeItem( $root_dir );
- $tree->append( $leaf );
- $leaf->signal_connect( 'select', \&select_item, $root_dir );
- $leaf->set_user_data( $root_dir );
-
- # Create the subtree
- if ( has_sub_trees( $root_dir ) ) {
- my $subtree = new Gtk::Tree();
- $leaf->set_subtree( $subtree );
- $leaf->signal_connect( 'expand', \&expand_tree, $subtree );
- $leaf->signal_connect( 'collapse', \&collapse_tree );
- $leaf->expand();
- }
-}
-
-sub change_tree {
- $leaf->destroy();
- fill_tree (@_);
- $leaf->show();
-}
-
-# Callback for expanding a tree - find subdirectories, files and add them to tree
-sub expand_tree
- {
- my ( $item, $subtree ) = @_;
-
- my $dir_entry;
- my $path;
- my $item_new;
- my $new_subtree;
-
- my $dir = $item->get_user_data();
-
- chdir( $dir );
-
- foreach $dir_entry ( <*> ) {
- if (( -d $dir_entry ) or ( $dir_entry =~ /\.o(\.gz)?$/)) {
- $path = $dir . "/" . $dir_entry;
- $path =~ s|//|/|g;
- $item_new = new_with_label Gtk::TreeItem( $dir_entry );
- $item_new->set_user_data( $path );
- $item_new->signal_connect( 'select', \&select_item, $path );
- $subtree->append( $item_new );
- $item_new->show();
-
- if ( has_sub_trees( $path ) ) {
- $new_subtree = new Gtk::Tree();
- $item_new->set_subtree( $new_subtree );
- $item_new->signal_connect( 'expand', \&expand_tree, $new_subtree );
- $item_new->signal_connect( 'collapse', \&collapse_tree );
- }
- }
- }
- chdir( ".." );
- }
-
-
-# Callback for collapsing a tree -- removes the subtree
-sub collapse_tree
- {
- my ( $item ) = @_;
- my $subtree = new Gtk::Tree();
-
- $item->remove_subtree();
- $item->set_subtree( $subtree );
- $item->signal_connect( 'expand', \&expand_tree, $subtree );
- }
-
-# Called whenever an item is clicked on the tree widget.
-sub select_item {
- my ( $widget, $file ) = @_;
- return if (-d $file);
- my $size = ( lstat( $file ) )[ 7 ];
- my $lr = $list->rows();
- my $i;
- $file =~ s|/lib/modules/.*?/||g;
- for ($i=0; $i < $lr; $i++) {
- last if ($file eq $list->get_text($i, 0));
- }
- print $file,"\n";
-
- $list->append($file, $size) if ($i == $lr) or ($lr == 0);
-}
-
-#-------------------------------------------------------------
-# menu callback functions
-#-------------------------------------------------------------
-
-sub print_hello {
- print "mcdtg !\n";
-}
-
-sub get_main_menu {
- my ( $window ) = @_;
- my $accel_group = new Gtk::AccelGroup();
- my $item_factory = new Gtk::ItemFactory( 'Gtk::MenuBar', '<main>', $accel_group );
- $item_factory->create_items( @menu_items );
- $window->add_accel_group( $accel_group );
- return ( $item_factory->get_widget( '<main>' ) );
-}
-
-
-sub create_dialog {
- my ( $label, $c ) = @_;
- my $ret = 0;
- my $dialog = new Gtk::Dialog;
- $dialog->signal_connect ( delete_event => sub {Gtk->main_quit();});
- $dialog->set_title(_("drakfloppy"));
- $dialog->border_width(10);
- $dialog->vbox->pack_start(new Gtk::Label($label),1,1,0);
-
- my $button = new Gtk::Button _("OK");
- $button->can_default(1);
- $button->signal_connect(clicked => sub { $ret = 1; $dialog->destroy(); Gtk->main_quit(); });
- $dialog->action_area->pack_start($button, 1, 1, 0);
- $button->grab_default;
-
- if ($c) {
- my $button2 = new Gtk::Button _("Cancel");
- $button2->signal_connect(clicked => sub { $ret = 0; $dialog->destroy(); Gtk->main_quit(); });
- $button2->can_default(1);
- $dialog->action_area->pack_start($button2, 1, 1, 0);
- }
-
- $dialog->show_all;
- Gtk->main();
- $ret;
-}
-
-sub destroy_window {
- my($widget, $windowref, $w2) = @_;
- $$windowref = undef;
- $w2 = undef if defined $w2;
- 0;
-}
-
-
-#-------------------------------------------------------------
-# the function
-#-------------------------------------------------------------
-sub build_it {
- my $y;
- my $co = "/sbin/mkbootdisk --noprompt --verbose --device ". $device_combo->entry->get_text();
- if ($expert_mode) {
- $co .= " --mkinitrdargs -f" if $force_button->get_active;
- $co .= " --mkinitrdargs --ifneeded" if $needed_button->get_active;
- $co .= " --mkinitrdargs --omit-scsi-modules" if $scsi_button->get_active;
- $co .= " --mkinitrdargs --omit-raid-modules" if $raid_button->get_active;
- for (my $i=0; $i<$list->rows(); $i++) {
- $y = $list->get_text($i, 0);
- $y =~ s|.*?/||g;
- $co .= " --mkinitrdargs --with=" . $y; #. "/usr/lib/" . $kernel_combo->entry->get_text() . "/" . $y;
- }
- }
- $co .= " " . $kernel_combo->entry->get_text();
- $co .= " 2>&1 |";
- create_dialog(_("Be sure a media is present for the device %s", $device_combo->entry->get_text()), 1) or return;
-# we test if the media is present
- test:
- my $a = "dd count=1 if=/dev/null of=". $device_combo->entry->get_text() ." 2>&1";
- my $b= `$a`;
- if ($b =~ "dd") {create_dialog(_("There is no medium or it is write-protected for device %s.\nPlease insert one.", $device_combo->entry->get_text()), 1) ? goto test : return 0; }
-
- open STATUS, $co or do { create_dialog(_("Unable to fork: %s", $!), 0); return; };
- while (<STATUS>) {
- $output->insert( $fixed_font, undef, undef, $_ );
- }
- close STATUS or create_dialog(_("Unable to close properly mkbootdisk: \n %s \n %s", $!, $?), 0);
-
- return (0);
-}
-
-####
-# This is put at the end of the file because any translatable string
-# appearing after this will not be found by xgettext, and so wont end in
-# the pot file...
-####
-
-# Test whether a directory has subdirectories
-sub has_sub_trees
- {
- my ( $dir ) = @_;
- my $file;
-
- foreach $file ( <$dir/*> ) {
- return 1 if ( -d $file ) or ($file =~ /\.o(\.gz)?$/);
- }
-
- return (0);
- }
-
diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont
deleted file mode 100755
index 8996aa0d6..000000000
--- a/perl-install/standalone/drakfont
+++ /dev/null
@@ -1,1265 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2001 by MandrakeSoft (sdupont@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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.
-#
-# drakfont Future Overview
-# - Fonts import :
-# pfb ( Adobe Type 1 binary )
-# pfa ( Adobe Type 1 ASCII )
-# ttf ( True-Type )
-# pcf.gz
-# Speedo
-# and Bitmap (PCF, BDF, and SNF)
-# - Features
-# - Install fonts from any directory
-# - Get windows fonts on any vfat partitions
-# - Get fonts on any partitions.
-# - UN-installation of any fonts (even if not installed through drakfont)
-# - Support
-# - Xfs
-# - ghostscript & printer
-# - Staroffice & printer
-# - abiword
-# - netscape
-# - Koffice, Gnumeric, ... studying
-# - all fonts supported by printer
-# - anti-aliases by RENDER in Xfree86 ....
-# supported by KDE.
-# will be supported by gnome 1.2.
-# Visual Interface:
-# Window interface:
-# - Fontselectiondialog widget
-# - Command buttons under Fontselectiondialog (like the actual frontend).
-# Commands buttons:
-# - import from windows partition.
-# import from all fat32 partitions and look for winnt/windows/font
-# and import all (delete doublon) but don't import if already exist.
-# - import from directory
-# look for if it exist before for each font and not delete the original.
-# (replace all, no, none)
-# expert options:
-# ask the directory, and look for if it exist before
-# if it exist ask: (replace all, no, none)
-# - uninstall with list per font type
-# Expert additional switch
-# - option support: ghostscript, Staroffice, etc...
-# check-button. (by default all check)
-# - Printer Application Fonts Support...
-# check-button. (by default all check)
-#
-# TODO:
-# - abiword, Koffice, Gnumeric, ...
-# - Speedo and Bitmap (PCF, BDF, and SNF)
-# - option strong: strong verification with ttmkfdir -c ?
-#
-# REQUIRE:
-# - font-tools.*.mdk.i586.rpm
-#
-# USING:
-# - pfm2afm: by Ken Borgendale: Convert a Windows .pfm file to a .afm (Adobe Font Metrics)
-# - type1inst: by James Macnicol: type1inst generates files fonts.dir fonts.scale & Fontmap.
-# - ttf2pt1: by Andrew Weeks, Frank Siegert, Thomas Henlich, Sergey Babkin convert ttf font files to afm and pfb fonts
-#
-#
-# directory to install fonts /usr/X11R6/lib/X11/fonts/
-# -->> /usr/X11R6/lib/X11/fonts/drakfont
-
-use Gtk;
-use lib qw(/usr/lib/libDrakX );
-
-use standalone
- ; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use my_gtk qw(:helpers :wrappers);
-use common;
-
-#use strict;
-#use Config;
-#use POSIX;
-
-my $in = 'interactive'->vnew( 'su', 'network' );
-$::isEmbedded = ( $::XID, $::CCPID ) = "@ARGV" =~ /--embedded (\S*) (\S*)/;
-
-if ( "@ARGV" =~ /--help|-h/ ) {
- print q(Font Importation and monitoring application
---windows_import : import from all available windows partitions.
---xls_fonts : show all fonts that already exist from xls
---strong : strong verification of font.
---install : accept any font file and any directry.
---uninstall : uninstall any font or any directory of font.
---replace : replace all font if already exist
---application : 0 none application.
- : 1 all application available supported.
- : name_of_application like so for staroffice
- : and gs for ghostscript for only this one.
-);
- exit(0);
-}
-
-# global variables needed by each functions
-my $xlsfonts = 0;
-my $windows = 0;
-my $strong;
-my $replace;
-my $application;
-my $install;
-my $uninstall;
-my $so = 1;
-my $gs = 1;
-my $abi = 1;
-my $printer = 1;
-my $mode = -1;
-my @application;
-my @install;
-my @uninstall;
-my $interactive;
-my $text;
-my $vscrollbar;
-my $check4;
-my $check1;
-my $check2;
-my $check3;
-my $pbar;
-my $pbar1;
-my $pbar2;
-my $pbar3;
-my $font_box;
-my $central_widget;
-my $label1;
-my $label2;
-my $label3;
-my $label4;
-my $list_path;
-my $path_list;
-my $current_path;
-my $list;
-my $list_all_font_path;
-
-foreach (@ARGV) {
- /--list|-l/ and $list_all_font_path = 1, $mode = -1;
- /--xls_fonts/ and $xlsfonts = 1, $mode = -1;
- /--windows_import|-wi/ and $windows = 1, $mode = -1;
- /--strong|-s/ and $strong = 1, $mode = -1;
- /--replace|-r/ and $replace = 1, $mode = -1;
- /--application/ and $mode = 0, next;
- $mode == 0 and push @application, $_;
- /--install/ and $mode = 1, next;
- $mode == 1 and push @install, $_;
- /--uninstall/ and $mode = 2, next;
- $mode == 2 and push @uninstall, $_;
-}
-
-foreach my $i (@application) {
- if ( $i =~ /so/i ) {
- if ( $gs != 2 ) { $gs = 0; }
- $so = 2;
- }
- if ( $i =~ /gs/i ) {
- if ( $so != 2 ) { $so = 0; }
- $gs = 2;
- }
-}
-
-# PATH and binary full path
-my $xfs_conffile = '/etc/X11/fs/config';
-my $drakfont_dir = '/usr/X11R6/lib/X11/fonts/drakfont';
-my $ttf2pt1 = '/usr/sbin/ttf2pt1';
-my $pfm2afm = '/usr/sbin/pfm2afm';
-my $type1inst = '/usr/sbin/type1inst';
-my $chkfontpath = '/usr/sbin/chkfontpath';
-my $mkttfdir = '/usr/X11R6/bin/mkttfdir';
-my $ghostscript;
-
-#my $ttmkfdir = '/usr/sbin/ttmkfdir';
-
-# Global lists, just to manipulate it easily.
-# my @font_list => list of fonts to install.
-# my @installed_fonts; => list of installed fonts.
-# my @installed_fonts_path; => list of path included in xfs.
-# my @fontsdir_to_install; => list of fonts to uninstall.
-# my @fontsdir_to_uninstall; => path to remove in xfs font file.
-# my @installed_fonts_full_path; => full path list of fonts to uninstall.
-
-my @font_list;
-my @installed_fonts;
-my @installed_fonts_path;
-my @fontsdir_to_install;
-my @fontsdir_to_uninstall;
-my @installed_fonts_full_path;
-
-sub list_fontpath {
- foreach ( grep { /\d+:\s/ } `$chkfontpath -l` ) {
- chomp;
- s/\d+:\s//gi;
- s/:\w*$//gi;
- push @installed_fonts_path, $_;
- }
-}
-
-sub chk_empty_xfs_path {
- my @temp3;
- foreach my $tmp_path (@installed_fonts_path) {
- @temp3 = ();
- foreach my $temp2 ( all($tmp_path) ) {
- if ( !( ( $temp2 =~ /^fonts/ ) || ( $temp2 =~ /^type/ ) ) ) {
- push @temp3, $temp2;
- }
- }
- if ( !(@temp3) ) {
- system("chkfontpath -r $tmp_path ")
- or print "PERL::system command failed during chkfontpath\n";
- }
- }
-}
-
-sub search_installed_fonts {
- list_fontpath();
- $interactive and progress( $pbar, 0.1, _("Search installed fonts") );
- push @installed_fonts, all($_) foreach @installed_fonts_path;
- $interactive and progress( $pbar, 0.1, _("Unselect fonts installed") );
-}
-
-sub search_installed_fonts_full_path {
- list_fontpath();
- foreach my $i (@installed_fonts_path) {
- foreach my $j ( all($i) ) {
- push @installed_fonts_full_path, "$i/$j";
- }
- }
-}
-
-sub search_windows_font {
- foreach my $fstab_line ( grep { /vfat|ntfs/ } cat_('/etc/mtab') ) {
- my $win_dir = ( split ( '\s', $fstab_line ) )[1];
- my @list_fonts_win = all("$win_dir/windows/fonts");
- my @list_fonts_winnt = all("$win_dir/winnt/fonts");
- my $nb_dir = @list_fonts_win + @list_fonts_winnt;
- foreach ( [ \@list_fonts_win, "windows" ],
- [ \@list_fonts_winnt, "winnt" ] )
- {
- foreach my $i ( @{ $_->[0] } ) {
- if ($interactive) {
- if ($nb_dir) {
- progress( $pbar, 0.25 / $nb_dir, _("parse all fonts") );
- }
- else {
- display_error( _("no fonts found") );
- return 0;
- }
- }
- !$replace && grep( /$i/, @installed_fonts ) and next;
- grep ( /$i$/, @font_list )
- or push @font_list, "$win_dir/$_->[1]/fonts/$i";
- }
- }
- $interactive && $nb_dir and progress( $pbar, 1, _("done") );
- }
- if ( !@font_list ) {
- print "drakfont:: could not find any font in /win*/fonts \n";
- $interactive
- and display_error(
- _("could not find any font in your mounted partitions") );
- return 0;
- }
- 1;
-}
-
-sub is_a_font {
- local $_ = $_[0];
- /\.ttf$/i
- || /\.pfa$/i
- || /\.pfb$/i
- || /\.pcf$/i
- || /\.pcf\.gz$/i
- || /\.pfm$/i
- || /\.gsf$/;
-}
-
-# Optimisation de cette etape indispensable
-sub search_dir_font {
- foreach my $fn (@install) {
- my @font_list_tmp = ();
- my @font_list_tmpp = ();
- my $dir;
- if ( !( -e $fn ) ) { print "$_ :: no such file or directory \n" }
- else {
- if ( -d $fn ) {
- $dir = $fn;
- foreach my $i ( all($fn) ) {
- if ( is_a_font($i) ) {
- push @font_list_tmp, "$i";
- foreach my $i (@font_list_tmp) {
- !$replace && grep( /$i/, @installed_fonts )
- and next;
- grep /$i/, @font_list or push @font_list, "$fn/$i";
- }
- }
- }
- }
- else {
- if ( is_a_font($fn) ) {
- !$replace && grep( /$fn/, @installed_fonts ) and next;
- !grep /$fn/, (@installed_fonts) and push @font_list, "$fn";
- }
- }
- }
- $interactive
- and progress( $pbar, 0.50 / @install, _("Reselect correct fonts") );
- }
- $interactive and progress( $pbar, 1, _("done") );
- !@font_list && $interactive
- and display_error( _("could not find any font.\n") );
-}
-
-sub search_dir_font_uninstall {
- my @font_list_tmp = ();
- my $fn = $_;
- if ( -d $fn ) {
- foreach my $i ( all($fn) ) {
- if ( is_a_font($i) ) { push @font_list_tmp, "$i"; }
- }
- }
- else {
- if ( is_a_font($fn) ) { push @font_list_tmp, "$fn"; }
- }
- foreach my $i (@installed_fonts_full_path) {
- foreach my $j (@font_list_tmp) {
- if ( $i =~ /$j/ ) { push @font_list, "$i"; }
- }
- }
- print "Fonts to uninstal : " . $_ . "\n" foreach (@font_list);
-}
-
-sub search_dir_font_uninstall_gi {
- @font_list = @uninstall;
- $interactive and progress( $pbar, 1, _("Search fonts in installed list") );
-}
-
-sub print_list {
- print "Font(s) to Install :\n\n";
- print "$_\n" foreach (@font_list);
-}
-
-sub dir_created {
- -e $drakfont_dir || mkdir_p($drakfont_dir);
- -e $drakfont_dir . "/Type1" || mkdir_p( $drakfont_dir . "/Type1" );
- -e $drakfont_dir . "/ttf" || mkdir_p( $drakfont_dir . "/ttf" );
- -e $drakfont_dir . "/tmp" || mkdir_p( $drakfont_dir . "/tmp" );
- -e $drakfont_dir . "/tmp/ttf" || mkdir_p( $drakfont_dir . "/tmp/ttf" );
- -e $drakfont_dir . "/tmp/Type1" || mkdir_p( $drakfont_dir . "/tmp/Type1" );
- -e $drakfont_dir . "/tmp/tmp" || mkdir_p( $drakfont_dir . "/tmp/tmp" );
-}
-
-sub put_font_dir {
- my @tmpl;
- my @list_ttf;
- -e "/usr/share/ghostscript"
- or $gs = 0 && print "ghostscript is not installed on your system...\n";
- if (@font_list) {
- dir_created();
- foreach my $i (@font_list) {
- cp_af( $i, $drakfont_dir . "/tmp/tmp" );
- $interactive
- and progress( $pbar1, 1 / @font_list, _("Fonts copy") );
- }
- $interactive and progress( $pbar1, 0.01, _("done") );
- $interactive
- and progress( $pbar2, 0.10, _("True Type fonts installation") );
- glob("$drakfont_dir/tmp/tmp/*.TTF")
- and system( 'cd '
- . $drakfont_dir
- . '/tmp/tmp ; for foo in *.TTF; do mv $foo `basename $foo .TTF`.ttf; done'
- );
- system( 'cd ' . $drakfont_dir . '/tmp/tmp && cp *.ttf ../../ttf' );
- $interactive
- and progress( $pbar2, 0.20, _("please wait during ttmkfdir...") );
-
- # system ('cd '.$drakfont_dir.'/ttf && $ttmkfdir > fonts.dir' );
- my $ttfdir = $drakfont_dir . "/ttf";
- `$mkttfdir $ttfdir`;
- $interactive and progress( $pbar2, 0.10, _("True Type install done") );
- my $update_chkfontpath = "$chkfontpath -a $drakfont_dir/ttf";
-
- if ( $so && $gs ) {
- my @glob_drak = glob("$drakfont_dir/tmp/tmp/*.ttf");
- foreach my $fontname (@glob_drak) {
- system("cd $drakfont_dir/tmp/tmp && $ttf2pt1 -b $fontname");
- $interactive
- and
- progress( $pbar2, 0.50 / @glob_drak, _("Fonts conversion") );
- }
- system(
-"cd $drakfont_dir/tmp/tmp && mv *.gsf *.pfb *.pfm *.afm ../Type1"
- );
- system("cd $drakfont_dir/tmp/Type1 && $type1inst");
- $interactive and progress( $pbar2, 0.10, _("type1inst building") );
- -e "$drakfont_dir/tmp/Type1/Fontmap"
- and system(
-"cd $drakfont_dir/tmp/Type1 && cat Fontmap >> `rpm -ql ghostscript | grep Fontmap.GS` "
- );
- system(
-"cd $drakfont_dir/tmp/Type1 && mv *.pfm *.gsf *.afm *.pfb ../../Type1 "
- );
- system("cd $drakfont_dir/Type1 && $type1inst");
- $interactive
- and progress( $pbar2, 0.05, _("Ghostscript referencing") );
- $update_chkfontpath .= "; $chkfontpath -a $drakfont_dir/Type1";
- }
-
- if ( !$so && $gs ) {
- foreach
- my $fontname ( @tmpl = glob("$/drakfont_dir/tmp/tmp/*.ttf") )
- {
- system("cd $/drakfont_dir/tmp/tmp && $ttf2pt1 -b $fontname");
- $interactive
- and progress( $pbar2, 0.50 / @tmpl, _("Fonts conversion") );
- }
- system("cd $drakfont_dir/tmp/tmp && mv *.gsf *.pfb *.pfm ../Type1");
- system("cd $drakfont_dir/tmp/Type1 && $type1inst");
- $interactive and progress( $pbar2, 0.1, _("type1inst building") );
- system(
-"cd $drakfont_dir/tmp/Type1 && cat Fontmap >> `rpm -ql ghostscript | grep Fontmap.GS` "
- );
- system(
-"cd $drakfont_dir/tmp/Type1 && mv *.pfm *.afm *.gsf *.pfb ../../Type1 "
- );
- system("cd $drakfont_dir/Type1 && $type1inst");
- $interactive
- and progress( $pbar2, 0.05, _("Ghostscript referencing") );
- $update_chkfontpath .= "; $chkfontpath -a $drakfont_dir/Type1";
- }
-
- if ( $so && !$gs ) {
- foreach my $fontname ( @tmpl = glob("$drakfont_dir/tmp/tmp/*.ttf") )
- {
- system("cd $drakfont_dir/tmp/tmp && $ttf2pt1 $fontname");
- $interactive
- and
- progress( $pbar2, 0.25 / @tmpl, _("ttf fonts conversion") );
- }
- foreach my $fontname ( @tmpl = glob("$drakfont_dir/tmp/tmp/*.pfm") )
- {
- system("cd $drakfont_dir/tmp/tmp && $pfm2afm $fontname");
- $interactive
- and
- progress( $pbar2, 0.25 / @tmpl, _("pfm fonts conversion") );
- }
- system("cd $drakfont_dir/tmp/tmp && mv *.afm ../Type1");
- system("cd $drakfont_dir/tmp/Type1 && mv *.afm ../../Type1 ");
- system("cd $drakfont_dir/Type1 && $type1inst");
- $interactive and progress( $pbar2, 0.14, _("type1inst building") );
- $update_chkfontpath .= "; $chkfontpath -a $drakfont_dir/Type1";
- }
-
- $interactive and progress( $pbar2, 0.01, _("done") );
- $interactive
- and progress( $pbar3, 0.25, _("Suppress temporary Files") );
- rm_rf("$drakfont_dir/tmp/");
- print "\n\nretarting xfs......\n";
- $interactive and progress( $pbar3, 0.5, _("Restart XFS") );
- system($update_chkfontpath);
-
- # system ($restart_xfs);
- # system('kill -USR1 `/sbin/pidof xfs` 2&1>/dev/null');
- system('/etc/rc.d/init.d/xfs restart');
- $interactive and progress( $pbar3, 0.30, _("done") );
- }
-}
-
-sub remove_gs_fonts {
- my @Fontmap_new;
-
- if ( all("$drakfont_dir/remove") ) {
- system(" cd $drakfont_dir/remove && $type1inst");
- my @Fontmap_out = cat_("$drakfont_dir/remove/Fontmap");
- my $FontmapGS = `rpm -ql ghostscript | grep Fontmap.GS`;
- chomp($FontmapGS);
- my @FontmapGS_list = cat_($FontmapGS);
- foreach my $font_gs (@FontmapGS_list) {
- my @tmp_list = split ( ' ', $font_gs );
- grep ( $_ =~ /$tmp_list[0]/, @Fontmap_out )
- or push @Fontmap_new, $font_gs;
- }
- print $_ foreach @Fontmap_new;
- output( $FontmapGS, @Fontmap_new );
- }
-
-}
-
-sub remove_fonts {
- my @list_dir;
- -e $drakfont_dir . "/remove" || mkdir_p( $drakfont_dir . "/remove" );
- $interactive and progress( $pbar, 1, _("done") );
- foreach my $i (@font_list) {
- $_ = $i;
- if ( /.pfb$/ || /.gsf$/ || /.pfm$/ || /.pfa$/ ) {
- system("mv $_ $drakfont_dir/remove ");
- }
- else {
- rm_rf($i);
- }
- $i =~ s/\/\w*\.\w*//gi;
- grep ( $i, (@list_dir) ) or push @list_dir, $i;
- $interactive
- and progress( $pbar1, 1 / @font_list, _("Suppress Fonts Files") );
- }
- $interactive and progress( $pbar1, 0.01, _("done") );
- -e "/usr/share/ghostscript" and remove_gs_fonts();
- foreach my $i (@list_dir) {
- if ( listlength all("$i") < 3 ) {
- system("chkfontpath -r $i")
- or print "PERL::system command failed during chkfontpath\n";
- }
- else {
- system("cd $i && type1inst")
- or print "PERL::system command failed during cd or type1inst\n";
- }
- $interactive
- and progress( $pbar2, 1 / @list_dir, _("Suppress Fonts Files") );
- }
- $interactive and progress( $pbar2, 0.01, _("xfs restart") );
- system("/etc/rc.d/init.d/xfs restart");
- -e "/usr/share/ghostscript" and rm_rf("$drakfont_dir/remove");
- $interactive and progress( $pbar2, 0.01, _("done") );
-}
-
-sub license_msg {
- print _(
-"Before installing any fonts, be sure that you have the right to use and install them on your system.\n\n-You can install the fonts using the normal way. In rare cases, bogus fonts may hang up your X Server."
- )
- . "\n";
-}
-
- $list_all_font_path
- || $xlsfonts
- || $windows
- || @install
- || @uninstall ? backend_mod() : interactive_mode();
-
-sub backend_mod {
- if ($xlsfonts) {
- system("xlsfonts");
- }
- if ($list_all_font_path) {
- system("$chkfontpath");
- }
- if ($windows) {
- license_msg();
- print "\nWindows fonts Installation........\n";
- search_installed_fonts();
- if ( search_windows_font() ) {
- print_list();
- put_font_dir();
- }
- print "\nThe End...........................\n";
- }
-
- if (@install) {
- license_msg();
- print "\nInstall Specifics Fonts...........\n";
- search_installed_fonts();
- search_dir_font;
- print "Font to install : " . $_ . "\n" foreach (@font_list);
- put_font_dir();
- print "\nThe End...........................\n";
- }
-
- if (@uninstall) {
- print "\nUninstall Specifics Fonts.........\n";
- search_installed_fonts_full_path();
- if ($interactive) { search_dir_font_uninstall_gi() }
- else { search_dir_font_uninstall $_ foreach (@uninstall) }
- remove_fonts();
- print "\nThe End............................\n";
- }
-}
-
-sub create_fontsel {
- my $font_sel;
- gtkpack( $font_box, $font_sel = new Gtk::FontSelection, );
- $central_widget = \$font_sel;
-}
-
-sub display_error {
- my ($message) = @_;
- my $label;
- my $error_box;
- ${$central_widget}->destroy();
- gtkpack(
- $font_box,
- $error_box = gtkpack_(
- new Gtk::VBox( 0, 0 ),
- 1,
- new Gtk::Label($message),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::HButtonBox, -spread ),
- gtksignal_connect(
- new Gtk::Button( _("OK") ),
- clicked =>
- sub { ${$central_widget}->destroy(); create_fontsel() }
- ),
- ),
- )
- );
- $central_widget = \$error_box;
-}
-
-sub interactive_mode {
- my $font_sel;
- $interactive = 1;
- init Gtk;
- my $window1 =
- $::isEmbedded ? new Gtk::Plug($::XID) : new Gtk::Window -toplevel;
- $window1->signal_connect( delete_event => sub { Gtk->exit(0) } );
- $window1->set_position(1);
- $window1->set_title( _("Fonts Importation") );
- $window1->set_border_width(5);
- my ( $pix_user_map, $pix_user_mask ) = gtkcreate_png("ic-drakfont-48");
- my ( $pix_u_map, $pix_u_mask ) = gtkcreate_png("drakfont.620x57");
-
- gtkadd(
- $window1,
- gtkpack_(
- new Gtk::VBox( 0, 2 ),
- if_(
- !$::isEmbedded, 0, new Gtk::Pixmap( $pix_u_map, $pix_u_mask )
- ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 2 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 2 ),
- 1,
- gtkpack(
- $font_box = new Gtk::VBox( 0, 5 ),
- $font_sel = new Gtk::FontSelection,
- ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 2 ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::VButtonBox, -end ),
- gtksignal_connect(
- new Gtk::Button( _("Get Windows Fonts") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $windows = 1;
- appli_choice();
- }
- ),
- gtksignal_connect(
- new Gtk::Button( _("Uninstall Fonts") ),
- clicked => sub {
- ${$central_widget}->destroy();
- uninstall();
- }
- ),
- ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::VButtonBox, -end ),
- gtksignal_connect(
- new Gtk::Button( _("Advanced Options") ),
- clicked => sub {
- ${$central_widget}->destroy();
- $windows = 0;
- advanced_install();
- }
- ),
- gtksignal_connect(
- new Gtk::Button( _("Font List") ),
- clicked => sub {
- ${$central_widget}->destroy();
- create_fontsel();
- }
- ),
- ),
- 1,
- new Gtk::HBox( 0, 2 ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::VButtonBox, -end ),
- gtksignal_connect(
- new Gtk::Button( _("Help") ),
- clicked =>
- sub { ${$central_widget}->destroy(); help() }
- ),
- gtksignal_connect(
- new Gtk::Button( _("Close") ),
- clicked => sub {
- $::isEmbedded and kill USR1, $::CCPID;
- Gtk->main_quit();
- }
- ),
- ),
- ),
- ),
-
- # 0, gtkpack_(new Gtk::VBox(0,5),
- # 0, new Gtk::VBox(0,0),
- # 0, new Gtk::Pixmap($pix_user_map, $pix_user_mask),
- # 1, new Gtk::VBox(0,0),
- # 1, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
- # gtksignal_connect(new Gtk::Button(_("About")), clicked => sub {
- # ${$central_widget}->destroy(); about() }),
- # gtksignal_connect(new Gtk::Button(_(" Help ")), clicked => sub {
- # ${$central_widget}->destroy(); help() }),
- # gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub {
- # $::isEmbedded and kill USR1, $::CCPID;
- # Gtk->main_quit() }),
- # ),
- # )
- ),
- ),
- );
- $central_widget = \$font_sel;
- $window1->show_all;
- $font_sel->set_page(1);
- $font_sel->cur_page->child->hide();
- $font_sel->set_page(2);
- $font_sel->cur_page->child->hide();
- $font_sel->set_page(0);
- $window1->realize;
-
- # $window1->show_all();
- Gtk->main_iteration while Gtk->events_pending;
- $::isEmbedded and kill USR2, $::CCPID;
- Gtk->main;
- Gtk->exit(0);
-}
-
-sub about {
- my $text = new Gtk::Text( undef, undef );
- my $about_box;
- gtkpack(
- $font_box,
- $about_box = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 0 ),
- 1,
- gtktext_insert(
- gtkset_editable( $text, 1 ), "
- Copyright (C) 2001 by MandrakeSoft
- DUPONT Sebastien sdupont\@mandrakesoft.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
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- 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.
-
- Thanks:
- - pfm2afm:
- by Ken Borgendale:
- Convert a Windows .pfm file to a .afm (Adobe Font Metrics)
- - type1inst:
- by James Macnicol:
- type1inst generates files fonts.dir fonts.scale & Fontmap.
- - ttf2pt1:
- by Andrew Weeks, Frank Siegert, Thomas Henlich, Sergey Babkin
- Convert ttf font files to afm and pfb fonts
-
-
-"
- ),
- 0,
- new Gtk::VScrollbar( $text->vadj ),
- ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::HButtonBox, -spread ),
- gtksignal_connect(
- new Gtk::Button( _("OK") ),
- clicked =>
- sub { ${$central_widget}->destroy(); create_fontsel() }
- ),
- ),
- )
- );
- $central_widget = \$about_box;
- $font_box->show_all();
-}
-
-sub help {
- my $text = new Gtk::Text( undef, undef );
- my $help_box;
- gtkpack(
- $font_box,
- $help_box = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 0 ),
- 1,
- gtktext_insert(
- gtkset_editable( $text, 1 ), "drakfont Future Overview
- - Fonts import :
- pfb ( Adobe Type 1 binary )
- pfa ( Adobe Type 1 ASCII )
- ttf ( True-Type )
- pcf.gz
- Speedo
- and Bitmap (PCF, BDF, and SNF)
- - Features
- - Install fonts from any directory
- - Get windows fonts on any vfat partitions
- - Get fonts on any partitions.
- - UN-installation of any fonts (even if not installed through drakfont)
- - Support
- - Xfs
- - ghostscript & printer
- - Staroffice & printer
- - abiword
- - netscape
- - Koffice, Gnumeric, ... studying
- - all fonts supported by printer
- - anti-aliases by RENDER in Xfree86 ....
- supported by KDE.
- will be supported by gnome 1.2.
-Visual Interface:
- Window interface:
- - Fontselectiondialog widget
- - Command buttons under Fontselectiondialog (like the actual frontend).
- Commands buttons:
- - import from windows partition.
- import from all fat32 partitions and look for winnt/windows/font
- and import all (delete doublon) but don't import if already exist.
- - import from directory
- look for if it exist before for each font and not delete the original.
- (replace all, no, none)
- expert options:
- ask the directory, and look for if it exist before
- if it exist ask: (replace all, no, none)
- - uninstall with list per font type
- Expert additional switch
- - option support: ghostscript, Staroffice, etc...
- check-button. (by default all check)
- - Printer Application Fonts Support...
-
-
-"
- ),
- 0,
- new Gtk::VScrollbar( $text->vadj ),
- ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::HButtonBox, -spread ),
- gtksignal_connect(
- new Gtk::Button( _("OK") ),
- clicked =>
- sub { ${$central_widget}->destroy(); create_fontsel() }
- ),
- ),
- )
- );
- $central_widget = \$help_box;
- $font_box->show_all();
-}
-
-sub appli_choice {
- my $choice_box;
- my $text = new Gtk::Text( undef, undef );
- gtkpack(
- $font_box,
- $choice_box = gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 0,
- new Gtk::VBox( 0, 10 ),
- 0,
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack(
- new Gtk::HBox( 0, 10 ),
- new Gtk::HBox( 0, 10 ),
- _(
-"Choose the applications that will support the fonts :"
- ),
- new Gtk::HBox( 0, 10 ),
- ),
- 0,
- new Gtk::HBox( 0, 10 ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ), 0,
- _("Ghostscript"), 1,
- new Gtk::HBox( 0, 10 ), 0,
- my $check11 = new Gtk::CheckButton(),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ), 0,
- _("StarOffice"), 1,
- new Gtk::HBox( 0, 10 ), 0,
- my $check22 = new Gtk::CheckButton(),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ), 0,
- _("Abiword"), 1,
- new Gtk::HBox( 0, 10 ), 0,
- my $check33 = new Gtk::CheckButton(),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ), 0,
- _("Generic Printers"), 1,
- new Gtk::HBox( 0, 10 ), 0,
- my $check44 = new Gtk::CheckButton(),
- ),
- ),
- 0,
- gtkpack_(
- new Gtk::HBox( 0, 10 ),
- 1,
- gtktext_insert(
- gtkset_editable( $text, 0 ),
- _(
-"Before installing any fonts, be sure that you have the right to use and install them on your system.\n\n-You can install the fonts using the normal way. In rare cases, bogus fonts may hang up your X Server."
- )
- ),
- 0,
- new Gtk::VScrollbar( $text->vadj ),
- 0,
- new Gtk::VBox( 0, 10 ),
- ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::HButtonBox, -spread ),
- gtksignal_connect(
- new Gtk::Button( _("OK") ),
- clicked => sub {
- ${$central_widget}->destroy();
- import_status();
- }
- ),
- gtksignal_connect(
- new Gtk::Button( _("Cancel") ),
- clicked => sub {
- ${$central_widget}->destroy();
- create_fontsel();
- }
- ),
- ),
- ),
- 0,
- new Gtk::VBox( 0, 10 ),
- 0,
- new Gtk::VBox( 0, 10 ),
- ),
-
- );
- foreach (
- [ $check11, \$gs ],
- [ $check22, \$so ],
- [ $check33, \$abi ],
- [ $check44, \$printer ]
- )
- {
- my $ref = $_->[1];
- gtksignal_connect( gtkset_active( $_->[0], ${$ref} ),
- toggled => sub { ${$ref} = ${$ref} ? 0 : 1; } );
- }
- $central_widget = \$choice_box;
- $font_box->show_all();
-}
-
-sub font_choice {
- my $file_dialog;
-
- $file_dialog = gtksignal_connect(
- new Gtk::FileSelection( _("File Selection") ),
- destroy => sub { $file_dialog->destroy(); }
- );
- $file_dialog->ok_button->signal_connect(
- clicked => \&file_ok_sel,
- $file_dialog
- );
- $file_dialog->ok_button->child->set( _("Add") );
- $file_dialog->cancel_button->signal_connect(
- clicked => sub { $file_dialog->destroy() } );
- $file_dialog->cancel_button->child->set( _("Close") );
- $file_dialog->set_filename(
- _("Select the font file or directory and click on 'Add'") );
- $file_dialog->show();
-}
-
-sub file_ok_sel {
- my ( $widget, $file_selection ) = @_;
- my $file_name = $file_selection->get_filename();
- print "-- @install\n";
- if ( !member( $file_name, @install ) ) {
- push ( @install, $file_name );
- $list->add( gtkshow( new Gtk::ListItem($file_name) ) );
- }
-}
-
-sub list_remove {
- my ( $widget, $list ) = @_;
- my @to_remove;
- push @to_remove, $list->child_position($_) foreach ( $list->selection );
- splice @install, $_, 1 foreach ( reverse sort @to_remove );
- $list->remove_items( $list->selection );
-}
-
-sub advanced_install {
- my $scrolled_window;
- my $adv_box;
- $list = new Gtk::List();
- $list->set_selection_mode( -extended );
-
- gtkpack(
- $font_box,
- $adv_box = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_( new Gtk::HBox( 0, 4 ), 1, createScrolledWindow($list), ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::HButtonBox, -spread ),
- gtksignal_connect(
- new Gtk::Button( _("Add") ),
- clicked => sub { font_choice() }
- ),
- gtksignal_connect(
- new Gtk::Button( _("Remove Selected") ),
- clicked => \&list_remove,
- $list
- ),
- gtksignal_connect(
- new Gtk::Button( _("Install List") ),
- clicked => sub {
- ${$central_widget}->destroy();
- appli_choice();
- }
- ),
- ),
- )
- );
- $central_widget = \$adv_box;
- $adv_box->show_all();
-}
-
-sub list_to_remove {
- my @number_to_remove;
- my @files_path = grep( !/fonts/, all($current_path) );
- Gtk->main_iteration while Gtk->events_pending;
- push @number_to_remove,
- $path_list->child_position($_) foreach ( $path_list->selection );
- @uninstall = ();
- push @uninstall,
- $current_path . "/" . $files_path[$_] foreach (@number_to_remove);
- ${$central_widget}->destroy();
- show_list_to_remove();
-}
-
-sub show_list_to_remove {
- my $show_box;
- my $show_list = new Gtk::List();
- $show_list->add( gtkshow( new Gtk::ListItem($_) ) ) foreach @uninstall;
- gtkpack(
- $font_box,
- $show_box = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 4 ),
- 1, createScrolledWindow($show_list)
- ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::HButtonBox, -spread ),
- gtksignal_connect(
- new Gtk::Button( _("click here if you are sure.") ),
- clicked => sub {
- ${$central_widget}->destroy();
- import_status_uninstall();
- }
- ),
- gtksignal_connect(
- new Gtk::Button( _("here if no.") ),
- clicked =>
- sub { ${$central_widget}->destroy(); create_fontsel() }
- ),
- ),
- )
- );
- $central_widget = \$show_box;
- $show_box->show_all();
-}
-
-sub uninstall {
- my $scrolled_window;
- my $scrolled_window2;
- my $uninst_box;
- @install = ();
- @installed_fonts_path = ();
- list_fontpath();
- chk_empty_xfs_path();
- $list_path = new Gtk::List();
- $list_path->set_selection_mode( -extended );
-
- foreach (@installed_fonts_path) {
- my $t = $_;
- $list_path->add(
- gtkshow(
- gtksignal_connect(
- new Gtk::ListItem($t),
- select => sub {
- $current_path = $t;
- $path_list->clear_items( 0, -1 );
- $path_list->append_items(
- map {
- /fonts/
- ? ()
- : gtkshow( new Gtk::ListItem($_) )
- } all($t)
- );
- }
- )
- )
- );
- }
- $list_path->set_selection_mode( -single );
- $path_list = new Gtk::List();
- $path_list->set_selection_mode( -extended );
-
- gtkpack(
- $font_box,
- $uninst_box = gtkpack_(
- new Gtk::VBox( 0, 10 ),
- 1,
- gtkpack_(
- new Gtk::HBox( 0, 4 ), 1,
- createScrolledWindow($list_path), 1,
- createScrolledWindow($path_list)
- ),
- 0,
- gtkadd(
- gtkset_layout( new Gtk::HButtonBox, -spread ),
- gtksignal_connect(
- new Gtk::Button( _("Unselected All") ),
- clicked => sub { $path_list->unselect_all(); }
- ),
- gtksignal_connect(
- new Gtk::Button( _("Selected All") ),
- clicked => sub { $path_list->select_all(); }
- ),
- gtksignal_connect(
- new Gtk::Button( _("Remove List") ),
- clicked => sub { list_to_remove() }
- ),
- ),
- )
- );
- $central_widget = \$uninst_box;
- $uninst_box->show_all();
-}
-
-sub import_status {
- my $table;
- $pbar = new Gtk::ProgressBar;
- $pbar1 = new Gtk::ProgressBar;
- $pbar2 = new Gtk::ProgressBar;
- $pbar3 = new Gtk::ProgressBar;
- gtkpack(
- $font_box,
- $table = create_packtable(
- { col_spacings => 10, row_spacings => 50 },
- [ "", "" ],
- [
- _("Initials tests"), $pbar, $pbar->{label} = new Gtk::Label(' ')
- ],
- [
- _("Copy fonts on your system"), $pbar1,
- $pbar1->{label} = new Gtk::Label(' ')
- ],
- [
- _("Install & convert Fonts"), $pbar2,
- $pbar2->{label} = new Gtk::Label(' ')
- ],
- [
- _("Post Install"), $pbar3, $pbar3->{label} = new Gtk::Label(' ')
- ],
- ),
- );
- $central_widget = \$table;
- $font_box->show_all();
- Gtk->main_iteration while Gtk->events_pending;
- backend_mod();
-}
-
-sub import_status_uninstall {
- my $table;
- $pbar = new Gtk::ProgressBar;
- $pbar1 = new Gtk::ProgressBar;
- $pbar2 = new Gtk::ProgressBar;
- gtkpack(
- $font_box,
- $table = create_packtable(
- { col_spacings => 10, row_spacings => 50 },
- [ "", "" ],
- [ "", "" ],
- [
- _("Initials tests"), $pbar, $pbar->{label} = new Gtk::Label(' ')
- ],
- [
- _("Remove fonts on your system"), $pbar1,
- $pbar1->{label} = new Gtk::Label(' ')
- ],
- [
- _("Post Uninstall"), $pbar2,
- $pbar2->{label} = new Gtk::Label(' ')
- ],
- ),
- );
- $central_widget = \$table;
- $font_box->show_all();
- Gtk->main_iteration while Gtk->events_pending;
- backend_mod();
-}
-
-sub progress {
- my ( $progressbar, $incr, $label_text ) = @_;
- my ($new_val) = $progressbar->get_current_percentage;
- $new_val += $incr;
- if ( $new_val > 1 ) { $new_val = 1 }
- $progressbar->update($new_val);
- $progressbar->{label}->set($label_text);
- Gtk->main_iteration while Gtk->events_pending;
-}
-
diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw
deleted file mode 100755
index 08119a6a9..000000000
--- a/perl-install/standalone/drakgw
+++ /dev/null
@@ -1,770 +0,0 @@
-#!/usr/bin/perl
-
-#
-# Guillaume Cottenceau (gc@mandrakesoft.com)
-#
-# Copyright 2000, 2001, 2002 MandrakeSoft
-#
-# 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 lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use common;
-use detect_devices;
-use interactive;
-use log;
-use c;
-use network::netconnect;
-
-$::isInstall and die "Not supported during install.\n";
-
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: drakgw [--version]\n";
-/-version/ and die 'version: $Id$ '."\n";
-$::Wizard_pix_up = "wiz_drakgw.png";
-$::Wizard_title = _("Internet Connection Sharing");
-$::direct = /-direct/;
-
-
-my $sysconf_network = "/etc/sysconfig/network";
-my $sysconf_dhcpd = "/etc/sysconfig/dhcpd";
-my $rc_firewall_generic = "/etc/rc.d/rc.firewall";
-my $rc_firewall_drakgw = "/etc/rc.d/rc.firewall.inet_sharing";
-my $rc_firewall_24 = "/etc/rc.d/rc.firewall.inet_sharing-2.4";
-my $dhcpd_conf = "/etc/dhcpd.conf";
-my $cups_conf = "/etc/cups/cupsd.conf";
-my $drakgw_setup = "/etc/sysconfig/inet_sharing";
-
-
-my $in = 'interactive'->vnew('su', 'default');
-
-!$::isEmbedded && $in->isa('interactive::gtk') and $::isWizard=1;
-
-pur_gtk_mode() if $::isEmbedded && $in->isa('interactive::gtk');
-
-sub sys { system(@_) == 0 or log::l("[drakgw] Warning, sys failed for $_[0]") }
-
-sub outpend {
- standalone::explanations("modified file $_[0]");
- my $f = shift; local *F; open F, ">>$f" or die "outpend in file $f failed: $!\n"; print F foreach @_;
-}
-
-sub start_daemons ()
-{
- my $cups_used = 0;
- standalone::explanations("Starting daemons");
- if (-f "/etc/rc.d/init.d/cups") {
- if (system("/etc/rc.d/init.d/cups status >/dev/null") == 0) {
- $cups_used = 1;
- sys("/etc/rc.d/init.d/cups stop");
- }
- }
- system("/etc/rc.d/init.d/dhcpd status >/dev/null") == 0 and sys("/etc/rc.d/init.d/dhcpd stop");
- system("/etc/rc.d/init.d/named status >/dev/null 2>/dev/null") == 0 and sys("/etc/rc.d/init.d/named stop");
-
- my $netmon = '/usr/sbin/net_monitor';
- my $netmon_need_start;
- if (-x $netmon && `$netmon --status` eq 1) {
- $netmon_need_start = 1;
- system("$netmon --disconnect --force --quiet >/dev/null");
- }
- sys("/etc/rc.d/init.d/network restart");
- $netmon_need_start and system("$netmon --connect --force --quiet >/dev/null");
-
- sys("sh $rc_firewall_generic");
-
- sys("/etc/rc.d/init.d/$_ start"), sys("/sbin/chkconfig --level 345 $_ on") foreach 'named', 'dhcpd';
- sys("/etc/rc.d/init.d/cups start") if $cups_used;
-
- substInFile { s/^INET_SHARING.*\n//; $_ .= "INET_SHARING=enabled\n" if eof } $drakgw_setup;
-}
-
-sub stop_daemons ()
-{
- standalone::explanations("Stopping daemons");
- system("/etc/rc.d/init.d/dhcpd status >/dev/null") == 0 and sys("/etc/rc.d/init.d/dhcpd stop");
- system("/etc/rc.d/init.d/named status >/dev/null 2>/dev/null") == 0 and sys("/etc/rc.d/init.d/named stop");
- sys("/sbin/iptables -t nat -F");
- sys("/sbin/chkconfig --level 345 $_ off") foreach 'named', 'dhcpd';
-
- substInFile { s/^INET_SHARING.*\n//; $_ .= "INET_SHARING=disabled\n" if eof } $drakgw_setup;
-}
-
-sub fatal_quit ($)
-{
- log::l("[drakgw] FATAL: $_[0]");
- undef $wait_configuring;
- $in->ask_warn('', $_[0]);
- quit_global($in, -1);
-}
-
-my ($kernel_version) = c::kernel_version() =~ /(...)/;
-log::l("[drakgw] kernel_version $kernel_version");
-
-$kernel_version eq '2.4' or fatal_quit(_("Sorry, we support only 2.4 kernels."));
-
-
-begin:
-
-#- **********************************
-#- * 0th step: verify if we are already set up
-
-if (-f $drakgw_setup) {
- $::Wizard_no_previous = 1;
-
- if (grep(/enabled/, cat_($drakgw_setup))) {
- my $r = $in->ask_from_list_(_("Internet Connection Sharing currently enabled"),
-_("The setup of Internet connection sharing has already been done.
-It's currently enabled.
-
-What would you like to do?"),
- [ __("disable"), __("reconfigure"), __("dismiss") ]) or quit_global($in, 0);
- if ($r eq "disable") {
- {
- my $wait_disabl = $in->wait_message('', _("Disabling servers..."));
- stop_daemons();
- }
- foreach ($dhcpd_conf, $rc_firewall_24) {
- renamef($_, "$_.drakgwdisable") or die "Could not rename $_ to $_.drakgwdisable"
- }
- log::l("[drakgw] Disabled");
- $::Wizard_finished = 1;
- $in->ask_okcancel('', _("Internet connection sharing is now disabled."));
- quit_global($in, 0);
- }
- if ($r eq "dismiss") {
- quit_global($in, 0);
- }
- }
- elsif (grep(/disabled/, cat_($drakgw_setup)))
- {
- my $r = $in->ask_from_list_(_("Internet Connection Sharing currently disabled"),
-_("The setup of Internet connection sharing has already been done.
-It's currently disabled.
-
-What would you like to do?"),
- [ __("enable"), __("reconfigure"), __("dismiss") ]);
- if ($r eq "enable") {
- foreach ($dhcpd_conf, $rc_firewall_24) {
- rename($_, "$_.old") if -f $_;
- rename("$_.drakgwdisable", $_) or die "Could not find configuration. Please reconfigure.";
- }
- {
- my $wait_enabl = $in->wait_message('', _("Enabling servers..."));
- start_daemons();
- }
- log::l("[drakgw] Enabled");
- $::Wizard_finished = 1;
- $in->ask_okcancel('', _("Internet connection sharing is now enabled."));
- quit_global($in, 0);
- }
- if ($r eq "dismiss") {
- quit_global($in, 0);
- }
- }
- else {
- log::l("[drakgw] Warning, unrecognized config file, ignoring");
- renamef($drakgw_setup, "$drakgw_setup.unrecognized");
- }
-}
-
-
-#- **********************************
-#- * 1st step: detect/setup
-step_ask_confirm:
-
-$::Wizard_no_previous = 1;
-
-$::direct or $in->ask_okcancel(_("Internet Connection Sharing"),
-_("You are about to configure your computer to share its Internet connection.
-With that feature, other computers on your local network will be able to use this computer's Internet connection.
-
-Note: you need a dedicated Network Adapter to set up a Local Area Network (LAN)."), 1) or quit_global($in, 0);
-
-undef $::Wizard_no_previous;
-
-
-step_detectsetup:
-
-my @configured_devices = map { /ifcfg-(\S+)/ } glob('/etc/sysconfig/network-scripts/ifcfg*');
-
-my %aliased_devices;
-/^\s*alias\s+(eth[0-9])\s+(\S+)/ and $aliased_devices{$1} = $2 foreach cat_("/etc/modules.conf");
-
-my $card_netconnect = network::netconnect::get_net_device();
-defined $card_netconnect and log::l("[drakgw] Information from netconnect: ignore card $card_netconnect");
-
-my @cards = grep {
- log::l("[drakgw] Have network card: $_");
- $_ ne $card_netconnect
-} detect_devices::getNet();
-log::l("[drakgw] Available network cards: ", join(", ", @cards));
-
-my $format = sub {
- $aliased_devices{$_[0]} ?
- _("Interface %s (using module %s)", $_[0], $aliased_devices{$_[0]}) :
- _("Interface %s", $_[0]);
-};
-
-#- setup the network interface we shall use
-
-my $device;
-if (!@cards)
-{
- $in->ask_warn(_("No network adapter on your system!"),
- _("No ethernet network adapter has been detected on your system. Please run the hardware configuration tool."));
- quit_global($in, 0);
-}
-elsif (@cards == 1)
-{
- $device = $cards[0];
- $in->ask_okcancel(_("Network interface"),
-_("There is only one configured network adapter on your system:
-
-%s
-
-I am about to setup your Local Area Network with that adapter.", $format->($device)), 1) or goto step_ask_confirm;
-}
-else
-{
- $device = $in->ask_from_listf(_("Choose the network interface"),
- _("Please choose what network adapter will be connected to your Local Area Network."),
- $format,
- \@cards,
- ) or goto step_ask_confirm;
- defined $device or quit_global($in, 0);
-}
-standalone::explanations("Choosing network device: $device");
-
-
-my $lan_address = "192.168.0.0";
-my $server_ip = "192.168.0.1";
-
-my $reconf_dhcp_server_intf = 1;
-
-if (grep(/$device/, @configured_devices)) {
- step_warning_already_conf:
- my $auto = _('Yes');
- my $conf = network::read_interface_conf("/etc/sysconfig/network-scripts/ifcfg-$device");
- $in->ask_from(_("Network interface already configured"),
- _("Warning, the network adapter (%s) is already configured.
-
-Do you want an automatic re-configuration?
-
-You can do it manually but you need to know what you're doing.", $device),
- [ { label => _("Automatic reconfiguration"), val => \$auto, list => [ _('Yes'), _('No (experts only)') ] },
- { val => _("Show current interface configuration"), clicked =>
- sub { $in->ask_warn(_('Current interface configuration'),
- _("Current configuration of `%s':
-
-Network: %s
-IP address: %s
-IP attribution: %s
-Driver: %s", $device, $conf->{NETWORK}, $conf->{IPADDR}, $conf->{BOOTPROTO}, $aliased_devices{$device} || '(unknown)')) } } ]) or goto step_detectsetup;
-
- if ($auto ne _('Yes')) {
- $reconf_dhcp_server_intf = 0;
- $server_ip = $conf->{IPADDR};
- $lan_address = $conf->{NETWORK};
- $in->ask_from('',
- _("I can keep your current configuration and assume you already set up a DHCP server; in that case please verify I correctly read the C-Class Network that you use for your local network; I will not reconfigure it and I will not touch your DHCP server configuration.
-
-Else, I can reconfigure your interface and (re)configure a DHCP server for you.
-
-", $device),
- [ { label => _("C-Class Local Network"), val => \$lan_address, type => 'entry' },
- { label => _("(This) DHCP Server IP"), val => \$server_ip, type => 'entry' },
- { label => _("Re-configure interface and DHCP server"), val => \$reconf_dhcp_server_intf, type => 'bool' } ])
- or goto step_warning_already_conf;
- }
-}
-
-if (!($lan_address =~ s/\.0$//)) {
- $in->ask_warn('',
- _("The Local Network did not finish with `.0', bailing out."));
- quit_global($in, 0);
-}
-standalone::explanations("Using LAN address <$lan_address>");
-
-
-#- test for potential conflict with other networks
-
-foreach (grep { $_ ne $device } @configured_devices)
-{
- grep(/$lan_address/, cat_("/etc/sysconfig/network-scripts/ifcfg-$_")) and
- ($in->ask_warn('', _("Potential LAN address conflict found in current config of %s!\n", $_)) or goto step_detectsetup);
-}
-
-
-#- test for potential conflict with previous firewall config
-
-system('modprobe iptable_nat');
-if (-f '/etc/sysconfig/iptables' || -x '/sbin/iptables' && listlength(`/sbin/iptables -t nat -nL`) > 8) {
- $in->ask_okcancel(_("Firewalling configuration detected!"),
- _("Warning! An existing firewalling configuration has been detected. You may need some manual fix after installation.")) or goto step_detectsetup;
-}
-
-
-#- **********************************
-#- * 2nd step: configure
-
-$wait_configuring = $in->wait_message(_("Configuring..."),
- _("Configuring scripts, installing software, starting servers..."));
-
-
-#- setup the /etc/sysconfig/network-script/ script
-
-if ($reconf_dhcp_server_intf) {
- standalone::explanations("Reconfiguring network parameters of $device");
- my $network_scripts = "/etc/sysconfig/network-scripts";
- my $ifcfg = "$network_scripts/ifcfg-$device";
- renamef($ifcfg, "$network_scripts/old.ifcfg-$device");
- output($ifcfg, qq(DEVICE=$device
-BOOTPROTO=static
-IPADDR=$server_ip
-NETMASK=255.255.255.0
-NETWORK=$lan_address.0
-BROADCAST=$lan_address.255
-ONBOOT=yes
-));
-}
-
-
-#- install and setup the RPM packages
-
-my $rpms_to_install;
-my %rpm2file = ( iptables => '/sbin/iptables',
- 'dhcp-server' => '/usr/sbin/dhcpd',
- bind => '/usr/sbin/named',
- 'caching-nameserver' => '/var/named/named.local');
-
-#- first: try to install all in one step
-my @needed_to_install = grep { !-e $rpm2file{$_} } keys %rpm2file;
-@needed_to_install and $in->do_pkgs->install(@needed_to_install);
-#- second: try one by one if failure detected
-if (grep { !-e $rpm2file{$_} } keys %rpm2file) {
- foreach (keys %rpm2file) {
- -e $rpm2file{$_} or $in->do_pkgs->install($_);
- -e $rpm2file{$_} or fatal_quit(_("Problems installing package %s", $_));
- }
-}
-
-
-#- setup the masquerading configuration
-standalone::explanations("Modifying firewalling configuration");
-if (!-f $rc_firewall_generic) {
- output($rc_firewall_generic, "#!/bin/sh
-#
-# Automatically generated by drakgw
-[ -x $rc_firewall_drakgw ] && $rc_firewall_drakgw
-");
- chmod 0700, $rc_firewall_generic;
-}
-elsif (!grep(/drakgw/, cat_($rc_firewall_generic))) {
- outpend($rc_firewall_generic, "
-# Automatically added by drakgw
-[ -x $rc_firewall_drakgw ] && $rc_firewall_drakgw
-
-");
-}
-
-output($rc_firewall_drakgw, q(#!/bin/sh
-KERNELMAJ=`uname -r | sed -e 's,\..*,,'`
-KERNELMIN=`uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,'`
-
-if [ "$KERNELMAJ" -eq 2 -a "$KERNELMIN" -eq 4 ]; then
- [ -x ) . $rc_firewall_24 . ' ] && ' . $rc_firewall_24 . q(
-fi
- ));
-
-chmod 0700, $rc_firewall_drakgw;
-
-
-output($rc_firewall_24, qq(#!/bin/sh
-# Load the NAT module (this pulls in all the others).
-modprobe iptable_nat
-
-# Turn on IP forwarding
-echo 1 > /proc/sys/net/ipv4/ip_forward
-
-# In the NAT table (-t nat), Append a rule (-A) after routing (POSTROUTING)
-# which says to MASQUERADE the connection (-j MASQUERADE).
-/sbin/iptables -t nat -A POSTROUTING -s $lan_address.0/24 -j MASQUERADE
-
-# Allows forwarding specifically to our LAN
-/sbin/iptables -A FORWARD -s $lan_address.0/24 -j ACCEPT
-
-# Allow dhcp requests
-/sbin/iptables -A INPUT -i $device -p udp --sport bootpc --dport bootps -j ACCEPT
-/sbin/iptables -A INPUT -i $device -p tcp --sport bootpc --dport bootps -j ACCEPT
-/sbin/iptables -A INPUT -i $device -p udp --sport bootps --dport bootpc -j ACCEPT
-/sbin/iptables -A INPUT -i $device -p tcp --sport bootps --dport bootpc -j ACCEPT
-
-# Allow dns requests
-/sbin/iptables -A INPUT -i $device -p udp --dport domain -j ACCEPT
-/sbin/iptables -A INPUT -i $device -p tcp --dport domain -j ACCEPT
-));
-chmod 0700, $rc_firewall_24;
-
-
-#- be sure that FORWARD_IPV4 is enabled in /etc/sysconfig/network
-
-substInFile { s/^FORWARD_IPV4.*\n//; $_ .= "FORWARD_IPV4=true\n" if eof } $sysconf_network;
-
-
-#- setup the DHCP server
-
-if ($reconf_dhcp_server_intf) {
- standalone::explanations("Configuring a DHCP server on $lan_address.0");
- renamef($dhcpd_conf, "$dhcpd_conf.old");
- output($dhcpd_conf, qq(subnet $lan_address.0 netmask 255.255.255.0 {
- # default gateway
- option routers $server_ip;
- option subnet-mask 255.255.255.0;
-
- option domain-name "homelan.org";
- option domain-name-servers $server_ip;
-
- range dynamic-bootp $lan_address.16 $lan_address.253;
- default-lease-time 21600;
- max-lease-time 43200;
-}
-));
-}
-
-my $update_dhcp = '/usr/sbin/update_dhcp.pl';
--e $update_dhcp and system($update_dhcp);
-
-
-#- put the interface for the dhcp server in the sysconfig-dhcp config, for the /etc/init.d script of dhcpd
-
-substInFile { s/^INTERFACES\n//; $_ .= "INTERFACES=\"$device\"\n" if eof } $sysconf_dhcpd;
-
-
-#- Set up /etc/cups/cupsd.conf to make the broadcasting of the printer info
-#- working correctly:
-#-
-#- 1. ServerName <server's IP address> # because clients do necessarily
-#- # know the server's name
-#-
-#- 2. BrowseAddress <server's Broadcast IP> # broadcast printer info into
-#- # the local network.
-#-
-#- 3. BrowseOrder Deny,Allow
-#- BrowseDeny All
-#- BrowseAllow <IP mask for local net> # Only accept broadcast signals
-#- # coming from local network
-#-
-#- 4. <Location />
-#- Order Deny,Allow
-#- Deny From All
-#- Allow From <IP mask for local net> # Allow only machines of local
-#- </Location> # network to access the server
-#-
-#- These steps are only done when the CUPS package is installed.
-
-#- Modify the root location block in /etc/cups/cupsd.conf
-
-if (-f $cups_conf) {
- standalone::explanations("Updating CUPS configuration accordingly");
-
- substInFile {
- s/^ServerName[^:].*\n//; $_ .= "ServerName $server_ip\n" if eof;
- s/^BrowseAddress.*\n//; $_ .= "BrowseAddress $lan_address.255\n" if eof;
- s/^BrowseOrder.*\n//; $_ .= "BrowseOrder Deny,Allow\n" if eof;
- s/^BrowseDeny.*\n//; $_ .= "BrowseDeny All\n" if eof;
- s/^BrowseAllow.*\n//; $_ .= "BrowseAllow $lan_address.*\n" if eof;
- } $cups_conf;
-
- my @cups_conf_content = cat_($cups_conf);
- my @root_location; my $root_location_start; my $root_location_end;
-
- # Cut out the root location block so that it can be treated seperately
- # without affecting the rest of the file
- if (grep(m|^\s*<Location\s+/\s*>|, @cups_conf_content)) {
- $root_location_start = -1;
- $root_location_end = -1;
- # Go through all the lines, bail out when start and end line found
- for (my $i = 0; $i < @cups_conf_content && $root_location_end == -1; $i++) {
- if ($cups_conf_content[$i] =~ m|^\s*<\s*Location\s+/\s*>|) {
- $root_location_start = $i;
- } elsif (($cups_conf_content[$i] =~ m|^\s*<\s*/Location\s*>|) && ($root_location_start != -1)) {
- $root_location_end = $i;
- }
- }
- # Rip out the block and store it seperately
- @root_location = splice(@cups_conf_content, $root_location_start, $root_location_end - $root_location_start + 1);
- } else {
- # If there is no root location block, create one
- $root_location_start = @cups_conf_content;
- @root_location = ("<Location />\n", "</Location>\n");
- }
-
- # Delete all former "Order", "Allow", and "Deny" lines from the root location block
- s/^\s*Order.*//, s/^\s*Allow.*//, s/^\s*Deny.*// foreach @root_location;
-
- # Add the new "Order" and "Deny" lines, add an "Allow" line for the local network
- splice(@root_location, -1, 0, $_) foreach ("Order Deny,Allow\n", "Deny From All\n", "Allow From 127.0.0.1\n",
- "Allow From $lan_address.*\n");
-
- # Put the changed root location block back into the file
- splice(@cups_conf_content, $root_location_start, 0, @root_location);
-
- output $cups_conf, @cups_conf_content;
-}
-
-
-#- start the daemons
-
-substInFile { s/^INTERFACE.*\n//; $_ .= "INTERFACE=$device\n" if eof } $drakgw_setup;
-start_daemons();
-
-
-#- bye-bye message
-
-undef $wait_configuring;
-
-$::Wizard_no_previous = 1;
-$::Wizard_finished = 1;
-
-$in->ask_okcancel(_("Congratulations!"),
-_("Everything has been configured.
-You may now share Internet connection with other computers on your Local Area Network, using automatic network configuration (DHCP)."));
-
-
-log::l("[drakgw] Installation complete, exiting");
-quit_global($in, 0);
-
-sub quit_global {
- my ($in, $exitcode) = @_;
- $in->exit($exitcode);
- goto begin
-}
-
-sub pur_gtk_mode
-{
- require Gtk;
- init Gtk;
- my $setup_state = grep(/disabled/, cat_($drakgw_setup)) ? _("The setup has already been done, but it's currently disabled.") :
- grep(/enabled/, cat_($drakgw_setup)) ? _("The setup has already been done, and it's currently enabled.") :
- _("No Internet Connection Sharing has ever been configured.");
-
- my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
- $window1->signal_connect ( delete_event => sub { Gtk->exit(0); });
- $window1->set_position(1);
- $window1->set_title(_("Internet connection sharing configuration"));
- $window1->border_width(10);
- my $vbox1 = new Gtk::VBox(0,0);
- $window1->add($vbox1);
- my $hbox1 = new Gtk::HBox(0,0);
- $vbox1->pack_start($hbox1,1,1,0);
- my $label1 = new Gtk::Label(
-_("Welcome to the Internet Connection Sharing utility!
-
-%s
-
-Click on Configure to launch the setup wizard.", $setup_state));
- $hbox1->pack_start($label1,1,1,0);
- my $hbox2 = new Gtk::HBox(0,0);
- $vbox1->pack_start($hbox2,1,1,0);
-
- my $bbox1 = new Gtk::HButtonBox;
- $vbox1->pack_start($bbox1,0,0,0);
- $bbox1->set_layout(-end);
- my $button_conf = new Gtk::Button _("Configure");
- $button_conf->signal_connect ( clicked => sub {
- system("/usr/sbin/drakgw --wizard");
- kill(USR1, $::CCPID);
- });
- $bbox1->add($button_conf);
- my $button_cancel = new Gtk::Button _("Cancel");
- $button_cancel->signal_connect ( clicked => sub {
- kill(USR1, $::CCPID);
- });
- $bbox1->add($button_cancel);
- $window1->show_all();
- Gtk->main_iteration while Gtk->events_pending;
- $::isEmbedded and kill USR2, $::CCPID;
- Gtk->main;
- Gtk->exit(0);
-
-}
-
-
-#-------------------------------------------------
-#- $Log$
-#- Revision 1.62 2002/07/23 10:35:55 tvignaud
-#- - Big Move 1: interactive::* hierarchy
-#-
-#- Revision 1.61 2002/04/09 08:50:36 gc
-#- time to remove ipchains/2.2 stuff since now ipchains and iptables
-#- packages conflict
-#-
-#- Revision 1.60 2002/03/07 13:10:06 gc
-#- - call net_monitor to disable internet
-#- connection before network-restart
-#- - user return value when status'ing the
-#- initscripts rather than grepping their
-#- text output
-#-
-#- Revision 1.59 2002/02/22 18:58:22 gc
-#- exit the pur_gtk version after launching the wizard version
-#-
-#- Revision 1.58 2002/01/18 20:19:44 gc
-#- - move 'use standalone' up to comply to 'explanations'
-#- - write higher-level 'explanations'
-#- - small fix, s/`ls ..`/glob(..)/
-#-
-#- Revision 1.57 2001/12/17 17:58:20 gc
-#- drakgw for gold
-#-
-#- Revision 1.56 2001/10/30 19:10:41 gc
-#- use isa rather than ref to test if we're gtk
-#-
-#- Revision 1.55 2001/10/02 10:28:14 gc
-#- don't call pkgs_install when no package needs to be installed
-#-
-#- Revision 1.54 2001/09/18 20:36:20 damien
-#- debug
-#-
-#- Revision 1.53 2001/09/12 10:57:01 damien
-#- corrected wizard mode in newt mode
-#-
-#- Revision 1.52 2001/09/06 15:38:09 gc
-#- works now ;p
-#-
-#- Revision 1.51 2001/08/29 21:52:34 gc
-#- quit_global
-#-
-#- Revision 1.50 2001/08/18 00:06:32 siegel
-#- fixed i18n
-#-
-#- Revision 1.49 2001/08/09 09:35:37 gc
-#- use vnew the right way everywhere
-#-
-#- Revision 1.48 2001/08/09 09:15:38 gc
-#- - if package installs fail, redo one by one to know which one failed
-#- - try to not end up with a failing configuration file, if program is brutally stopped
-#- - if unrecognized config file, don't fail, rather ignore it and proceed
-#- - run dhcpd_update feature (if present) after setup of dhcp server
-#-
-#- Revision 1.47 2001/08/08 18:26:31 prigaux
-#- add interactive_pkgs stuff
-#-
-#- Revision 1.46 2001/08/06 13:11:35 yduret
-#- use MDK::Common;
-#- use network::netconnect; and update functions call from netconnect
-#-
-#- Revision 1.45 2001/07/24 22:39:28 prigaux
-#- move to MDK::Common, bool->to_bool
-#-
-#- Revision 1.44 2001/05/16 11:13:21 damien
-#- added icon management
-#-
-#- Revision 1.43 2001/05/15 14:36:31 gc
-#- full path for iptables
-#-
-#- Revision 1.42 2001/04/12 13:50:24 gc
-#- add some rule so later on tinyfirewall will not prevent everything from working
-#-
-#- Revision 1.41 2001/04/11 15:28:36 gc
-#- kosmetik
-#-
-#- Revision 1.40 2001/04/11 15:16:34 gc
-#- do i18n for title also
-#-
-#- Revision 1.39 2001/04/10 21:33:15 gc
-#- add INTERFACE param in sysconfig parameter for smooth interoperation with bastille-firewall
-#-
-#- Revision 1.38 2001/04/09 18:09:38 yduret
-#- deyvounification : remove some un-useful comments in code
-#-
-#- Revision 1.37 2001/04/09 16:29:20 gc
-#- do not die when an initscript returns non-0 (initscripts too buggy)
-#-
-#- Revision 1.36 2001/04/09 11:39:40 gc
-#- fix for when there is an already existing rc.firewall
-#- complies with old format of drakgw so that upgrades will work
-#-
-#- Revision 1.35 2001/04/08 05:33:14 damien
-#- updated
-#-
-#- Revision 1.34 2001/04/06 15:09:15 yduret
-#- swap cancel/configure button
-#-
-#- Revision 1.33 2001/04/06 14:12:06 gc
-#- - correct yvounetification in i18n stuff
-#- - remove some remaining debugging printings
-#- - add a bit more of explanations when starting drakgw in wizard mode
-#-
-#- Revision 1.32 2001/04/06 01:34:44 yduret
-#- recoded a embedded && gtk mode
-#-
-#- Revision 1.31 2001/03/31 14:21:10 pablo
-#- Updated po files and help messages (patch from Pixel)
-#-
-#- Revision 1.30 2001/03/29 11:52:15 damien
-#- updated for new wiz png policy
-#-
-#- Revision 1.29 2001/03/26 15:29:01 gc
-#- first attempt at pixelization of code (till's cups patches)
-#-
-#- Revision 1.28 2001/03/21 18:07:36 gc
-#- honour embedded mode
-#-
-#- Revision 1.27 2001/03/13 16:23:29 gc
-#- fix for bind
-#-
-#- Revision 1.26 2001/03/13 15:31:05 gc
-#- - fix destructive parts of pixelization
-#- - fix some own bugs
-#-
-#- Revision 1.25 2001/03/13 00:00:11 prigaux
-#- pixelization
-#-
-#- Revision 1.24 2001/03/12 18:26:16 gc
-#- - make it work as a wizard
-#- - make it work with iptables (kernel-2.4)
-#-
-#- Revision 1.23 2001/03/01 00:18:17 damien
-#- updated embedded mode
-#-
-#- Revision 1.22 2001/02/26 18:39:12 prigaux
-#- pixelization
-#-
-#- Revision 1.21 2001/02/08 10:11:37 damien
-#- implemented or updated embedded mode
-#-
-#- Revision 1.20 2001/02/08 07:00:41 damien
-#- added embedded and (ugly) wizard mode.
-#-
-#- Revision 1.19 2001/01/10 00:32:42 prigaux
-#- use standalone and standalone::pkgs_install
-#-
-#- Revision 1.18 2000/12/16 16:13:34 prigaux
-#- use ldetect-lst
-#-
-#- Revision 1.17 2000/11/13 15:48:33 gc
-#- Integrate Till's patches for better work with Cups.
-#-
-#- Revision 1.16 2000/10/10 15:31:50 gc
-#- make only one call to urpmi in order to install all the needed rpm's
-#-
diff --git a/perl-install/standalone/drakproxy b/perl-install/standalone/drakproxy
deleted file mode 100755
index 07f624bbe..000000000
--- a/perl-install/standalone/drakproxy
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/perl
-
-# DrakNet
-
-# Copyright (C) 1999 MandrakeSoft (damien@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-use interactive;
-use network::network;
-
-$::o->{miscellaneous} ||= {};
-$::o->{miscellaneous} = { getVarsFromSh('/etc/profile.d/proxy.sh') };
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-my $in = 'interactive'->vnew('su', 'network');
-network::network::miscellaneousNetwork($in, 1, 1);
-any::miscellaneousNetwork('');
-$in->exit(0);
-
diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec
deleted file mode 100755
index 6af60a0b1..000000000
--- a/perl-install/standalone/draksec
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use common;
-use interactive;
-use log;
-use security::msec;
-
-local $_ = join '', @ARGV;
-
-
-/-h/ and die "usage: draksec [--expert]\n";
-
-$::expert = /-expert/ || cat_("/etc/sysconfig/system") =~ /^CLASS="?expert/m; #"
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-
-my $in = 'interactive'->vnew('su', 'security');
-
-begin:
-$::isEmbedded and kill USR2, $::CCPID;
-
-my $security = security::msec::get_secure_level('');
-my $libsafe = security::msec::config_libsafe('');
-my $sec_user = security::msec::config_security_user('');
-my $w;
-
-security::main($in, $security, $sec_user);
-
-!$::isEmbedded ? $in->exit(0) : kill(USR1, $::CCPID);
-goto begin;
diff --git a/perl-install/standalone/drakxservices b/perl-install/standalone/drakxservices
deleted file mode 100755
index f5249475b..000000000
--- a/perl-install/standalone/drakxservices
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use common;
-use interactive;
-use services;
-use log;
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: drakxservices\n";
-
-
-my $in = 'interactive'->vnew('su', 'services');
-begin:
-my $l = services::ask($in);
-services::doit($in, $l) if $l;
-!$::isEmbedded and $in->exit(0);
-kill USR1, $::CCPID;
-goto begin;
diff --git a/perl-install/standalone/drakxtv b/perl-install/standalone/drakxtv
deleted file mode 100755
index 7250ab5f8..000000000
--- a/perl-install/standalone/drakxtv
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/usr/bin/perl -w
-# DrakxTV
-# $Id$
-
-# Copyright (C) 2002 MandrakeSoft (tvignaud@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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.
-
-# If we ever want to autoconf the tv card at install time, we should
-# make a package out of this.
-# Maybe we'll have to for harddrake2
-#
-#package tvdrake;
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use strict;
-use detect_devices;
-use lang;
-use log;
-use common;
-
-("@ARGV" =~ /--help|-h/) and die "usage: drakxtv [-h] [--help] [--no-guess]\n";
-
-#$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-my $in = 'interactive'->vnew();
-
-sub scan4channels {
-# xawtv has been installed by DrakX when/if it's detected a
-# tv card.
-# In the future, we might try to install xawtv if it'sn't there
-# as we're just a, xawtv wraper
-# -x "/usr/bin/scantv" or $in->do_pkgs->install('xawtv');
-# -x "/usr/bin/scantv" or {
-#{ exec {'consolehelper'} $0, ("urpmi", "xawtv") or die _("consolehelper missing");
-# };
- if (! -x "/usr/bin/scantv") {
-# standalone::explanations("package xawtv isn't installed");
- $in->ask_warn("XawTV isn't installed!",
- formatAlaTeX(_("XawTV isn't installed!
-
-
-If you do have a TV card but DrakX has neither detected it (no bttv
-module in \"/etc/modules\") nor installed xawtv, please send the
-results of \"lspcidrake -v -f\" to \"install\@mandrakesoft.com\"
-with subject \"undetected TV card\".
-
-
-You can install it by typing \"urpmi xawtv\" as root, in a console.")));
-
- } else {
- my ($ftable_id, $norm);
-
-# my %freqtables = map {$i=$_;$i =~ s/ (.*)/-\1/;_($_) => $i} (...)
-# this table must be checked on each xawtv release :
- my %freqtables =
- ("us-bcast" => _("USA (broadcast)"), "us-cable" => _("USA (cable)"), "us-cable-hrc" => _("USA (cable-hrc)"), "canada-cable" => _("Canada (cable)"),
- "japan-bcast" => _("Japan (broadcast)"), "japan-cable" => _("Japan (cable)"), "china-bcast" => _("China (broadcast)"),
- "europe-west" => _("West Europe"), "europe-east" => _("East Europe"), "italy" => _("Italy"), "ireland" => _("Ireland"), "france" => _("France [SECAM]"),
- "newzealand" => _("Newzealand"), "australia" => _("Australia"),
- "southafrica" => _("South Africa"),
- "argentina" => _("Argentina"),
- -1 =>_("All")
- );
-# Info: HRC means "Harmonically Related Carrier"
-
- # default to pal since most people use that
- $norm = "PAL";
- if("@ARGV" !~ /--help|-h/) {
- my %countries =
- (
- "ar" => [ "argentina" ],
- "au" => [ "australia" ],
- "(br|fr)" => ["france", "SECAM"],
- "ca" => [ "canada-cable" ],
- "(ga|ie)" => [ "ireland" ],
- "it" => [ "italy" ],
- "jp" => [ "japan-bcast", "NTSC-JP"],
- "nz" => [ "newzealand" ],
- "(at|be|ch|de|eu|gb|se)" => [ "europe-west" ],
- "us" => [ "us-bcast", "NTSC" ],
- "za" => [ "southafrica" ],
- "(zh|TW|Big5|CN.GB2312|CN)" => [ "china-bcast" ]
- );
-
- ($_) = lang::read('', $>);
- foreach my $i (keys %countries) {
- if (/($i|$i.UTF-8)$/i) {
- my $tbl = $countries{$i};
- $ftable_id = $tbl->[0];
- $norm = $tbl->[1] if ($tbl->[1]);
- }
- }
- log::l("[drakxtv] guess lang=>$_, norm=>$norm, area=>$ftable_id");
- }
-
- if ($in->ask_from("TVdrake", _("Please,\ntype in your tv norm and country"),
- [
- { label => _("TV norm :"), val => \$norm, list => ["NTSC", "NTSC-JP","PAL", "PAL-M", "PAL-N", "PAL-NC", "SECAM"], type => 'combo'},
- { label => _("Area :"), val => \$ftable_id, list => [keys %freqtables], format => sub { $freqtables{$_[0]} }, sort => 1},
- ]
- ))
- { my $wait = $in->wait_message(_('Please wait'),
- _("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);
- # Note that this'll be broken if/when we implement interactive::qt
- my $use_X =$in->isa('interactive::gtk') && -x "/usr/X11R6/bin/xvt";
- my $home = $ENV{HOME};
- my $i=system ( (($use_X ) ?
- "xvt -T '"._("Scanning for TV channels")." ...' -e ":"")
- . "scantv -n $norm -f $ftable_id -o $home/.xawtv".(($use_X )?"":" &>$home/tmp/scantv.log;"));
- if ($i) {
- $in->ask_warn(_("There was an error while scanning for TV channels"),
- _("XawTV isn't installed!")); }
- else {
- standalone::explanations("created file $home/.xawtv");
- $in->ask_warn(_("Have a nice day!"),
- _("Now, you can run xawtv (under X Window!) !\n")) if (! $use_X);
- };
-
- };
- }
-}
-
-my @devices = detect_devices::probeall(1);
-if (grep { $_->{media_type} eq 'MULTIMEDIA_VIDEO' } @devices) {
- if (($< == 0) && (grep { $_->{driver} eq 'bttv' } @devices)) {
- use harddrake::bttv;
- harddrake::bttv::config($in);
- }
- scan4channels();
- $in->exit(0);
-} else {
- $in->ask_warn(_("No TV Card detected!"), formatAlaTeX(
- _("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:
-
-
-http://www.linux-mandrake.com/en/hardware.php3")));
-}
-
-
-# TODO :
-# - offer to sort channels after
-# - use Video-Capture-V4l-0.221 ?
-# - configure kwintv and zapping ? => they've already wizards :-(
-# - install xawtv if needed through consolhelper
diff --git a/perl-install/standalone/fileshareset b/perl-install/standalone/fileshareset
deleted file mode 100755
index f5390a382..000000000
--- a/perl-install/standalone/fileshareset
+++ /dev/null
@@ -1,389 +0,0 @@
-#!/usr/bin/perl -T
-use strict;
-
-########################################
-# config files
-$nfs_exports::default_options = '*(ro,all_squash)';
-$nfs_exports::conf_file = '/etc/exports';
-$smb_exports::conf_file = '/etc/samba/smb.conf';
-my $authorisation_file = '/etc/security/fileshare.conf';
-my $authorisation_group = 'fileshare';
-
-
-########################################
-# fileshare utility $Id$
-# Copyright (C) 2001-2002 MandrakeSoft (pixel@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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.
-
-
-########################################
-my $uid = $<;
-my $username = getpwuid($uid);
-
-########################################
-# errors
-my $usage =
-"usage: fileshareset --add <dir>
- fileshareset --remove <dir>";
-my $non_authorised =
-qq(You are not authorised to use fileshare'ing
-To grant you the rights:
-- put "RESTRICT=no" in $authorisation_file
-- or put user "$username" in group "$authorisation_group");
-my $no_export_method = "can't export anything: no nfs, no smb";
-
-my %exit_codes = reverse (
- 1 => $non_authorised,
- 2 => $usage,
-
-# when adding
- 3 => "already exported",
- 4 => "invalid mount point",
-
-# when removing
- 5 => "not exported",
-
- 6 => $no_export_method,
-
- 255 => "various",
-);
-
-################################################################################
-# correct PATH needed to call /etc/init.d/... ? seems not, but...
-%ENV = ();#(PATH => '/bin:/sbin:/usr/bin:/usr/sbin');
-
-my $modify = $0 =~ /fileshareset/;
-
-authorisation::check($modify);
-
-my @exports = (
- -e $nfs_exports::conf_file ? nfs_exports::read() : (),
- -e $smb_exports::conf_file ? smb_exports::read() : (),
- );
-@exports or error($no_export_method);
-
-if ($modify) {
- my ($cmd, $dir) = @ARGV;
- $< = $>;
- @ARGV == 2 && ($cmd eq '--add' || $cmd eq '--remove') or error($usage);
-
- verify_mntpoint($dir);
-
- if ($cmd eq '--add') {
- my @errs = map { eval { $_->add($dir) }; $@ } @exports;
- grep { !$_ } @errs or error("already exported");
- } else {
- my @errs = map { eval { $_->remove($dir) }; $@ } @exports;
- grep { !$_ } @errs or error("not exported");
- }
- foreach my $export (@exports) {
- $export->write;
- $export->update_server;
- }
-}
-my @mntpoints = grep {$_} uniq(map { map { $_->{mntpoint} } @$_ } @exports);
-print "$_\n" foreach grep { own($_) } @mntpoints;
-
-
-sub own { $uid == 0 || (stat($_[0]))[4] == $uid }
-
-sub verify_mntpoint {
- local ($_) = @_;
- my $ok = 1;
- $ok &&= m|^/|;
- $ok &&= !m|/../|;
- $ok &&= !m|[\0\n\r]|;
- $ok &&= -d $_;
- $ok &&= own($_);
- $ok or error("invalid mount point");
-}
-
-sub error {
- my ($string) = @_;
- print STDERR "$string\n";
- exit($exit_codes{$string} || 255);
-}
-sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }
-sub uniq { my %l; $l{$_} = 1 foreach @_; grep { delete $l{$_} } @_ }
-
-
-################################################################################
-package authorisation;
-
-sub read_conf {
- my ($exclusive_lock) = @_;
- open F_lock, $authorisation_file; # don't care if it's missing
- flock(F_lock, $exclusive_lock ? 2 : 1) or die "can't lock";
- my %conf;
- foreach (<F_lock>) {
- s/#.*//; # remove comments
- s/^\s+//;
- s/\s+$//;
- /^$/ and next;
- my ($cmd, $value) = split('=', $_, 2);
- $conf{$cmd} = $value || warn qq(suspicious line "$_" in $authorisation_file\n);
- }
- # no close F_lock, keep it locked
- \%conf
-}
-
-sub check {
- my ($exclusive_lock) = @_;
- my $conf = read_conf($exclusive_lock);
-
- if (lc($conf->{RESTRICT}) eq 'no') {
- # ok, access granted for everybody
- } else {
- my @l;
- while (@l = getgrent) {
- last if $l[0] eq $authorisation_group;
- }
- ::member($username, split(' ', $l[3])) or ::error($non_authorised);
- }
-}
-
-################################################################################
-package exports;
-
-sub find {
- my ($exports, $mntpoint) = @_;
- foreach (@$exports) {
- $_->{mntpoint} eq $mntpoint and return $_;
- }
- undef;
-}
-
-sub add {
- my ($exports, $mntpoint) = @_;
- foreach (@$exports) {
- $_->{mntpoint} eq $mntpoint and die 'add';
- }
- push @$exports, my $e = { mntpoint => $mntpoint };
- $e;
-}
-
-sub remove {
- my ($exports, $mntpoint) = @_;
- my @l = grep { $_->{mntpoint} ne $mntpoint } @$exports;
- @l < @$exports or die 'remove';
- @$exports = @l;
-}
-
-
-################################################################################
-package nfs_exports;
-
-use vars qw(@ISA $conf_file $default_options);
-BEGIN { @ISA = 'exports' }
-
-sub read {
- my $file = $conf_file;
- local *F;
- open F, $file or return [];
-
- my ($prev_raw, $prev_line, %e, @l);
- my $line_nb = 0;
- foreach my $raw (<F>) {
- $line_nb++;
- local $_ = $raw;
- $raw .= "\n" if !/\n/;
-
- s/#.*//; # remove comments
-
- s/^\s+//;
- s/\s+$//; # remove unuseful spaces to help regexps
-
- if (/^$/) {
- # blank lines ignored
- $prev_raw .= $raw;
- next;
- }
-
- if (/\\$/) {
- # line continue across lines
- chop; # remove the backslash
- $prev_line .= "$_ ";
- $prev_raw .= $raw;
- next;
- }
- my $line = $prev_line . $_;
- my $raw_line = $prev_raw . $raw;
- ($prev_line, $prev_raw) = ('', '');
-
- my ($mntpoint, $options) = $line =~ /("[^"]*"|\S+)\s+(.*)/ or die "$file:$line_nb: bad line $line\n";
-
- # You can also specify spaces or any other unusual characters in the
- # export path name using a backslash followed by the character code as
- # 3 octal digits.
- $mntpoint =~ s/\\(\d{3})/chr(oct $1)/ge;
-
- # not accepting weird characters that would break the output
- $mntpoint =~ m/[\0\n\r]/ and die "i won't handle this";
- push @l, { mntpoint => $mntpoint, option => $options, raw => $raw_line };
- }
- bless \@l, 'nfs_exports';
-}
-
-sub write {
- my ($nfs_exports) = @_;
- foreach (@$nfs_exports) {
- if (!exists $_->{options}) {
- $_->{options} = $default_options;
- }
- if (!exists $_->{raw}) {
- my $mntpoint = $_->{mntpoint} =~ /\s/ ? qq("$_->{mntpoint}") : $_->{mntpoint};
- $_->{raw} = sprintf("%s %s\n", $mntpoint, $_->{options});
- }
- }
- local *F;
- open F, ">$conf_file" or die "can't write $conf_file";
- print F $_->{raw} foreach @$nfs_exports;
-}
-
-sub update_server {
- if (fork) {
- system('/usr/sbin/exportfs', '-r');
- if (system('/sbin/pidof rpc.mountd >/dev/null') != 0 ||
- system('/sbin/pidof nfsd >/dev/null') != 0) {
- # trying to start the server...
- system('/etc/init.d/portmap start') if system('/etc/init.d/portmap status') != 0;
- system('/etc/init.d/nfs', $_) foreach 'stop', 'start';
- }
- exit 0;
- }
-}
-
-################################################################################
-package smb_exports;
-
-use vars qw(@ISA $conf_file);
-BEGIN { @ISA = 'exports' }
-
-sub read {
- my ($s, @l);
- local *F;
- open F, $conf_file;
- local $_;
- while (<F>) {
- if (/^\s*\[.*\]/ || eof F) {
- #- first line in the category
- my ($label) = $s =~ /^\s*\[(.*)\]/;
- my ($mntpoint) = $s =~ /^\s*path\s*=\s*(.*)/m;
- push @l, { mntpoint => $mntpoint, raw => $s, label => $label };
- $s = '';
- }
- $s .= $_;
- }
- bless \@l, 'smb_exports';
-}
-
-sub write {
- my ($smb_exports) = @_;
- foreach (@$smb_exports) {
- if (!exists $_->{raw}) {
- $_->{raw} = <<EOF;
-
-[$_->{label}]
- path = $_->{mntpoint}
- comment = $_->{mntpoint}
- public = yes
- guest ok = yes
- writable = no
- wide links = no
-EOF
- }
- }
- local *F;
- open F, ">$conf_file" or die "can't write $conf_file";
- print F $_->{raw} foreach @$smb_exports;
-}
-
-sub add {
- my ($exports, $mntpoint) = @_;
- my $e = $exports->exports::add($mntpoint);
- $e->{label} = name_mangle($mntpoint, map { $_->{label} } @$exports);
-}
-
-sub name_mangle {
- my ($input, @others) = @_;
-
- local $_ = $input;
-
- # 1. first only keep legal characters. "/" is also kept for the moment
- tr|a-z|A-Z|;
- s|[^A-Z0-9#\-_!/]|_|g; # "$" is allowed except at the end, remove it in any case
-
- # 2. removing non-interesting parts
- s|^/||;
- s|^home/||;
- s|_*/_*|/|g;
- s|_+|_|g;
-
- # 3. if size is too small (!), make it bigger
- $_ .= "_" while length($_) < 3;
-
- # 4. if size is too big, shorten it
- while (length > 12) {
- my ($s) = m|.*?/(.*)|;
- if (length($s) > 8 && !grep { /\Q$s/ } @others) {
- # dropping leading directories when the resulting is still long and meaningful
- $_ = $s;
- next;
- }
- s|(.*)[0-9#\-_!/]|$1| and next;
-
- # inspired by "Christian Brolin" "Long names are doom" on comp.lang.functional
- s|(.+)[AEIOU]|$1| and next; # allButFirstVowels
- s|(.*)(.)\2|$1$2| and next; # adjacentDuplicates
-
- s|(.*).|$1|; # booh, :'-(
- }
-
- # 5. remove "/"s still there
- s|/|_|g;
-
- # 6. resolving conflicts
- my $l = join("|", map { quotemeta } @others);
- my $conflicts = qr|^($l)$|;
- if (/$conflicts/) {
- A: while (1) {
- for (my $nb = 1; length("$_$nb") <= 12; $nb++) {
- if ("$_$nb" !~ /$conflicts/) {
- $_ = "$_$nb";
- last A;
- }
- }
- $_ or die "can't find a unique name";
- # can't find a unique name, dropping the last letter
- s|(.*).|$1|;
- }
- }
-
- # 7. done
- $_;
-}
-
-sub update_server {
- if (fork) {
- system('/usr/bin/killall -HUP smbd 2>/dev/null');
- if (system('/sbin/pidof smbd >/dev/null') != 0 ||
- system('/sbin/pidof nmbd >/dev/null') != 0) {
- # trying to start the server...
- system('/etc/init.d/smb', $_) foreach 'stop', 'start';
- }
- exit 0;
- }
-}
diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2
deleted file mode 100755
index 89375e8fc..000000000
--- a/perl-install/standalone/harddrake2
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/perl -w
-
-use lib qw(/usr/lib/libDrakX);
-use harddrake::ui;
-
-harddrake::ui->run;
diff --git a/perl-install/standalone/icons/categ.png b/perl-install/standalone/icons/categ.png
deleted file mode 100644
index b466e0f43..000000000
--- a/perl-install/standalone/icons/categ.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/drakTS.620x57.png b/perl-install/standalone/icons/drakTS.620x57.png
deleted file mode 100644
index d4735df1d..000000000
--- a/perl-install/standalone/icons/drakTS.620x57.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/drakbackup.540x57.png b/perl-install/standalone/icons/drakbackup.540x57.png
deleted file mode 100644
index 5af42dfea..000000000
--- a/perl-install/standalone/icons/drakbackup.540x57.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/drakconnect_step.png b/perl-install/standalone/icons/drakconnect_step.png
deleted file mode 100644
index e2ddf46d7..000000000
--- a/perl-install/standalone/icons/drakconnect_step.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/drakfont.620x57.png b/perl-install/standalone/icons/drakfont.620x57.png
deleted file mode 100644
index 1eb7feb46..000000000
--- a/perl-install/standalone/icons/drakfont.620x57.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/eth_card_mini2.png b/perl-install/standalone/icons/eth_card_mini2.png
deleted file mode 100644
index 6efbe637c..000000000
--- a/perl-install/standalone/icons/eth_card_mini2.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/fileopen.xpm b/perl-install/standalone/icons/fileopen.xpm
deleted file mode 100644
index 74049e224..000000000
--- a/perl-install/standalone/icons/fileopen.xpm
+++ /dev/null
@@ -1,34 +0,0 @@
-/* XPM */
-/* Drawn by Mark Donohoe for the K Desktop Environment */
-/* See http://www.kde.org */
-static char*fileopen[]={
-"22 22 6 1",
-"# c #000000",
-"d c #808080",
-"c c #c0c0c0",
-"b c #ffffff",
-"a c #dcdcdc",
-". c None",
-"......................",
-"......................",
-"............####......",
-"...............##.#...",
-"................###...",
-"................###...",
-"...............####...",
-"....####..............",
-"....#aba#######.......",
-"....#babababab#.......",
-"....#aa##########.....",
-"....#ba#aacccccd#.....",
-"....#a#aacacccd#......",
-"....#a#aacccdcd#......",
-"....##aacacccd#.......",
-"....##aacccdcd#.......",
-"....#dddddddd#........",
-"....##########........",
-"......................",
-"......................",
-"......................",
-"......................"};
-
diff --git a/perl-install/standalone/icons/find.xpm b/perl-install/standalone/icons/find.xpm
deleted file mode 100644
index 3145ca7fe..000000000
--- a/perl-install/standalone/icons/find.xpm
+++ /dev/null
@@ -1,34 +0,0 @@
-/* XPM */
-/* Drawn by Mark Donohoe for the K Desktop Environment */
-/* See http://www.kde.org */
-static char*find[]={
-"22 22 6 1",
-"# c #000000",
-"c c #ffffff",
-"b c #dcdcdc",
-"a c #a0a0a4",
-"d c #dcdcdc",
-". c None",
-"......................",
-"......................",
-"......................",
-".......####...........",
-".....a#bccd#a.........",
-".....#ccaacc#a........",
-"....#dcaccccd#........",
-"....#cccccccc#........",
-"....#cccccccc#........",
-"....#dccccccd#........",
-"....a#cccccc#a........",
-".....a#dccd###........",
-"......a####a###.......",
-".......aaaaaa###......",
-"............aa###.....",
-".............aa###....",
-"..............aa###...",
-"...............aa#a...",
-"................aa....",
-"......................",
-"......................",
-"......................"};
-
diff --git a/perl-install/standalone/icons/findf.xpm b/perl-install/standalone/icons/findf.xpm
deleted file mode 100644
index 792007335..000000000
--- a/perl-install/standalone/icons/findf.xpm
+++ /dev/null
@@ -1,31 +0,0 @@
-/* XPM */
-static char * findf_xpm[] = {
-"16 22 6 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #0000FF",
-"# c #BEBEFF",
-"$ c #C0C0C0",
-" ",
-" ",
-" ",
-" ........... ",
-".+++++++++++. ",
-".++++++++@#+. ",
-".+++++++++@+. ",
-".++++$...$++. ",
-".+++$.+++.$+. ",
-".+++.+#+#+.+. ",
-".+++.+@@++.+. ",
-".+++.++@#+.+. ",
-".+++$.+++..+. ",
-".@#++$....+.. ",
-".+@+++++++.+. ",
-".++++++++++.+. ",
-".++@#+++++++.+. ",
-" ........... .+.",
-" . ",
-" ",
-" ",
-" "};
diff --git a/perl-install/standalone/icons/ftin.xpm b/perl-install/standalone/icons/ftin.xpm
deleted file mode 100644
index d0326d3ce..000000000
--- a/perl-install/standalone/icons/ftin.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-static char * ftin_xpm[] = {
-"15 22 5 1",
-" c None",
-". c #CD0000",
-"+ c #FFFFFF",
-"@ c #C0C0C0",
-"# c #808080",
-" ",
-" ",
-" ",
-" ",
-" ",
-" . . ",
-" ... ",
-" ...++++++++",
-" ...@@@@@@++",
-" .......+++++#",
-" .....@@@++#+",
-" ++...+++++#+#",
-" +@@@.@@@++#+#+",
-"++++++++++#+#+ ",
-"##########+#+ ",
-"++++++++++#+ ",
-"##########+ ",
-"++++++++++ ",
-" ",
-" ",
-" ",
-" "};
diff --git a/perl-install/standalone/icons/ftout.xpm b/perl-install/standalone/icons/ftout.xpm
deleted file mode 100644
index b4e0135b8..000000000
--- a/perl-install/standalone/icons/ftout.xpm
+++ /dev/null
@@ -1,30 +0,0 @@
-/* XPM */
-static char * ftout_xpm[] = {
-"15 22 5 1",
-" c None",
-". c #00008B",
-"+ c #FFFFFF",
-"@ c #C0C0C0",
-"# c #808080",
-" ",
-" ",
-" ",
-" ",
-" ",
-" . ",
-" ... ",
-" .....+++++++",
-" .......@@@@++",
-" ...+++++++#",
-" +...@@@@++#+",
-" ++...+++++#+#",
-" +@@.+.@@++#+#+",
-"++++++++++#+#+ ",
-"##########+#+ ",
-"++++++++++#+ ",
-"##########+ ",
-"++++++++++ ",
-" ",
-" ",
-" ",
-" "};
diff --git a/perl-install/standalone/icons/gmon.png b/perl-install/standalone/icons/gmon.png
deleted file mode 100644
index 182adca81..000000000
--- a/perl-install/standalone/icons/gmon.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/cd.png b/perl-install/standalone/icons/harddrake2/cd.png
deleted file mode 100644
index 08180b54f..000000000
--- a/perl-install/standalone/icons/harddrake2/cd.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/cpu.png b/perl-install/standalone/icons/harddrake2/cpu.png
deleted file mode 100644
index 89d800c45..000000000
--- a/perl-install/standalone/icons/harddrake2/cpu.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/floppy.png b/perl-install/standalone/icons/harddrake2/floppy.png
deleted file mode 100644
index ca9f8bae9..000000000
--- a/perl-install/standalone/icons/harddrake2/floppy.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/harddisk.png b/perl-install/standalone/icons/harddrake2/harddisk.png
deleted file mode 100644
index 6a70153fe..000000000
--- a/perl-install/standalone/icons/harddrake2/harddisk.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/harddrake.png b/perl-install/standalone/icons/harddrake2/harddrake.png
deleted file mode 100644
index d2a64591e..000000000
--- a/perl-install/standalone/icons/harddrake2/harddrake.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/hw_mouse.png b/perl-install/standalone/icons/harddrake2/hw_mouse.png
deleted file mode 100644
index 239363e00..000000000
--- a/perl-install/standalone/icons/harddrake2/hw_mouse.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/hw_network.png b/perl-install/standalone/icons/harddrake2/hw_network.png
deleted file mode 100644
index 12ea7cff9..000000000
--- a/perl-install/standalone/icons/harddrake2/hw_network.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/hw_printer.png b/perl-install/standalone/icons/harddrake2/hw_printer.png
deleted file mode 100644
index ea0377005..000000000
--- a/perl-install/standalone/icons/harddrake2/hw_printer.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/ide_hd.png b/perl-install/standalone/icons/harddrake2/ide_hd.png
deleted file mode 100644
index 8ecac9aa4..000000000
--- a/perl-install/standalone/icons/harddrake2/ide_hd.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/isdn.png b/perl-install/standalone/icons/harddrake2/isdn.png
deleted file mode 100644
index e7c153d10..000000000
--- a/perl-install/standalone/icons/harddrake2/isdn.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/joystick.png b/perl-install/standalone/icons/harddrake2/joystick.png
deleted file mode 100644
index 6a025f4b5..000000000
--- a/perl-install/standalone/icons/harddrake2/joystick.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/keyboard.png b/perl-install/standalone/icons/harddrake2/keyboard.png
deleted file mode 100644
index 1acf4a75c..000000000
--- a/perl-install/standalone/icons/harddrake2/keyboard.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/memory.png b/perl-install/standalone/icons/harddrake2/memory.png
deleted file mode 100644
index 6159d0ab6..000000000
--- a/perl-install/standalone/icons/harddrake2/memory.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/modem.png b/perl-install/standalone/icons/harddrake2/modem.png
deleted file mode 100644
index d25c378ed..000000000
--- a/perl-install/standalone/icons/harddrake2/modem.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/scanner.png b/perl-install/standalone/icons/harddrake2/scanner.png
deleted file mode 100644
index d1c1e6eca..000000000
--- a/perl-install/standalone/icons/harddrake2/scanner.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/scsi.png b/perl-install/standalone/icons/harddrake2/scsi.png
deleted file mode 100644
index ad4690b6d..000000000
--- a/perl-install/standalone/icons/harddrake2/scsi.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/scsi_hd.png b/perl-install/standalone/icons/harddrake2/scsi_hd.png
deleted file mode 100644
index 51155d984..000000000
--- a/perl-install/standalone/icons/harddrake2/scsi_hd.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/sound.png b/perl-install/standalone/icons/harddrake2/sound.png
deleted file mode 100644
index faa893211..000000000
--- a/perl-install/standalone/icons/harddrake2/sound.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/tape.png b/perl-install/standalone/icons/harddrake2/tape.png
deleted file mode 100644
index 9b95fdb3b..000000000
--- a/perl-install/standalone/icons/harddrake2/tape.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/tv.png b/perl-install/standalone/icons/harddrake2/tv.png
deleted file mode 100644
index 4cfe5f869..000000000
--- a/perl-install/standalone/icons/harddrake2/tv.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/unknown.png b/perl-install/standalone/icons/harddrake2/unknown.png
deleted file mode 100644
index d30cdf167..000000000
--- a/perl-install/standalone/icons/harddrake2/unknown.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/usb.png b/perl-install/standalone/icons/harddrake2/usb.png
deleted file mode 100644
index 8538918f5..000000000
--- a/perl-install/standalone/icons/harddrake2/usb.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/video.png b/perl-install/standalone/icons/harddrake2/video.png
deleted file mode 100644
index 7ac95ca36..000000000
--- a/perl-install/standalone/icons/harddrake2/video.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/harddrake2/webcam.png b/perl-install/standalone/icons/harddrake2/webcam.png
deleted file mode 100644
index f5bbce103..000000000
--- a/perl-install/standalone/icons/harddrake2/webcam.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/hori.png b/perl-install/standalone/icons/hori.png
deleted file mode 100644
index 595805edf..000000000
--- a/perl-install/standalone/icons/hori.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic-drakfont-48.png b/perl-install/standalone/icons/ic-drakfont-48.png
deleted file mode 100644
index 07d8156e7..000000000
--- a/perl-install/standalone/icons/ic-drakfont-48.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-CD-40.png b/perl-install/standalone/icons/ic82-CD-40.png
deleted file mode 100644
index 16e9ded83..000000000
--- a/perl-install/standalone/icons/ic82-CD-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-back-up-16.png b/perl-install/standalone/icons/ic82-back-up-16.png
deleted file mode 100644
index fa2eff689..000000000
--- a/perl-install/standalone/icons/ic82-back-up-16.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-back-up-32.png b/perl-install/standalone/icons/ic82-back-up-32.png
deleted file mode 100644
index bfd292e0a..000000000
--- a/perl-install/standalone/icons/ic82-back-up-32.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-back-up-48.png b/perl-install/standalone/icons/ic82-back-up-48.png
deleted file mode 100644
index 3f4992134..000000000
--- a/perl-install/standalone/icons/ic82-back-up-48.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-discdurwhat-40.png b/perl-install/standalone/icons/ic82-discdurwhat-40.png
deleted file mode 100644
index 25817dabc..000000000
--- a/perl-install/standalone/icons/ic82-discdurwhat-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-dossier-32.png b/perl-install/standalone/icons/ic82-dossier-32.png
deleted file mode 100644
index 80198d443..000000000
--- a/perl-install/standalone/icons/ic82-dossier-32.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-moreoption-40.png b/perl-install/standalone/icons/ic82-moreoption-40.png
deleted file mode 100644
index bc9b10ac7..000000000
--- a/perl-install/standalone/icons/ic82-moreoption-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-network-40.png b/perl-install/standalone/icons/ic82-network-40.png
deleted file mode 100644
index cebb8bccd..000000000
--- a/perl-install/standalone/icons/ic82-network-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-others-40.png b/perl-install/standalone/icons/ic82-others-40.png
deleted file mode 100644
index 5ffc1e822..000000000
--- a/perl-install/standalone/icons/ic82-others-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-system-40.png b/perl-install/standalone/icons/ic82-system-40.png
deleted file mode 100644
index e92873674..000000000
--- a/perl-install/standalone/icons/ic82-system-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-systemeplus-40.png b/perl-install/standalone/icons/ic82-systemeplus-40.png
deleted file mode 100644
index a5699dff5..000000000
--- a/perl-install/standalone/icons/ic82-systemeplus-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-tape-40.png b/perl-install/standalone/icons/ic82-tape-40.png
deleted file mode 100644
index 5889f1074..000000000
--- a/perl-install/standalone/icons/ic82-tape-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-users-40.png b/perl-install/standalone/icons/ic82-users-40.png
deleted file mode 100644
index c87fa4135..000000000
--- a/perl-install/standalone/icons/ic82-users-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-when-40.png b/perl-install/standalone/icons/ic82-when-40.png
deleted file mode 100644
index ec5bf2bcf..000000000
--- a/perl-install/standalone/icons/ic82-when-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/ic82-where-40.png b/perl-install/standalone/icons/ic82-where-40.png
deleted file mode 100644
index 6a8125a9d..000000000
--- a/perl-install/standalone/icons/ic82-where-40.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/mdk_logo.png b/perl-install/standalone/icons/mdk_logo.png
deleted file mode 100644
index 960d079e3..000000000
--- a/perl-install/standalone/icons/mdk_logo.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/net_c.png b/perl-install/standalone/icons/net_c.png
deleted file mode 100644
index 5688f4be1..000000000
--- a/perl-install/standalone/icons/net_c.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/net_d.png b/perl-install/standalone/icons/net_d.png
deleted file mode 100644
index 1bfdd3ef2..000000000
--- a/perl-install/standalone/icons/net_d.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/net_u.png b/perl-install/standalone/icons/net_u.png
deleted file mode 100644
index 5c4a16079..000000000
--- a/perl-install/standalone/icons/net_u.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/reload.xpm b/perl-install/standalone/icons/reload.xpm
deleted file mode 100644
index 658cf36f0..000000000
--- a/perl-install/standalone/icons/reload.xpm
+++ /dev/null
@@ -1,31 +0,0 @@
-/* XPM */
-/* Drawn by Mark Donohoe for the K Desktop Environment */
-/* See http://www.kde.org */
-static char*reload[]={
-"22 22 3 1",
-"# c #808080",
-"a c #000000",
-". c None",
-"......................",
-"......................",
-"......................",
-"......................",
-"........##aaa#........",
-".......#aaaaaaa.......",
-"......#aa#....#a......",
-"......aa#.............",
-".....aaa.......a......",
-"...aaaaaaa....aaa.....",
-"....aaaaa....aaaaa....",
-".....aaa....aaaaaaa...",
-"......a.......aaa.....",
-".............#aa......",
-"......a#....#aa#......",
-".......aaaaaaa#.......",
-"........#aaa##........",
-"......................",
-"......................",
-"......................",
-"......................",
-"......................"};
-
diff --git a/perl-install/standalone/icons/smbnfs_default.png b/perl-install/standalone/icons/smbnfs_default.png
deleted file mode 100644
index 546f06227..000000000
--- a/perl-install/standalone/icons/smbnfs_default.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/smbnfs_has_mntpoint.png b/perl-install/standalone/icons/smbnfs_has_mntpoint.png
deleted file mode 100644
index cbbbc1ec2..000000000
--- a/perl-install/standalone/icons/smbnfs_has_mntpoint.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/smbnfs_mounted.png b/perl-install/standalone/icons/smbnfs_mounted.png
deleted file mode 100644
index 49f47ec4d..000000000
--- a/perl-install/standalone/icons/smbnfs_mounted.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/smbnfs_server.png b/perl-install/standalone/icons/smbnfs_server.png
deleted file mode 100644
index 92af7a316..000000000
--- a/perl-install/standalone/icons/smbnfs_server.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/tradi.png b/perl-install/standalone/icons/tradi.png
deleted file mode 100644
index a9b19f468..000000000
--- a/perl-install/standalone/icons/tradi.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/verti.png b/perl-install/standalone/icons/verti.png
deleted file mode 100644
index 6bc84225b..000000000
--- a/perl-install/standalone/icons/verti.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/wiz_default_left.png b/perl-install/standalone/icons/wiz_default_left.png
deleted file mode 100644
index 2300ab36e..000000000
--- a/perl-install/standalone/icons/wiz_default_left.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/wiz_default_up.png b/perl-install/standalone/icons/wiz_default_up.png
deleted file mode 100644
index 20f386d17..000000000
--- a/perl-install/standalone/icons/wiz_default_up.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/wiz_drakconnect.png b/perl-install/standalone/icons/wiz_drakconnect.png
deleted file mode 100644
index 20f386d17..000000000
--- a/perl-install/standalone/icons/wiz_drakconnect.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/wiz_drakgw.png b/perl-install/standalone/icons/wiz_drakgw.png
deleted file mode 100644
index aedff1dca..000000000
--- a/perl-install/standalone/icons/wiz_drakgw.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/wiz_firewall.png b/perl-install/standalone/icons/wiz_firewall.png
deleted file mode 100644
index 26923a00b..000000000
--- a/perl-install/standalone/icons/wiz_firewall.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/wiz_printerdrake.png b/perl-install/standalone/icons/wiz_printerdrake.png
deleted file mode 100644
index a49290702..000000000
--- a/perl-install/standalone/icons/wiz_printerdrake.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/icons/wiz_scannerdrake.png b/perl-install/standalone/icons/wiz_scannerdrake.png
deleted file mode 100644
index 297f0deca..000000000
--- a/perl-install/standalone/icons/wiz_scannerdrake.png
+++ /dev/null
Binary files differ
diff --git a/perl-install/standalone/interactive_http/Makefile b/perl-install/standalone/interactive_http/Makefile
deleted file mode 100644
index 5607112c9..000000000
--- a/perl-install/standalone/interactive_http/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-NAME=libDrakX
-FNAME=$(NAME)/drakxtools_http
-PREFIX=
-DATADIR=$(PREFIX)/usr/share
-
-all: index.html
-
-index.html: index.html.pl
- perl $^ > $@
-
-install:
- install -D miniserv.init $(PREFIX)/etc/init.d/drakxtools_http
- install -D -m 644 authorised_progs $(PREFIX)/etc/drakxtools_http/authorised_progs
- install -D -m 644 miniserv.conf $(PREFIX)/etc/drakxtools_http/conf
- install -D -m 644 miniserv.pam $(PREFIX)/etc/pam.d/miniserv
- install -D -m 644 miniserv.logrotate $(PREFIX)/etc/logrotate.d/drakxtools-http
-
- install -d $(DATADIR)/$(FNAME)/www
- install -m 644 miniserv.pl miniserv.pem miniserv.users $(DATADIR)/$(FNAME)
- install -m 644 index.html $(DATADIR)/$(FNAME)/www
- install interactive_http.cgi $(DATADIR)/$(FNAME)/www
diff --git a/perl-install/standalone/interactive_http/authorised_progs b/perl-install/standalone/interactive_http/authorised_progs
deleted file mode 100644
index 197d5e874..000000000
--- a/perl-install/standalone/interactive_http/authorised_progs
+++ /dev/null
@@ -1,13 +0,0 @@
-/usr/sbin/XFdrake
-/usr/sbin/adduserdrake
-/usr/sbin/diskdrake
-/usr/sbin/drakautoinst
-/usr/sbin/drakboot
-/usr/sbin/drakgw
-/usr/sbin/drakconnect
-/usr/sbin/draksec
-/usr/sbin/drakxservices
-/usr/sbin/keyboarddrake
-/usr/sbin/mousedrake
-/usr/sbin/printerdrake
-/usr/sbin/tinyfirewall
diff --git a/perl-install/standalone/interactive_http/index.html.pl b/perl-install/standalone/interactive_http/index.html.pl
deleted file mode 100644
index afd91459b..000000000
--- a/perl-install/standalone/interactive_http/index.html.pl
+++ /dev/null
@@ -1,14 +0,0 @@
-use MDK::Common;
-
-print '<html>
-';
-foreach (map { chomp_($_) } cat_('authorised_progs')) {
- my $name = basename($_);
- print
-qq(<a href="/interactive_http.cgi?state=new&prog=$_">$name</a>
-<br>
-);
-}
-print '
-</html>
-';
diff --git a/perl-install/standalone/interactive_http/interactive_http.cgi b/perl-install/standalone/interactive_http/interactive_http.cgi
deleted file mode 100755
index 935a4a765..000000000
--- a/perl-install/standalone/interactive_http/interactive_http.cgi
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-use CGI;
-use common;
-use c;
-
-my $q = CGI->new;
-$| = 1;
-
-my $script_name = $q->url(-relative => 1);
-
-# name inversed (must be in sync with interactive_http.html)
-my $pipe_r = "/tmp/interactive_http_w";
-my $pipe_w = "/tmp/interactive_http_r";
-
-if ($q->param('state') eq 'new') {
- force_exit_dead_prog();
- mkfifo($pipe_r); mkfifo($pipe_w);
-
- spawn_server($q->param('prog'));
- first_step();
-
-} elsif ($q->param('state') eq 'next_step') {
- next_step();
-} else {
- error("booh...");
-}
-
-sub read_ {
- local *F;
- open F, "<$pipe_r" or error("Failed to connect to the prog");
- my $t;
- print $t while sysread F, $t, 1;
-}
-sub write_ {
- local *F;
- open F, ">$pipe_w" or die;
- my $q = CGI->new;
- $q->save(\*F);
-}
-
-sub first_step { read_() }
-sub next_step { write_(); read_() }
-
-
-sub force_exit_dead_prog {
- -p $pipe_w or return;
- {
- local *F;
- sysopen F, $pipe_w, 1 | c::O_NONBLOCK() or return;
- syswrite F, "force_exit_dead_prog=1\n";
- }
-
- my $cnt = 10;
- while (-p $pipe_w) {
- sleep 1;
- $cnt-- or error("Dead prog failed to exit");
- }
-}
-
-sub spawn_server {
- my ($prog) = @_;
-
- my @authorised_progs = map { chomp_($_) } cat_('/etc/drakxtools_http/authorised_progs');
- member($prog, @authorised_progs) or error("You tried to call a non-authorised program");
-
- fork and return;
-
- $ENV{INTERACTIVE_HTTP} = $script_name;
-
- open STDIN, "</dev/zero";
- open STDOUT, ">/dev/null"; #tmp/log";
- open STDERR, ">&STDOUT";
-
- c::setsid();
- exec $prog or die "prog $prog not found\n";
-}
-
-sub error {
- my $msg = join '', @_;
-
- print $q->header(), $q->start_html();
- print $q->h1(_("Error")), @_;
- print $q->end_html(), "\n";
- exit 0;
-}
-
-sub mkfifo {
- my ($f) = @_;
- -p $f and return;
- unlink $f;
- syscall_('mknod', $f, c::S_IFIFO() | 0600, 0) or die "mkfifo failed";
- chmod 0666, $f;
-}
diff --git a/perl-install/standalone/interactive_http/miniserv.conf b/perl-install/standalone/interactive_http/miniserv.conf
deleted file mode 100644
index 99f6a5172..000000000
--- a/perl-install/standalone/interactive_http/miniserv.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-ssl=1
-log=1
-port=10001
-listen=10001
-forkcgis=1
-realm=Drakxtools Server
-
-addtype_cgi=internal/cgi
-logfile=/var/log/drakxtools_http.log
-pidfile=/var/run/drakxtools_http.pid
-root=/usr/share/libDrakX/drakxtools_http/www
-keyfile=/usr/share/libDrakX/drakxtools_http/miniserv.pem
-userfile=/usr/share/libDrakX/drakxtools_http/miniserv.users
diff --git a/perl-install/standalone/interactive_http/miniserv.init b/perl-install/standalone/interactive_http/miniserv.init
deleted file mode 100644
index e7673083c..000000000
--- a/perl-install/standalone/interactive_http/miniserv.init
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-# chkconfig: 235 99 00
-# description: Start or stop the miniserv administration server
-
-name=drakxtools_http
-server=/usr/share/libDrakX/$name/miniserv.pl
-
-case "$1" in
-'start')
- echo -n "Starting $name: "
- perl $server /etc/$name/conf
- touch /var/lock/subsys/drakxtools_http
- echo $name
- ;;
-'stop')
- echo -n "Shutting down $name: "
- kill `cat /var/run/$name.pid`
- rm -f /var/lock/subsys/drakxtools_http
- echo $name
- ;;
-'status')
- if [ -s /var/run/$name.pid ]; then
- pid=`cat /var/run/$name.pid`
- kill -0 $pid >/dev/null 2>&1
- if [ "$?" = "0" ]; then
- echo "$name (pid $pid) is running"
- else
- echo "$name is stopped"
- fi
- else
- echo "$name is stopped"
- fi
- ;;
-'restart')
- $0 stop
- $0 start
- ;;
-'reload')
- $0 stop
- $0 start
- ;;
-'condrestart')
- if [ -f /var/lock/subsys/drakxtools_http ]; then
- $0 restart
- fi
- ;;
-*)
- echo "Usage: $0 {start|stop|restart|status|reload|condrestart}"
- ;;
-esac
-exit 0
diff --git a/perl-install/standalone/interactive_http/miniserv.logrotate b/perl-install/standalone/interactive_http/miniserv.logrotate
deleted file mode 100644
index b1e833f9b..000000000
--- a/perl-install/standalone/interactive_http/miniserv.logrotate
+++ /dev/null
@@ -1,7 +0,0 @@
-# Logrotate file for drakxtools-http RPM
-
-/var/log/drakxtools_http.log {
- weekly
- notifempty
- missingok
-}
diff --git a/perl-install/standalone/interactive_http/miniserv.pam b/perl-install/standalone/interactive_http/miniserv.pam
deleted file mode 100644
index 37eae44e0..000000000
--- a/perl-install/standalone/interactive_http/miniserv.pam
+++ /dev/null
@@ -1,5 +0,0 @@
-#%PAM-1.0
-auth required /lib/security/pam_stack.so service=system-auth
-account required /lib/security/pam_stack.so service=system-auth
-password required /lib/security/pam_stack.so service=system-auth
-session required /lib/security/pam_stack.so service=system-auth
diff --git a/perl-install/standalone/interactive_http/miniserv.pem b/perl-install/standalone/interactive_http/miniserv.pem
deleted file mode 100644
index e11919e37..000000000
--- a/perl-install/standalone/interactive_http/miniserv.pem
+++ /dev/null
@@ -1,18 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIBOgIBAAJBANaRBV7X6DWUbTm8KBjjHx4CAHVSQCmei8QIwruVPngwOkEhsgzf
-IT1IY6jyY3QM6a4ASl7xokoy5U4QZ8E/q40CAwEAAQJBAIwMLA0zr4UJVCGTBjj4
-RZ84f0QUY3zG10Mk1LXLO/MFlRol+640x/PB76fPKP+Gx+88s8F6lcx7uV+jB0bM
-F6ECIQD3aYxjgxLinAmTjZf5gJDm/5LeEogML7nJ+aXJs8oAFwIhAN4DnKUfjiim
-pOowhaRqy8b9fjXG8L+SG/+KcZDsWzP7AiBO2gXTRVgEfwSSUUNJUo9b/8I4IqHX
-eHJ3C6ip8zIC+wIgdhsVygHvblC4ip0le0IVBdb0vUcH6+GeY2MS5zXVjuECIEP0
-GLnMXcQ02f8rQz0eeBYVHTNXKRMesgo3ZNcpDB2k
------END RSA PRIVATE KEY-----
------BEGIN CERTIFICATE-----
-MIIBNTCB4AIBADANBgkqhkiG9w0BAQQFADAmMRgwFgYDVQQKEw9XZWJtaW4gU29m
-dHdhcmUxCjAIBgNVBAMUASowHhcNOTgwMTAzMTAzNDUwWhcNMDcxMDAzMTAzNDUw
-WjAmMRgwFgYDVQQKEw9XZWJtaW4gU29mdHdhcmUxCjAIBgNVBAMUASowXDANBgkq
-hkiG9w0BAQEFAANLADBIAkEA1pEFXtfoNZRtObwoGOMfHgIAdVJAKZ6LxAjCu5U+
-eDA6QSGyDN8hPUhjqPJjdAzprgBKXvGiSjLlThBnwT+rjQIDAQABMA0GCSqGSIb3
-DQEBBAUAA0EAFCoYeLlWcClpv2sSc7zIchsMR3DKeH/O1ZtfEezzkaonre78HeYV
-wSQvuoVleb7A497TFcSB6+FON6azoVqPyQ==
------END CERTIFICATE-----
diff --git a/perl-install/standalone/interactive_http/miniserv.pl b/perl-install/standalone/interactive_http/miniserv.pl
deleted file mode 100644
index b11ce26e2..000000000
--- a/perl-install/standalone/interactive_http/miniserv.pl
+++ /dev/null
@@ -1,1817 +0,0 @@
-#!/usr/bin/perl
-# A very simple perl web server used by Webmin
-
-# Require basic libraries
-package miniserv;
-use Socket;
-use POSIX;
-use Sys::Hostname;
-
-# Find and read config file
-if (@ARGV != 1) {
- die "Usage: miniserv.pl <config file>";
- }
-if ($ARGV[0] =~ /^\//) {
- $conf = $ARGV[0];
- }
-else {
- chop($pwd = `pwd`);
- $conf = "$pwd/$ARGV[0]";
- }
-open(CONF, $conf) || die "Failed to open config file $conf : $!";
-while(<CONF>) {
- s/\r|\n//g;
- if (/^#/ || !/\S/) { next; }
- /^([^=]+)=(.*)$/;
- $name = $1; $val = $2;
- $name =~ s/^\s+//g; $name =~ s/\s+$//g;
- $val =~ s/^\s+//g; $val =~ s/\s+$//g;
- $config{$name} = $val;
- }
-close(CONF);
-
-# Check is SSL is enabled and available
-if ($config{'ssl'}) {
- eval "use Net::SSLeay";
- if (!$@) {
- $use_ssl = 1;
- # These functions only exist for SSLeay 1.0
- eval "Net::SSLeay::SSLeay_add_ssl_algorithms()";
- eval "Net::SSLeay::load_error_strings()";
- if (defined(&Net::SSLeay::X509_STORE_CTX_get_current_cert) &&
- defined(&Net::SSLeay::CTX_load_verify_locations) &&
- defined(&Net::SSLeay::CTX_set_verify)) {
- $client_certs = 1;
- }
- }
- }
-
-# Check if the syslog module is available to log hacking attempts
-if ($config{'syslog'}) {
- eval "use Sys::Syslog qw(:DEFAULT setlogsock)";
- if (!$@) {
- $use_syslog = 1;
- }
- }
-
-# check if the PAM module is available to authenticate
-eval "use Authen::PAM";
-if (!$@) {
- # check if the PAM authentication can be used by opening a handle
- if (! ref($pamh = new Authen::PAM("miniserv", "root", \&pam_conv_func))) {
- print STDERR "PAM module available, but error during init !\n";
- print STDERR "Disabling PAM functions.\n";
- }
- else {
- $use_pam = 1;
- }
- }
-
-# check if the TCP-wrappers module is available
-if ($config{'libwrap'}) {
- eval "use Authen::Libwrap qw(hosts_ctl STRING_UNKNOWN)";
- if (!$@) {
- $use_libwrap = 1;
- }
- }
-
-# Get miniserv's perl path and location
-$miniserv_path = $0;
-open(SOURCE, $miniserv_path);
-<SOURCE> =~ /^#!(\S+)/; $perl_path = $1;
-close(SOURCE);
-@miniserv_argv = @ARGV;
-
-# Check vital config options
-%vital = ("port", 80,
- "root", "./",
- "server", "MiniServ/0.01",
- "index_docs", "index.html index.htm index.cgi",
- "addtype_html", "text/html",
- "addtype_txt", "text/plain",
- "addtype_gif", "image/gif",
- "addtype_jpg", "image/jpeg",
- "addtype_jpeg", "image/jpeg",
- "realm", "MiniServ",
- "session_login", "/session_login.cgi"
- );
-foreach $v (keys %vital) {
- if (!$config{$v}) {
- if ($vital{$v} eq "") {
- die "Missing config option $v";
- }
- $config{$v} = $vital{$v};
- }
- }
-if (!$config{'sessiondb'}) {
- $config{'pidfile'} =~ /^(.*)\/[^\/]+$/;
- $config{'sessiondb'} = "$1/sessiondb";
- }
-die "Session authentication cannot be used in inetd mode"
- if ($config{'inetd'} && $config{'session'});
-
-# init days and months for http_date
-@weekday = ( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" );
-@month = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" );
-
-# Change dir to the server root
-chdir($config{'root'});
-$user_homedir = (getpwuid($<))[7];
-
-# Read users file
-if ($config{'userfile'}) {
- open(USERS, $config{'userfile'});
- while(<USERS>) {
- s/\r|\n//g;
- local @user = split(/:/, $_);
- $users{$user[0]} = $user[1];
- $certs{$user[0]} = $user[3] if ($user[3]);
- if ($user[4] =~ /^allow\s+(.*)/) {
- $allow{$user[0]} = [ &to_ipaddress(split(/\s+/, $1)) ];
- }
- elsif ($user[4] =~ /^deny\s+(.*)/) {
- $deny{$user[0]} = [ &to_ipaddress(split(/\s+/, $1)) ];
- }
- }
- close(USERS);
- }
-
-# Setup SSL if possible and if requested
-if ($use_ssl) {
- $ssl_ctx = Net::SSLeay::CTX_new() ||
- die "Failed to create SSL context : $!";
- $client_certs = 0 if (!$config{'ca'} || !%certs);
- if ($client_certs) {
- Net::SSLeay::CTX_load_verify_locations(
- $ssl_ctx, $config{'ca'}, "");
- Net::SSLeay::CTX_set_verify(
- $ssl_ctx, &Net::SSLeay::VERIFY_PEER, \&verify_client);
- }
-
- Net::SSLeay::CTX_use_RSAPrivateKey_file(
- $ssl_ctx, $config{'keyfile'},
- &Net::SSLeay::FILETYPE_PEM) || die "Failed to open SSL key";
- Net::SSLeay::CTX_use_certificate_file(
- $ssl_ctx, $config{'keyfile'},
- &Net::SSLeay::FILETYPE_PEM);
- }
-
-# Setup syslog support if possible and if requested
-if ($use_syslog) {
- eval { openlog("miniserv", "cons,pid,ndelay", "daemon") };
- $use_syslog = 0 if ($@);
- }
-
-# Read MIME types file and add extra types
-if ($config{"mimetypes"} ne "") {
- open(MIME, $config{"mimetypes"});
- while(<MIME>) {
- chop; s/#.*$//;
- if (/^(\S+)\s+(.*)$/) {
- $type = $1; @exts = split(/\s+/, $2);
- foreach $ext (@exts) {
- $mime{$ext} = $type;
- }
- }
- }
- close(MIME);
- }
-foreach $k (keys %config) {
- if ($k !~ /^addtype_(.*)$/) { next; }
- $mime{$1} = $config{$k};
- }
-
-# get the time zone
-if ($config{'log'}) {
- local(@gmt, @lct, $days, $hours, $mins);
- @make_date_marr = ("Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
- @gmt = gmtime(time());
- @lct = localtime(time());
- $days = $lct[3] - $gmt[3];
- $hours = ($days < -1 ? 24 : 1 < $days ? -24 : $days * 24) +
- $lct[2] - $gmt[2];
- $mins = $hours * 60 + $lct[1] - $gmt[1];
- $timezone = ($mins < 0 ? "-" : "+"); $mins = abs($mins);
- $timezone .= sprintf "%2.2d%2.2d", $mins/60, $mins%60;
- }
-
-if ($config{'inetd'}) {
- # We are being run from inetd - go direct to handling the request
- $SIG{'HUP'} = 'IGNORE';
- $SIG{'TERM'} = 'DEFAULT';
- $SIG{'PIPE'} = 'DEFAULT';
- open(SOCK, "+>&STDIN");
-
- # Check if it is time for the logfile to be cleared
- if ($config{'logclear'}) {
- local $write_logtime = 0;
- local @st = stat("$config{'logfile'}.time");
- if (@st) {
- if ($st[9]+$config{'logtime'}*60*60 < time()){
- # need to clear log
- $write_logtime = 1;
- unlink($config{'logfile'});
- }
- }
- else { $write_logtime = 1; }
- if ($write_logtime) {
- open(LOGTIME, ">$config{'logfile'}.time");
- print LOGTIME time(),"\n";
- close(LOGTIME);
- }
- }
-
- # Initialize SSL for this connection
- if ($use_ssl) {
- $ssl_con = Net::SSLeay::new($ssl_ctx);
- Net::SSLeay::set_fd($ssl_con, fileno(SOCK));
- #Net::SSLeay::use_RSAPrivateKey_file(
- # $ssl_con, $config{'keyfile'},
- # &Net::SSLeay::FILETYPE_PEM);
- #Net::SSLeay::use_certificate_file(
- # $ssl_con, $config{'keyfile'},
- # &Net::SSLeay::FILETYPE_PEM);
- Net::SSLeay::accept($ssl_con) || exit;
- }
-
- # Work out the hostname for this web server
- if (!$config{'host'}) {
- ($myport, $myaddr) =
- unpack_sockaddr_in(getsockname(SOCK));
- $myname = gethostbyaddr($myaddr, AF_INET);
- if ($myname eq "") {
- $myname = inet_ntoa($myaddr);
- }
- $host = $myname;
- }
- else { $host = $config{'host'}; }
- $port = $config{'port'};
-
- while(&handle_request(getpeername(SOCK), getsockname(SOCK))) { }
- close(SOCK);
- exit;
- }
-
-# Open main socket
-$proto = getprotobyname('tcp');
-socket(MAIN, PF_INET, SOCK_STREAM, $proto) ||
- die "Failed to open main socket : $!";
-setsockopt(MAIN, SOL_SOCKET, SO_REUSEADDR, pack("l", 1));
-$baddr = $config{"bind"} ? inet_aton($config{"bind"}) : INADDR_ANY;
-for($i=0; $i<5; $i++) {
- last if (bind(MAIN, sockaddr_in($config{port}, $baddr)));
- sleep(1);
- }
-die "Failed to bind port $config{port} : $!" if ($i == 5);
-listen(MAIN, SOMAXCONN);
-
-if ($config{'listen'}) {
- # Open the socket that allows other miniserv servers to find this one
- $proto = getprotobyname('udp');
- if (socket(LISTEN, PF_INET, SOCK_DGRAM, $proto)) {
- setsockopt(LISTEN, SOL_SOCKET, SO_REUSEADDR, pack("l", 1));
- bind(LISTEN, sockaddr_in($config{'listen'}, INADDR_ANY));
- listen(LISTEN, SOMAXCONN);
- }
- else {
- print STDERR "Failed to open listening socket : $!\n";
- $config{'listen'} = 0;
- }
- }
-
-
-# Split from the controlling terminal
-if (fork()) { exit; }
-setsid();
-
-# write out the PID file
-open(PIDFILE, "> $config{'pidfile'}");
-printf PIDFILE "%d\n", getpid();
-close(PIDFILE);
-
-# Start the log-clearing process, if needed. This checks every minute
-# to see if the log has passed its reset time, and if so clears it
-if ($config{'logclear'}) {
- if (!($logclearer = fork())) {
- while(1) {
- local $write_logtime = 0;
- local @st = stat("$config{'logfile'}.time");
- if (@st) {
- if ($st[9]+$config{'logtime'}*60*60 < time()){
- # need to clear log
- $write_logtime = 1;
- unlink($config{'logfile'});
- }
- }
- else { $write_logtime = 1; }
- if ($write_logtime) {
- open(LOGTIME, ">$config{'logfile'}.time");
- print LOGTIME time(),"\n";
- close(LOGTIME);
- }
- sleep(5*60);
- }
- exit;
- }
- push(@childpids, $logclearer);
- }
-
-# Setup the logout time dbm if needed
-if ($config{'session'}) {
- eval "use SDBM_File";
- dbmopen(%sessiondb, $config{'sessiondb'}, 0700);
- eval { $sessiondb{'1111111111'} = 'foo bar' };
- if ($@) {
- dbmclose(%sessiondb);
- eval "use NDBM_File";
- dbmopen(%sessiondb, $config{'sessiondb'}, 0700);
- }
- }
-
-# Run the main loop
-$SIG{'HUP'} = 'miniserv::trigger_restart';
-$SIG{'TERM'} = 'miniserv::term_handler';
-$SIG{'PIPE'} = 'IGNORE';
-@deny = &to_ipaddress(split(/\s+/, $config{"deny"}));
-@allow = &to_ipaddress(split(/\s+/, $config{"allow"}));
-$p = 0;
-while(1) {
- # wait for a new connection, or a message from a child process
- undef($rmask);
- vec($rmask, fileno(MAIN), 1) = 1;
- if ($config{'passdelay'} || $config{'session'}) {
- for($i=0; $i<@passin; $i++) {
- vec($rmask, fileno($passin[$i]), 1) = 1;
- }
- }
- vec($rmask, fileno(LISTEN), 1) = 1 if ($config{'listen'});
-
- local $sel = select($rmask, undef, undef, 10);
- if ($need_restart) { &restart_miniserv(); }
- local $time_now = time();
-
- # Clean up finished processes
- local($pid);
- do { $pid = waitpid(-1, WNOHANG);
- @childpids = grep { $_ != $pid } @childpids;
- } while($pid > 0);
-
- # run the unblocking procedure to check if enough time has passed to
- # unblock hosts that heve been blocked because of password failures
- if ($config{'blockhost_failures'}) {
- $i = 0;
- while ($i <= $#deny) {
- if ($blockhosttime{$deny[$i]} && $config{'blockhost_time'} != 0 &&
- ($time_now - $blockhosttime{$deny[$i]}) >= $config{'blockhost_time'}) {
- # the host can be unblocked now
- $hostfail{$deny[$i]} = 0;
- splice(@deny, $i, 1);
- }
- $i++;
- }
- }
-
- if ($config{'session'}) {
- # Remove sessions with more than 7 days of inactivity
- foreach $s (keys %sessiondb) {
- local ($user, $ltime) = split(/\s+/, $sessiondb{$s});
- if ($time_now - $ltime > 7*24*60*60) {
- delete($sessiondb{$s});
- }
- }
- }
- next if ($sel <= 0);
- if (vec($rmask, fileno(MAIN), 1)) {
- # got new connection
- $acptaddr = accept(SOCK, MAIN);
- if (!$acptaddr) { next; }
-
- # create pipes
- if ($config{'passdelay'} || $config{'session'}) {
- $PASSINr = "PASSINr$p"; $PASSINw = "PASSINw$p";
- $PASSOUTr = "PASSOUTr$p"; $PASSOUTw = "PASSOUTw$p";
- $p++;
- pipe($PASSINr, $PASSINw);
- pipe($PASSOUTr, $PASSOUTw);
- select($PASSINw); $| = 1; select($PASSINr); $| = 1;
- select($PASSOUTw); $| = 1; select($PASSOUTw); $| = 1;
- }
- select(STDOUT);
-
- # Check username of connecting user
- local ($peerp, $peera) = unpack_sockaddr_in($acptaddr);
- $localauth_user = undef;
- if ($config{'localauth'} && inet_ntoa($peera) eq "127.0.0.1") {
- if (open(TCP, "/proc/net/tcp")) {
- # Get the info direct from the kernel
- while(<TCP>) {
- s/^\s+//;
- local @t = split(/[\s:]+/, $_);
- if ($t[1] eq '0100007F' &&
- $t[2] eq sprintf("%4.4X", $peerp)) {
- $localauth_user = getpwuid($t[11]);
- last;
- }
- }
- close(TCP);
- }
- else {
- # Call lsof for the info
- local $lsofpid = open(LSOF,
- "$config{'localauth'} -i TCP\@127.0.0.1:$peerp |");
- while(<LSOF>) {
- if (/^(\S+)\s+(\d+)\s+(\S+)/ &&
- $2 != $$ && $2 != $lsofpid) {
- $localauth_user = $3;
- }
- }
- close(LSOF);
- }
- }
-
- # fork the subprocess
- if (!($handpid = fork())) {
- # setup signal handlers
- $SIG{'TERM'} = 'DEFAULT';
- $SIG{'PIPE'} = 'DEFAULT';
- #$SIG{'CHLD'} = 'IGNORE';
- $SIG{'HUP'} = 'IGNORE';
-
- # Initialize SSL for this connection
- if ($use_ssl) {
- $ssl_con = Net::SSLeay::new($ssl_ctx);
- Net::SSLeay::set_fd($ssl_con, fileno(SOCK));
- #Net::SSLeay::use_RSAPrivateKey_file(
- # $ssl_con, $config{'keyfile'},
- # &Net::SSLeay::FILETYPE_PEM);
- #Net::SSLeay::use_certificate_file(
- # $ssl_con, $config{'keyfile'},
- # &Net::SSLeay::FILETYPE_PEM);
- Net::SSLeay::accept($ssl_con) || exit;
- }
-
- # close useless pipes
- if ($config{'passdelay'} || $config{'session'}) {
- foreach $p (@passin) { close($p); }
- foreach $p (@passout) { close($p); }
- close($PASSINr); close($PASSOUTw);
- }
- close(MAIN);
-
- # Work out the hostname for this web server
- if (!$config{'host'}) {
- ($myport, $myaddr) =
- unpack_sockaddr_in(getsockname(SOCK));
- $myname = gethostbyaddr($myaddr, AF_INET);
- if ($myname eq "") {
- $myname = inet_ntoa($myaddr);
- }
- $host = $myname;
- }
- else { $host = $config{'host'}; }
- $port = $config{'port'};
-
- local $switched = 0;
- if ($config{'remoteuser'} && $localauth_user && !$<) {
- # Switch to the UID of the remote user
- local @u = getpwnam($localauth_user);
- if (@u) {
- $( = $u[3]; $) = "$u[3] $u[3]";
- $< = $> = $u[2];
- $switched = 1;
- }
- }
- if ($config{'switchuser'} && !$< && !$switched) {
- # Switch to the UID of server user
- local @u = getpwnam($config{'switchuser'});
- if (@u) {
- $( = $u[3]; $) = "$u[3] $u[3]";
- $< = $> = $u[2];
- }
- }
-
- while(&handle_request($acptaddr, getsockname(SOCK))) { }
- shutdown(SOCK, 1);
- close(SOCK);
- close($PASSINw); close($PASSOUTw);
- exit;
- }
- push(@childpids, $handpid);
- if ($config{'passdelay'} || $config{'session'}) {
- close($PASSINw); close($PASSOUTr);
- push(@passin, $PASSINr); push(@passout, $PASSOUTw);
- }
- close(SOCK);
- }
-
- if ($config{'listen'} && vec($rmask, fileno(LISTEN), 1)) {
- # Got UDP packet from another miniserv server
- local $rcvbuf;
- local $from = recv(LISTEN, $rcvbuf, 1024, 0);
- next if (!$from);
- local $fromip = inet_ntoa((unpack_sockaddr_in($from))[1]);
- local $toip = inet_ntoa((unpack_sockaddr_in(
- getsockname(LISTEN)))[1]);
- if ((!@deny || !&ip_match($fromip, $toip, @deny)) &&
- (!@allow || &ip_match($fromip, $toip, @allow))) {
- send(LISTEN, "$config{'host'}:$config{'port'}:".
- "$use_ssl", 0, $from);
- }
- }
-
- # check for password-timeout messages from subprocesses
- for($i=0; $i<@passin; $i++) {
- if (vec($rmask, fileno($passin[$i]), 1)) {
- # this sub-process is asking about a password
- $infd = $passin[$i]; $outfd = $passout[$i];
- $inline = <$infd>;
- if ($inline =~ /^delay\s+(\S+)\s+(\S+)\s+(\d+)/) {
- # Got a delay request from a subprocess.. for
- # valid logins, there is no delay (to prevent
- # denial of service attacks), but for invalid
- # logins the delay increases with each failed
- # attempt.
- if ($3) {
- # login OK.. no delay
- print $outfd "0 0\n";
- $hostfail{$2} = 0;
- }
- else {
- # login failed..
- $hostfail{$2}++;
- # add the host to the block list if necessary
- if ($config{'blockhost_failures'} &&
- $hostfail{$2} >= $config{'blockhost_failures'}) {
- push(@deny, $2);
- $blockhosttime{$2} = $time_now;
- $blocked = 1;
- if ($use_syslog) {
- local $logtext = "Security alert: Host $2 ".
- "blocked after $config{'blockhost_failures'} ".
- "failed logins for user $1";
- syslog("crit", $logtext);
- }
- }
- else {
- $blocked = 0;
- }
- $dl = $userdlay{$1} -
- int(($time_now - $userlast{$1})/50);
- $dl = $dl < 0 ? 0 : $dl+1;
- print $outfd "$dl $blocked\n";
- $userdlay{$1} = $dl;
- }
- $userlast{$1} = $time_now;
- }
- elsif ($inline =~ /^verify\s+(\S+)/) {
- # Verifying a session ID
- local $session_id = $1;
- if (!defined($sessiondb{$session_id})) {
- print $outfd "0 0\n";
- }
- else {
- local ($user, $ltime) = split(/\s+/, $sessiondb{$session_id});
- if ($config{'logouttime'} &&
- $time_now - $ltime > $config{'logouttime'}*60) {
- print $outfd "1 ",$time_now - $ltime,"\n";
- delete($sessiondb{$session_id});
- }
- else {
- print $outfd "2 $user\n";
- $sessiondb{$session_id} = "$user $time_now";
- }
- }
- }
- elsif ($inline =~ /^new\s+(\S+)\s+(\S+)/) {
- # Creating a new session
- $sessiondb{$1} = "$2 $time_now";
- }
- elsif ($inline =~ /^delete\s+(\S+)/) {
- # Logging out a session
- print $outfd $sessiondb{$1} ? 1 : 0,"\n";
- delete($sessiondb{$1});
- }
- else {
- # close pipe
- close($infd); close($outfd);
- $passin[$i] = $passout[$i] = undef;
- }
- }
- }
- @passin = grep { defined($_) } @passin;
- @passout = grep { defined($_) } @passout;
- }
-
-# handle_request(remoteaddress, localaddress)
-# Where the real work is done
-sub handle_request
-{
-$acptip = inet_ntoa((unpack_sockaddr_in($_[0]))[1]);
-$localip = $_[1] ? inet_ntoa((unpack_sockaddr_in($_[1]))[1]) : undef;
-if ($config{'loghost'}) {
- $acpthost = gethostbyaddr(inet_aton($acptip), AF_INET);
- $acpthost = $acptip if (!$acpthost);
- }
-else {
- $acpthost = $acptip;
- }
-$datestr = &http_date(time());
-$ok_code = 200;
-$ok_message = "Document follows";
-
-# Wait at most 60 secs for start of headers (but only for the first time)
-if (!$checked_timeout) {
- local $rmask;
- vec($rmask, fileno(SOCK), 1) = 1;
- local $sel = select($rmask, undef, undef, 60);
- $sel || &http_error(400, "Timeout");
- $checked_timeout++;
- }
-
-# Read the HTTP request and headers
-($reqline = &read_line()) =~ s/\r|\n//g;
-if (!($reqline =~ /^(GET|POST|HEAD)\s+(.*)\s+HTTP\/1\..$/)) {
- &http_error(400, "Bad Request");
- }
-$method = $1; $request_uri = $page = $2;
-%header = ();
-local $lastheader;
-while(1) {
- ($headline = &read_line()) =~ s/\r|\n//g;
- last if ($headline eq "");
- if ($headline =~ /^(\S+):\s+(.*)$/) {
- $header{$lastheader = lc($1)} = $2;
- }
- elsif ($headline =~ /^\s+(.*)$/) {
- $header{$lastheader} .= $headline;
- }
- else {
- &http_error(400, "Bad Header $headline");
- }
- }
-if (defined($header{'host'})) {
- if ($header{'host'} =~ /^([^:]+):([0-9]+)$/) { $host = $1; $port = $2; }
- else { $host = $header{'host'}; }
- }
-undef(%in);
-if ($page =~ /^([^\?]+)\?(.*)$/) {
- # There is some query string information
- $page = $1;
- $querystring = $2;
- if ($querystring !~ /=/) {
- $queryargs = $querystring;
- $queryargs =~ s/\+/ /g;
- $queryargs =~ s/%(..)/pack("c",hex($1))/ge;
- $querystring = "";
- }
- else {
- # Parse query-string parameters
- local @in = split(/\&/, $querystring);
- foreach $i (@in) {
- local ($k, $v) = split(/=/, $i, 2);
- $k =~ s/\+/ /g; $k =~ s/%(..)/pack("c",hex($1))/ge;
- $v =~ s/\+/ /g; $v =~ s/%(..)/pack("c",hex($1))/ge;
- $in{$k} = $v;
- }
- }
- }
-$posted_data = undef;
-if ($method eq 'POST' &&
- $header{'content-type'} eq 'application/x-www-form-urlencoded') {
- # Read in posted query string information
- $clen = $header{"content-length"};
- while(length($posted_data) < $clen) {
- $buf = &read_data($clen - length($posted_data));
- if (!length($buf)) {
- &http_error(500, "Failed to read POST request");
- }
- $posted_data .= $buf;
- }
- local @in = split(/\&/, $posted_data);
- foreach $i (@in) {
- local ($k, $v) = split(/=/, $i, 2);
- $k =~ s/\+/ /g; $k =~ s/%(..)/pack("c",hex($1))/ge;
- $v =~ s/\+/ /g; $v =~ s/%(..)/pack("c",hex($1))/ge;
- $in{$k} = $v;
- }
- }
-
-# replace %XX sequences in page
-$page =~ s/%(..)/pack("c",hex($1))/ge;
-
-# check address against access list
-if (@deny && &ip_match($acptip, $localip, @deny) ||
- @allow && !&ip_match($acptip, $localip, @allow)) {
- &http_error(403, "Access denied for $acptip");
- return 0;
- }
-
-if ($use_libwrap) {
- # Check address with TCP-wrappers
- if (!hosts_ctl("miniserv", STRING_UNKNOWN, $acptip, STRING_UNKNOWN)) {
- &http_error(403, "Access denied for $acptip");
- return 0;
- }
- }
-
-# check for the logout flag file, and if existant deny authentication
-if ($config{'logout'} && -r $config{'logout'}.$in{'miniserv_logout_id'}) {
- $deny_authentication++;
- open(LOGOUT, $config{'logout'}.$in{'miniserv_logout_id'});
- chop($count = <LOGOUT>);
- close(LOGOUT);
- $count--;
- if ($count > 0) {
- open(LOGOUT, ">$config{'logout'}$in{'miniserv_logout_id'}");
- print LOGOUT "$count\n";
- close(LOGOUT);
- }
- else {
- unlink($config{'logout'}.$in{'miniserv_logout_id'});
- }
- }
-
-# Check for password if needed
-if (%users) {
- $validated = 0;
- $blocked = 0;
-
- # Session authentication is never used for connections by
- # another miniserv server
- if ($header{'user-agent'} =~ /miniserv/i) {
- $config{'session'} = 0;
- }
-
- # check for SSL authentication
- if ($use_ssl && $verified_client) {
- $peername = Net::SSLeay::X509_NAME_oneline(
- Net::SSLeay::X509_get_subject_name(
- Net::SSLeay::get_peer_certificate(
- $ssl_con)));
- foreach $u (keys %certs) {
- if ($certs{$u} eq $peername) {
- $authuser = $u;
- $validated = 2;
- last;
- }
- }
- }
-
- # Check for normal HTTP authentication
- if (!$validated && !$deny_authentication && !$config{'session'} &&
- $header{authorization} =~ /^basic\s+(\S+)$/i) {
- # authorization given..
- ($authuser, $authpass) = split(/:/, &b64decode($1));
- $validated = &validate_user($authuser, $authpass);
-
- if ($config{'passdelay'} && !$config{'inetd'}) {
- # check with main process for delay
- print $PASSINw "delay $authuser $acptip $validated\n";
- <$PASSOUTr> =~ /(\d+) (\d+)/;
- $blocked = $2;
- sleep($1);
- }
- }
-
- # Check for new session validation
- if ($config{'session'} && !$deny_authentication && $page eq $config{'session_login'}) {
- local $ok = &validate_user($in{'user'}, $in{'pass'});
-
- # check if the test cookie is set
- if ($header{'cookie'} !~ /testing=1/ && $in{'user'}) {
- &http_error(500, "No cookies",
- "Your browser does not support cookies, ".
- "which are required for Webmin to work in ".
- "session authentication mode");
- }
-
- # check with main process for delay
- if ($config{'passdelay'} && $in{'user'}) {
- print $PASSINw "delay $in{'user'} $acptip $ok\n";
- <$PASSOUTr> =~ /(\d+) (\d+)/;
- $blocked = $2;
- sleep($1);
- }
-
- if ($ok) {
- # Logged in OK! Tell the main process about the new SID
- local $sid = time();
- local $mul = 1;
- foreach $c (split(//, crypt($in{'pass'}, substr($$, -2)))) {
- $sid += ord($c) * $mul;
- $mul *= 3;
- }
- print $PASSINw "new $sid $in{'user'}\n";
-
- # Set cookie and redirect
- &write_data("HTTP/1.0 302 Moved Temporarily\r\n");
- &write_data("Date: $datestr\r\n");
- &write_data("Server: $config{'server'}\r\n");
- $portstr = $port == 80 && !$use_ssl ? "" :
- $port == 443 && $use_ssl ? "" : ":$port";
- $prot = $use_ssl ? "https" : "http";
- if ($in{'save'}) {
- &write_data("Set-Cookie: sid=$sid; path=/; expires=\"Fri, 1-Jan-2038 00:00:01\"\r\n");
- }
- else {
- &write_data("Set-Cookie: sid=$sid; path=/\r\n");
- }
- &write_data("Location: $prot://$host$portstr$in{'page'}\r\n");
- &write_keep_alive(0);
- &write_data("\r\n");
- &log_request($acpthost, $authuser, $reqline, 302, 0);
- return 0;
- }
- elsif ($in{'logout'} && $header{'cookie'} =~ /sid=(\d+)/) {
- # Logout clicked .. remove the session
- print $PASSINw "delete $1\n";
- local $dummy = <$PASSINr>;
- $logout = 1;
- $already_session_id = undef;
- }
- else {
- # Login failed .. display the form again
- $failed_user = $in{'user'};
- $request_uri = $in{'page'};
- $already_session_id = undef;
- }
- }
-
- # Check for an existing session
- if ($config{'session'} && !$validated) {
- if ($already_session_id) {
- $session_id = $already_session_id;
- $authuser = $already_authuser;
- $validated = 1;
- }
- elsif (!$deny_authentication && $header{'cookie'} =~ /sid=(\d+)/) {
- $session_id = $1;
- print $PASSINw "verify $session_id\n";
- <$PASSOUTr> =~ /(\d+)\s+(\S+)/;
- if ($1 == 2) {
- # Valid session continuation
- $validated = 1;
- $authuser = $2;
- $already_session_id = $session_id;
- $already_authuser = $authuser;
- }
- elsif ($1 == 1) {
- # Session timed out
- $timed_out = $2;
- }
- else {
- # Invalid session ID .. don't set verified
- }
- }
- }
-
- # Check for local authentication
- if ($localauth_user) {
- if (defined($users{$localauth_user})) {
- $validated = 1;
- $authuser = $localauth_user;
- }
- else {
- $localauth_user = undef;
- }
- }
-
- if (!$validated) {
- if ($blocked == 0) {
- # No password given.. ask
- if ($config{'session'}) {
- # Force CGI for session login
- $validated = 1;
- if ($logout) {
- $querystring .= "&logout=1&page=/";
- }
- else {
- $querystring = "page=".&urlize($request_uri);
- }
- $querystring .= "&failed=$failed_user" if ($failed_user);
- $querystring .= "&timed_out=$timed_out" if ($timed_out);
- $queryargs = "";
- $page = $config{'session_login'};
- }
- else {
- # Ask for login with HTTP authentication
- &write_data("HTTP/1.0 401 Unauthorized\r\n");
- &write_data("Date: $datestr\r\n");
- &write_data("Server: $config{'server'}\r\n");
- &write_data("WWW-authenticate: Basic ".
- "realm=\"$config{'realm'}\"\r\n");
- &write_keep_alive(0);
- &write_data("Content-type: text/html\r\n");
- &write_data("\r\n");
- &reset_byte_count();
- &write_data("<html>\n");
- &write_data("<head><title>Unauthorized</title></head>\n");
- &write_data("<body><h1>Unauthorized</h1>\n");
- &write_data("A password is required to access this\n");
- &write_data("web server. Please try again. <p>\n");
- &write_data("</body></html>\n");
- &log_request($acpthost, undef, $reqline, 401, &byte_count());
- return 0;
- }
- }
- else {
- # when the host has been blocked, give it an error message
- &http_error(403, "Access denied for $acptip. The host has been blocked "
- ."because of too many authentication failures.");
- }
- }
-
- # Check per-user IP access control
- if ($deny{$authuser} && &ip_match($acptip, $localip, @{$deny{$authuser}}) ||
- $allow{$authuser} && !&ip_match($acptip, $localip, @{$allow{$authuser}})) {
- &http_error(403, "Access denied for $acptip");
- return 0;
- }
- }
-
-# Figure out what kind of page was requested
-rerun:
-$simple = &simplify_path($page, $bogus);
-$simple =~ s/[\000-\037]//g;
-if ($bogus) {
- &http_error(400, "Invalid path");
- }
-undef($full);
-if ($config{'preroot'}) {
- # Look in the template root directory first
- $is_directory = 1;
- $sofar = "";
- $full = $config{"preroot"} . $sofar;
- $scriptname = $simple;
- foreach $b (split(/\//, $simple)) {
- if ($b ne "") { $sofar .= "/$b"; }
- $full = $config{"preroot"} . $sofar;
- @st = stat($full);
- if (!@st) { undef($full); last; }
-
- # Check if this is a directory
- if (-d $full) {
- # It is.. go on parsing
- $is_directory = 1;
- next;
- }
- else { $is_directory = 0; }
-
- # Check if this is a CGI program
- if (&get_type($full) eq "internal/cgi") {
- $pathinfo = substr($simple, length($sofar));
- $pathinfo .= "/" if ($page =~ /\/$/);
- $scriptname = $sofar;
- last;
- }
- }
- if ($full) {
- if ($sofar eq '') {
- $cgi_pwd = $config{'root'};
- }
- else {
- "$config{'root'}$sofar" =~ /^(.*\/)[^\/]+$/;
- $cgi_pwd = $1;
- }
- if ($is_directory) {
- # Check for index files in the directory
- foreach $idx (split(/\s+/, $config{"index_docs"})) {
- $idxfull = "$full/$idx";
- if (-r $idxfull && !(-d $idxfull)) {
- $full = $idxfull;
- $is_directory = 0;
- $scriptname .= "/"
- if ($scriptname ne "/");
- last;
- }
- }
- }
- }
- }
-if (!$full || $is_directory) {
- $sofar = "";
- $full = $config{"root"} . $sofar;
- $scriptname = $simple;
- foreach $b (split(/\//, $simple)) {
- if ($b ne "") { $sofar .= "/$b"; }
- $full = $config{"root"} . $sofar;
- @st = stat($full);
- if (!@st) { &http_error(404, "File not found"); }
-
- # Check if this is a directory
- if (-d $full) {
- # It is.. go on parsing
- next;
- }
-
- # Check if this is a CGI program
- if (&get_type($full) eq "internal/cgi") {
- $pathinfo = substr($simple, length($sofar));
- $pathinfo .= "/" if ($page =~ /\/$/);
- $scriptname = $sofar;
- last;
- }
- }
- $full =~ /^(.*\/)[^\/]+$/; $cgi_pwd = $1;
- }
-
-# check filename against denyfile regexp
-local $denyfile = $config{'denyfile'};
-if ($denyfile && $full =~ /$denyfile/) {
- &http_error(403, "Access denied to $page");
- return 0;
- }
-
-# Reached the end of the path OK.. see what we've got
-if (-d $full) {
- # See if the URL ends with a / as it should
- if ($page !~ /\/$/) {
- # It doesn't.. redirect
- &write_data("HTTP/1.0 302 Moved Temporarily\r\n");
- $portstr = $port == 80 && !$use_ssl ? "" :
- $port == 443 && $use_ssl ? "" : ":$port";
- &write_data("Date: $datestr\r\n");
- &write_data("Server: $config{server}\r\n");
- $prot = $use_ssl ? "https" : "http";
- &write_data("Location: $prot://$host$portstr$page/\r\n");
- &write_keep_alive(0);
- &write_data("\r\n");
- &log_request($acpthost, $authuser, $reqline, 302, 0);
- return 0;
- }
- # A directory.. check for index files
- foreach $idx (split(/\s+/, $config{"index_docs"})) {
- $idxfull = "$full/$idx";
- if (-r $idxfull && !(-d $idxfull)) {
- $cgi_pwd = $full;
- $full = $idxfull;
- $scriptname .= "/" if ($scriptname ne "/");
- last;
- }
- }
- }
-if (-d $full) {
- # This is definately a directory.. list it
- &write_data("HTTP/1.0 $ok_code $ok_message\r\n");
- &write_data("Date: $datestr\r\n");
- &write_data("Server: $config{server}\r\n");
- &write_data("Content-type: text/html\r\n");
- &write_keep_alive(0);
- &write_data("\r\n");
- &reset_byte_count();
- &write_data("<h1>Index of $simple</h1>\n");
- &write_data("<pre>\n");
- &write_data(sprintf "%-35.35s %-20.20s %-10.10s\n",
- "Name", "Last Modified", "Size");
- &write_data("<hr>\n");
- opendir(DIR, $full);
- while($df = readdir(DIR)) {
- if ($df =~ /^\./) { next; }
- (@stbuf = stat("$full/$df")) || next;
- if (-d "$full/$df") { $df .= "/"; }
- @tm = localtime($stbuf[9]);
- $fdate = sprintf "%2.2d/%2.2d/%4.4d %2.2d:%2.2d:%2.2d",
- $tm[3],$tm[4]+1,$tm[5]+1900,
- $tm[0],$tm[1],$tm[2];
- $len = length($df); $rest = " "x(35-$len);
- &write_data(sprintf
- "<a href=\"%s\">%-${len}.${len}s</a>$rest %-20.20s %-10.10s\n",
- $df, $df, $fdate, $stbuf[7]);
- }
- closedir(DIR);
- &log_request($acpthost, $authuser, $reqline, $ok_code, &byte_count());
- return 0;
- }
-
-# CGI or normal file
-local $rv;
-if (&get_type($full) eq "internal/cgi") {
- # A CGI program to execute
- $envtz = $ENV{"TZ"};
- $envuser = $ENV{"USER"};
- $envpath = $ENV{"PATH"};
- foreach (keys %ENV) { delete($ENV{$_}); }
- $ENV{"PATH"} = $envpath if ($envpath);
- $ENV{"TZ"} = $envtz if ($envtz);
- $ENV{"USER"} = $envuser if ($envuser);
- $ENV{"HOME"} = $user_homedir;
- $ENV{"SERVER_SOFTWARE"} = $config{"server"};
- $ENV{"SERVER_NAME"} = $host;
- $ENV{"SERVER_ADMIN"} = $config{"email"};
- $ENV{"SERVER_ROOT"} = $config{"root"};
- $ENV{"SERVER_PORT"} = $port;
- $ENV{"REMOTE_HOST"} = $acpthost;
- $ENV{"REMOTE_ADDR"} = $acptip;
- $ENV{"REMOTE_USER"} = $authuser if (defined($authuser));
- $ENV{"SSL_USER"} = $peername if ($validated == 2);
- $ENV{"DOCUMENT_ROOT"} = $config{"root"};
- $ENV{"GATEWAY_INTERFACE"} = "CGI/1.1";
- $ENV{"SERVER_PROTOCOL"} = "HTTP/1.0";
- $ENV{"REQUEST_METHOD"} = $method;
- $ENV{"SCRIPT_NAME"} = $scriptname;
- $ENV{"REQUEST_URI"} = $request_uri;
- $ENV{"PATH_INFO"} = $pathinfo;
- $ENV{"PATH_TRANSLATED"} = "$config{root}/$pathinfo";
- $ENV{"QUERY_STRING"} = $querystring;
- $ENV{"MINISERV_CONFIG"} = $conf;
- $ENV{"HTTPS"} = "ON" if ($use_ssl);
- $ENV{"SESSION_ID"} = $session_id if ($session_id);
- $ENV{"LOCAL_USER"} = $localauth_user if ($localauth_user);
- if (defined($header{"content-length"})) {
- $ENV{"CONTENT_LENGTH"} = $header{"content-length"};
- }
- if (defined($header{"content-type"})) {
- $ENV{"CONTENT_TYPE"} = $header{"content-type"};
- }
- foreach $h (keys %header) {
- ($hname = $h) =~ tr/a-z/A-Z/;
- $hname =~ s/\-/_/g;
- $ENV{"HTTP_$hname"} = $header{$h};
- }
- $ENV{"PWD"} = $cgi_pwd;
- foreach $k (keys %config) {
- if ($k =~ /^env_(\S+)$/) {
- $ENV{$1} = $config{$k};
- }
- }
- delete($ENV{'HTTP_AUTHORIZATION'});
- $ENV{'HTTP_COOKIE'} =~ s/;?\s*sid=(\d+)//;
-
- # Check if the CGI can be handled internally
- open(CGI, $full);
- local $first = <CGI>;
- close(CGI);
- $first =~ s/[#!\r\n]//g;
- $nph_script = ($full =~ /\/nph-([^\/]+)$/);
- if (!$config{'forkcgis'} && $first eq $perl_path && $] >= 5.004) {
- # setup environment for eval
- chdir($ENV{"PWD"});
- @ARGV = split(/\s+/, $queryargs);
- $0 = $full;
- if ($posted_data) {
- # Already read the post input
- $postinput = $posted_data;
- }
- elsif ($method eq "POST") {
- $clen = $header{"content-length"};
- while(length($postinput) < $clen) {
- $buf = &read_data($clen - length($postinput));
- if (!length($buf)) {
- &http_error(500, "Failed to read ".
- "POST request");
- }
- $postinput .= $buf;
- }
- }
- $SIG{'CHLD'} = 'DEFAULT';
- eval {
- # Have SOCK closed if the perl exec's something
- use Fcntl;
- fcntl(SOCK, F_SETFD, FD_CLOEXEC);
- };
- shutdown(SOCK, 0);
-
- if ($config{'log'}) {
- open(MINISERVLOG, ">>$config{'logfile'}");
- chmod(0600, $config{'logfile'});
- }
- $doing_eval = 1;
- eval {
- package main;
- tie(*STDOUT, 'miniserv');
- tie(*STDIN, 'miniserv');
- do $miniserv::full;
- die $@ if ($@);
- };
- $doing_eval = 0;
- if ($@) {
- # Error in perl!
- &http_error(500, "Perl execution failed", $@);
- }
- elsif (!$doneheaders && !$nph_script) {
- &http_error(500, "Missing Headers");
- }
- #close(SOCK);
- $rv = 0;
- }
- else {
- # fork the process that actually executes the CGI
- pipe(CGIINr, CGIINw);
- pipe(CGIOUTr, CGIOUTw);
- pipe(CGIERRr, CGIERRw);
- if (!($cgipid = fork())) {
- chdir($ENV{"PWD"});
- close(SOCK);
- open(STDIN, "<&CGIINr");
- open(STDOUT, ">&CGIOUTw");
- open(STDERR, ">&CGIERRw");
- close(CGIINw); close(CGIOUTr); close(CGIERRr);
- exec($full, split(/\s+/, $queryargs));
- print STDERR "Failed to exec $full : $!\n";
- exit;
- }
- close(CGIINr); close(CGIOUTw); close(CGIERRw);
-
- # send post data
- if ($posted_data) {
- # already read the posted data
- print CGIINw $posted_data;
- }
- elsif ($method eq "POST") {
- $got = 0; $clen = $header{"content-length"};
- while($got < $clen) {
- $buf = &read_data($clen-$got);
- if (!length($buf)) {
- kill('TERM', $cgipid);
- &http_error(500, "Failed to read ".
- "POST request");
- }
- $got += length($buf);
- print CGIINw $buf;
- }
- }
- close(CGIINw);
- shutdown(SOCK, 0);
-
- if (!$nph_script) {
- # read back cgi headers
- select(CGIOUTr); $|=1; select(STDOUT);
- $got_blank = 0;
- while(1) {
- $line = <CGIOUTr>;
- $line =~ s/\r|\n//g;
- if ($line eq "") {
- if ($got_blank || %cgiheader) { last; }
- $got_blank++;
- next;
- }
- ($line =~ /^(\S+):\s+(.*)$/) ||
- &http_error(500, "Bad Header",
- &read_errors(CGIERRr));
- $cgiheader{lc($1)} = $2;
- }
- if ($cgiheader{"location"}) {
- &write_data("HTTP/1.0 302 Moved Temporarily\r\n");
- &write_data("Date: $datestr\r\n");
- &write_data("Server: $config{'server'}\r\n");
- &write_keep_alive(0);
- # ignore the rest of the output. This is a hack, but
- # is necessary for IE in some cases :(
- close(CGIOUTr); close(CGIERRr);
- }
- elsif ($cgiheader{"content-type"} eq "") {
- &http_error(500, "Missing Content-Type Header",
- &read_errors(CGIERRr));
- }
- else {
- &write_data("HTTP/1.0 $ok_code $ok_message\r\n");
- &write_data("Date: $datestr\r\n");
- &write_data("Server: $config{'server'}\r\n");
- &write_keep_alive(0);
- }
- foreach $h (keys %cgiheader) {
- &write_data("$h: $cgiheader{$h}\r\n");
- }
- &write_data("\r\n");
- }
- &reset_byte_count();
- while($line = <CGIOUTr>) {
- &write_data($line);
- }
- close(CGIOUTr); close(CGIERRr);
- $rv = 0;
- }
- }
-else {
- # A file to output
- local @st = stat($full);
- open(FILE, $full) || &http_error(404, "Failed to open file");
- &write_data("HTTP/1.0 $ok_code $ok_message\r\n");
- &write_data("Date: $datestr\r\n");
- &write_data("Server: $config{server}\r\n");
- &write_data("Content-type: ".&get_type($full)."\r\n");
- &write_data("Content-length: $st[7]\r\n");
- &write_data("Last-Modified: ".&http_date($st[9])."\r\n");
- &write_keep_alive();
- &write_data("\r\n");
- &reset_byte_count();
- while(read(FILE, $buf, 1024) > 0) {
- &write_data($buf);
- }
- close(FILE);
- $rv = &check_keep_alive();
- }
-
-# log the request
-&log_request($acpthost, $authuser, $reqline,
- $cgiheader{"location"} ? "302" : $ok_code, &byte_count());
-return $rv;
-}
-
-# http_error(code, message, body, [dontexit])
-sub http_error
-{
-close(CGIOUT);
-local $eh = $error_handler_recurse ? undef :
- $config{"error_handler_$_[0]"} ? $config{"error_handler_$_[0]"} :
- $config{'error_handler'} ? $config{'error_handler'} : undef;
-if ($eh) {
- # Call a CGI program for the error
- $page = "/$eh";
- $querystring = "code=$_[0]&message=".&urlize($_[1]).
- "&body=".&urlize($_[2]);
- $error_handler_recurse++;
- $ok_code = $_[0];
- $ok_message = $_[1];
- goto rerun;
- }
-else {
- # Use the standard error message display
- &write_data("HTTP/1.0 $_[0] $_[1]\r\n");
- &write_data("Server: $config{server}\r\n");
- &write_data("Date: $datestr\r\n");
- &write_data("Content-type: text/html\r\n");
- &write_keep_alive(0);
- &write_data("\r\n");
- &reset_byte_count();
- &write_data("<h1>Error - $_[1]</h1>\n");
- if ($_[2]) {
- &write_data("<pre>$_[2]</pre>\n");
- }
- }
-&log_request($acpthost, $authuser, $reqline, $_[0], &byte_count())
- if ($reqline);
-shutdown(SOCK, 1);
-exit if (!$_[3]);
-}
-
-sub get_type
-{
-if ($_[0] =~ /\.([A-z0-9]+)$/) {
- $t = $mime{$1};
- if ($t ne "") {
- return $t;
- }
- }
-return "text/plain";
-}
-
-# simplify_path(path, bogus)
-# Given a path, maybe containing stuff like ".." and "." convert it to a
-# clean, absolute form.
-sub simplify_path
-{
-local($dir, @bits, @fixedbits, $b);
-$dir = $_[0];
-$dir =~ s/^\/+//g;
-$dir =~ s/\/+$//g;
-@bits = split(/\/+/, $dir);
-@fixedbits = ();
-$_[1] = 0;
-foreach $b (@bits) {
- if ($b eq ".") {
- # Do nothing..
- }
- elsif ($b eq "..") {
- # Remove last dir
- if (scalar(@fixedbits) == 0) {
- $_[1] = 1;
- return "/";
- }
- pop(@fixedbits);
- }
- else {
- # Add dir to list
- push(@fixedbits, $b);
- }
- }
-return "/" . join('/', @fixedbits);
-}
-
-# b64decode(string)
-# Converts a string from base64 format to normal
-sub b64decode
-{
- local($str) = $_[0];
- local($res);
- $str =~ tr|A-Za-z0-9+=/||cd;
- $str =~ s/=+$//;
- $str =~ tr|A-Za-z0-9+/| -_|;
- while ($str =~ /(.{1,60})/gs) {
- my $len = chr(32 + length($1)*3/4);
- $res .= unpack("u", $len . $1 );
- }
- return $res;
-}
-
-# ip_match(remoteip, localip, [match]+)
-# Checks an IP address against a list of IPs, networks and networks/masks
-sub ip_match
-{
-local(@io, @mo, @ms, $i, $j);
-@io = split(/\./, $_[0]);
-local $hn;
-if (!defined($hn = $ip_match_cache{$_[0]})) {
- $hn = gethostbyaddr(inet_aton($_[0]), AF_INET);
- $hn = "" if ((&to_ipaddress($hn))[0] ne $_[0]);
- $ip_match_cache{$_[0]} = $hn;
- }
-for($i=2; $i<@_; $i++) {
- local $mismatch = 0;
- if ($_[$i] =~ /^(\S+)\/(\S+)$/) {
- # Compare with network/mask
- @mo = split(/\./, $1); @ms = split(/\./, $2);
- for($j=0; $j<4; $j++) {
- if ((int($io[$j]) & int($ms[$j])) != int($mo[$j])) {
- $mismatch = 1;
- }
- }
- }
- elsif ($_[$i] =~ /^\*(\S+)$/) {
- # Compare with hostname regexp
- $mismatch = 1 if ($hn !~ /$1$/);
- }
- elsif ($_[$i] eq 'LOCAL') {
- # Compare with local network
- local @lo = split(/\./, $_[1]);
- if ($lo[0] < 128) {
- $mismatch = 1 if ($lo[0] != $io[0]);
- }
- elsif ($lo[0] < 192) {
- $mismatch = 1 if ($lo[0] != $io[0] ||
- $lo[1] != $io[1]);
- }
- else {
- $mismatch = 1 if ($lo[0] != $io[0] ||
- $lo[1] != $io[1] ||
- $lo[2] != $io[2]);
- }
- }
- else {
- # Compare with IP or network
- @mo = split(/\./, $_[$i]);
- while(@mo && !$mo[$#mo]) { pop(@mo); }
- for($j=0; $j<@mo; $j++) {
- if ($mo[$j] != $io[$j]) {
- $mismatch = 1;
- }
- }
- }
- return 1 if (!$mismatch);
- }
-return 0;
-}
-
-# restart_miniserv()
-# Called when a SIGHUP is received to restart the web server. This is done
-# by exec()ing perl with the same command line as was originally used
-sub restart_miniserv
-{
-close(SOCK); close(MAIN);
-foreach $p (@passin) { close($p); }
-foreach $p (@passout) { close($p); }
-if ($logclearer) { kill('TERM', $logclearer); }
-exec($perl_path, $miniserv_path, @miniserv_argv);
-die "Failed to restart miniserv with $perl_path $miniserv_path";
-}
-
-sub trigger_restart
-{
-$need_restart = 1;
-}
-
-sub to_ipaddress
-{
-local (@rv, $i);
-foreach $i (@_) {
- if ($i =~ /(\S+)\/(\S+)/ || $i =~ /^\*\S+$/ ||
- $i eq 'LOCAL') { push(@rv, $i); }
- else { push(@rv, join('.', unpack("CCCC", inet_aton($i)))); }
- }
-return @rv;
-}
-
-# read_line()
-# Reads one line from SOCK or SSL
-sub read_line
-{
-local($idx, $more, $rv);
-if ($use_ssl) {
- while(($idx = index($read_buffer, "\n")) < 0) {
- # need to read more..
- if (!($more = Net::SSLeay::read($ssl_con))) {
- # end of the data
- $rv = $read_buffer;
- undef($read_buffer);
- return $rv;
- }
- $read_buffer .= $more;
- }
- $rv = substr($read_buffer, 0, $idx+1);
- $read_buffer = substr($read_buffer, $idx+1);
- return $rv;
- }
-else { return <SOCK>; }
-}
-
-# read_data(length)
-# Reads up to some amount of data from SOCK or the SSL connection
-sub read_data
-{
-if ($use_ssl) {
- local($rv);
- if (length($read_buffer)) {
- $rv = $read_buffer;
- undef($read_buffer);
- return $rv;
- }
- else {
- return Net::SSLeay::read($ssl_con, $_[0]);
- }
- }
-else {
- local $buf;
- read(SOCK, $buf, $_[0]) || return undef;
- return $buf;
- }
-}
-
-# write_data(data)
-# Writes a string to SOCK or the SSL connection
-sub write_data
-{
-if ($use_ssl) {
- Net::SSLeay::write($ssl_con, $_[0]);
- }
-else {
- syswrite(SOCK, $_[0], length($_[0]));
- }
-$write_data_count += length($_[0]);
-}
-
-# reset_byte_count()
-sub reset_byte_count { $write_data_count = 0; }
-
-# byte_count()
-sub byte_count { return $write_data_count; }
-
-# log_request(hostname, user, request, code, bytes)
-sub log_request
-{
-if ($config{'log'}) {
- local(@tm, $dstr, $user, $ident, $headers);
- if ($config{'logident'}) {
- # add support for rfc1413 identity checking here
- }
- else { $ident = "-"; }
- @tm = localtime(time());
- $dstr = sprintf "%2.2d/%s/%4.4d:%2.2d:%2.2d:%2.2d %s",
- $tm[3], $make_date_marr[$tm[4]], $tm[5]+1900,
- $tm[2], $tm[1], $tm[0], $timezone;
- $user = $_[1] ? $_[1] : "-";
- if (fileno(MINISERVLOG)) {
- seek(MINISERVLOG, 0, 2);
- }
- else {
- open(MINISERVLOG, ">>$config{'logfile'}");
- chmod(0600, $config{'logfile'});
- }
- foreach $h (split(/\s+/, $config{'logheaders'})) {
- $headers .= " $h=\"$header{$h}\"";
- }
- print MINISERVLOG "$_[0] $ident $user [$dstr] \"$_[2]\" ",
- "$_[3] $_[4]$headers\n";
- close(MINISERVLOG);
- }
-}
-
-# read_errors(handle)
-# Read and return all input from some filehandle
-sub read_errors
-{
-local($fh, $_, $rv);
-$fh = $_[0];
-while(<$fh>) { $rv .= $_; }
-return $rv;
-}
-
-sub write_keep_alive
-{
-local $mode;
-if (@_) { $mode = $_[0]; }
-else { $mode = &check_keep_alive(); }
-&write_data("Connection: ".($mode ? "Keep-Alive" : "close")."\r\n");
-}
-
-sub check_keep_alive
-{
-return $header{'connection'} =~ /keep-alive/i;
-}
-
-sub term_handler
-{
-if (@childpids) {
- kill('TERM', @childpids);
- }
-exit(1);
-}
-
-sub http_date
-{
-local @tm = gmtime($_[0]);
-return sprintf "%s, %d %s %d %2.2d:%2.2d:%2.2d GMT",
- $weekday[$tm[6]], $tm[3], $month[$tm[4]], $tm[5]+1900,
- $tm[2], $tm[1], $tm[0];
-}
-
-sub TIEHANDLE
-{
-my $i; bless \$i, shift;
-}
-
-sub WRITE
-{
-$r = shift;
-my($buf,$len,$offset) = @_;
-&write_to_sock(substr($buf, $offset, $len));
-}
-
-sub PRINT
-{
-$r = shift;
-$$r++;
-&write_to_sock(@_);
-}
-
-sub PRINTF
-{
-shift;
-my $fmt = shift;
-&write_to_sock(sprintf $fmt, @_);
-}
-
-sub READ
-{
-$r = shift;
-substr($_[0], $_[2], $_[1]) = substr($postinput, $postpos, $_[1]);
-$postpos += $_[1];
-}
-
-sub OPEN
-{
-print STDERR "open() called - should never happen!\n";
-}
-
-sub READLINE
-{
-if ($postpos >= length($postinput)) {
- return undef;
- }
-local $idx = index($postinput, "\n", $postpos);
-if ($idx < 0) {
- local $rv = substr($postinput, $postpos);
- $postpos = length($postinput);
- return $rv;
- }
-else {
- local $rv = substr($postinput, $postpos, $idx-$postpos+1);
- $postpos = $idx+1;
- return $rv;
- }
-}
-
-sub GETC
-{
-return $postpos >= length($postinput) ? undef
- : substr($postinput, $postpos++, 1);
-}
-
-sub CLOSE { }
-
-sub DESTROY { }
-
-# write_to_sock(data, ...)
-sub write_to_sock
-{
-foreach $d (@_) {
- if ($doneheaders || $miniserv::nph_script) {
- &write_data($d);
- }
- else {
- $headers .= $d;
- while(!$doneheaders && $headers =~ s/^(.*)(\r)?\n//) {
- if ($1 =~ /^(\S+):\s+(.*)$/) {
- $cgiheader{lc($1)} = $2;
- }
- elsif ($1 !~ /\S/) {
- $doneheaders++;
- }
- else {
- &http_error(500, "Bad Header");
- }
- }
- if ($doneheaders) {
- if ($cgiheader{"location"}) {
- &write_data(
- "HTTP/1.0 302 Moved Temporarily\r\n");
- &write_data("Date: $datestr\r\n");
- &write_data("Server: $config{server}\r\n");
- &write_keep_alive(0);
- }
- elsif ($cgiheader{"content-type"} eq "") {
- &http_error(500, "Missing Content-Type Header");
- }
- else {
- &write_data("HTTP/1.0 $ok_code $ok_message\r\n");
- &write_data("Date: $datestr\r\n");
- &write_data("Server: $config{server}\r\n");
- &write_keep_alive(0);
- }
- foreach $h (keys %cgiheader) {
- &write_data("$h: $cgiheader{$h}\r\n");
- }
- &write_data("\r\n");
- &reset_byte_count();
- &write_data($headers);
- }
- }
- }
-}
-
-sub verify_client
-{
-local $cert = Net::SSLeay::X509_STORE_CTX_get_current_cert($_[1]);
-if ($cert) {
- local $errnum = Net::SSLeay::X509_STORE_CTX_get_error($_[1]);
- $verified_client = 1 if (!$errnum);
- }
-return 1;
-}
-
-sub END
-{
-if ($doing_eval) {
- # A CGI program called exit! This is a horrible hack to
- # finish up before really exiting
- close(SOCK);
- &log_request($acpthost, $authuser, $reqline,
- $cgiheader{"location"} ? "302" : $ok_code, &byte_count());
- }
-}
-
-# urlize
-# Convert a string to a form ok for putting in a URL
-sub urlize {
- local($tmp, $tmp2, $c);
- $tmp = $_[0];
- $tmp2 = "";
- while(($c = chop($tmp)) ne "") {
- if ($c !~ /[A-z0-9]/) {
- $c = sprintf("%%%2.2X", ord($c));
- }
- $tmp2 = $c . $tmp2;
- }
- return $tmp2;
-}
-
-# validate_user(username, password)
-sub validate_user
-{
-return 0 if (!$_[0] || !$users{$_[0]});
-if ($users{$_[0]} eq 'x' && $use_pam) {
- $pam_username = $_[0];
- $pam_password = $_[1];
- local $pamh = new Authen::PAM("miniserv", $pam_username, \&pam_conv_func);
- if (!ref($pamh)) {
- print STDERR "PAM init failed : $pamh\n";
- return 0;
- }
- local $pam_ret = $pamh->pam_authenticate();
- return $pam_ret == PAM_SUCCESS ? 1 : 0;
- }
-else {
- return $users{$_[0]} eq crypt($_[1], $users{$_[0]}) ? 1 : 0;
- }
-}
-
-# the PAM conversation function for interactive logins
-sub pam_conv_func
-{
-my @res;
-while ( @_ ) {
- my $code = shift;
- my $msg = shift;
- my $ans = "";
-
- $ans = $pam_username if ($code == PAM_PROMPT_ECHO_ON() );
- $ans = $pam_password if ($code == PAM_PROMPT_ECHO_OFF() );
-
- push @res, PAM_SUCCESS();
- push @res, $ans;
- }
-push @res, PAM_SUCCESS();
-return @res;
-}
-
diff --git a/perl-install/standalone/interactive_http/miniserv.users b/perl-install/standalone/interactive_http/miniserv.users
deleted file mode 100644
index f7338497a..000000000
--- a/perl-install/standalone/interactive_http/miniserv.users
+++ /dev/null
@@ -1 +0,0 @@
-root:x:0
diff --git a/perl-install/standalone/keyboarddrake b/perl-install/standalone/keyboarddrake
deleted file mode 100755
index 0ac98cb49..000000000
--- a/perl-install/standalone/keyboarddrake
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use keyboard;
-use Xconfigurator_consts;
-use common;
-use c;
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-local $_ = join '', @ARGV;
-
-/-h/ and die _("usage: keyboarddrake [--expert] [keyboard]\n");
-
-$::expert = /-expert/;
-
-print "[$::expert]\n";
-my $keyboard='';
-if ($::expert) { ($keyboard) = grep { !/^-/ } @ARGV;}
-print "[$keyboard]\n";
-my $in = 'interactive'->vnew('su', 'keyboard');
-
-begin:
-$::isEmbedded and kill USR2, $::CCPID;
-$keyboard ||= $in->ask_from_listf_(_("Keyboard"),
- _("Please, choose your keyboard layout."),
- \&keyboard::keyboard2text,
- [ keyboard::keyboards() ],
- keyboard::read());
-if ($keyboard) {
- keyboard::keyboard2text($keyboard) or die "bad keyboard $keyboard\n";
-
- my $isNotDelete = $::expert && !$in->ask_yesorno("BackSpace", _("Do you want the BackSpace to return Delete in console?"), 1);
-
- my $kmap = keyboard::keyboard2kmap($keyboard);
- system('loadkeys', $kmap);
-
- my $xkb = keyboard::keyboard2xkb($keyboard);
- system('setxkbmap', $xkb);
-
- my $f = "/etc/X11/XF86Config";
- my $g = "/etc/X11/XF86Config-4";
-
- substInFile {
- if (/^Section\s+"Keyboard"/ .. /^EndSection/) {
- s|^(\s*XkbLayout\s+).*|$1"$xkb"|
- and $_ .= join '', map { " $_\n" } @{$Xconfigurator::xkb_options{$xkb} || []};
- $_ = '' if m,^(\s*(XkbVariant|XkbOptions)\s+),; # remove existing one
- }
- } $f if -e $f && !$::testing;
-
- substInFile {
- if (/Identifier\s+"Keyboard1"/ .. /^EndSection/) {
- s|^(\s*Option\s+"XkbLayout"\s+).*|$1"$xkb"|
- and $_ .= join '', map { /(\S+)(.*)/; qq( Option "$1" $2\n) } @{$Xconfigurator::xkb_options{$xkb} || []};
- $_ = '' if m,^(\s*Option\s+"(XkbVariant|XkbOptions)"\s+),; # remove existing one
- }
- } $g if -e $g && !$::testing;
-
- keyboard::write('', $keyboard, $isNotDelete);
-}
-
-if ($::isEmbedded) {
- kill(USR1, $::CCPID);
- $keyboard = '';
- goto begin;
-} else {
- $in->exit(0);
-}
diff --git a/perl-install/standalone/livedrake b/perl-install/standalone/livedrake
deleted file mode 100755
index 9c2af4c03..000000000
--- a/perl-install/standalone/livedrake
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use common;
-use interactive;
-use run_program;
-use c;
-
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: livedrake [--testing]\n";
-
-$::testing = /-testing/;
-
-my $in = 'interactive'->vnew('su', 'default');
-
-my $cd_mntpoint = "/mnt/cdrom";
-
-while (! -x "$cd_mntpoint/Mandrake/mdkinst/usr/bin/perl-install/live_install") {
- ejectCdrom();
- $in->ask_okcancel(_("Change Cd-Rom"),
-_("Please insert the Installation Cd-Rom in your drive and press Ok when done.
-If you don't have it, press Cancel to avoid live upgrade."), 1) or $in->exit(0);
- run_program::run("mount", "/mnt/cdrom");
-}
-
-if (-x "$cd_mntpoint/Mandrake/mdkinst/usr/bin/perl-install/live_install") {
- chdir "/$cd_mntpoint/Mandrake/mdkinst/usr/bin/perl-install/";
- $::testing or exec "./live_install";
-}
-
-$in->ask_warn('', _("Unable to start live upgrade !!!\n"));
-$in->exit(1);
-
-sub ejectCdrom {
- my ($cdrom) = @_;
- $cdrom or cat_("/proc/mounts") =~ m|(/dev/\S+)\s+/mnt/cdrom\s| and $cdrom = $1;
- $cdrom or cat_("/etc/fstab") =~ m|(/dev/\S+)\s+/mnt/cdrom\s| and $cdrom = $1;
- my $f = eval { $cdrom && detect_devices::tryOpen($cdrom) } or return;
- run_program::run("umount", "/mnt/cdrom");
- ioctl $f, c::CDROM_LOCKDOOR(), 0;
- ioctl $f, c::CDROMEJECT(), 1;
-}
diff --git a/perl-install/standalone/localedrake b/perl-install/standalone/localedrake
deleted file mode 100644
index ef72f498e..000000000
--- a/perl-install/standalone/localedrake
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use lang;
-use any;
-
-my ($klang, $country, $apply);
-
-foreach (@ARGV) {
- $apply = /--apply/;
- $klang = $1 if /--kde_lang=(.*)/;
- $country = $1 if /--kde_country=(.*)/;
-}
-if ($klang) {
- my $lang = lang::kde_lang_country2lang($klang, $country);
- lang::write('', $lang, $>, 'dont_touch_kde_files') if $apply;
-
- #- help KDE defaulting to the right charset
- print lang::charset2kde_charset(lang::lang2charset($lang)), "\n";
-} else {
- my ($lang) = lang::read('', $>);
-
- my $in = 'interactive'->vnew;
- if ($lang = any::selectLanguage($in, $lang)) {
- lang::write('', $lang, $>);
- if ($>) {
- if (my $wm = any::running_window_manager()) {
- $in->ask_okcancel('', _("The change is done, but to be effective you must logout"), 1)
- && any::ask_window_manager_to_logout($wm);
- }
- }
- }
- $in->exit(0);
-}
-
-
diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake
deleted file mode 100755
index 3d9c2b8ab..000000000
--- a/perl-install/standalone/logdrake
+++ /dev/null
@@ -1,681 +0,0 @@
-#! /usr/bin/perl
-# $Id$
-
-# Copyright (C) 2001 MandrakeSoft
-# Yves Duret <yduret at mandrakesoft.com>
-# some code is Copyright: (C) 1999, Michael T. Babcock <mikebabcock@pobox.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 POSIX;
-use Gtk;
-use lib qw(/usr/lib/libDrakX);
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use any;
-use Config;
-init Gtk;
-Gtk->set_locale;
-use my_gtk qw(:helpers :wrappers);
-
-use MDK::Common;
-use Data::Dumper;
-#-------------------------------------------------------------
-# i18n routines
-# IMPORTANT: next two routines have to be redefined here to
-# get correct namespace (drakconf instead of libDrakX)
-# (This version is now UTF8 compliant - Sg 2001-08-18)
-#-------------------------------------------------------------
-
-{
- no warnings;
- sub _ {
- my $s = shift @_; my $t = translate($s);
- sprintf $t, @_;
- }
-
- no warnings;
- sub translate {
- my ($s) = @_;
- $s ? c::dgettext('drakconf', $s) : '';
- }
-}
-
-$::isInstall and die "Not supported during install.\n";
-
-my $in = 'interactive'->vnew('su', 'default');
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-if ($::isEmbedded) {
- print "EMBED\n";
- print "parent XID\t$::XID\n";
- print "mcc pid\t$::CCPID\n";
-}
-
-#- parse arguments list.
-for (@ARGV) {
- /^--version$/ and die 'version: $Id$ '."\n";
- /^--help$/ and die 'logdrake [--version] [--file=myfyle] [--word=myword] [--explain=regexp] [--alert]';
- /^--explain=(.*)$/ and do { $::isExplain = ($::Explain) = $1; $::isFile=1; $::File="/var/log/explanations"; next };
- /^--file=(.*)$/ and do { $::isFile = ($::File) = $1; next };
- /^--word=(.*)$/ and do { $::isWord = ($::Word) = $1; next };
- /^--alert$/ and do { alert_config(); quit(); };
-}
-
-$::isTail=1 if ($::isFile);
-$|= 1 if ($::isTail);
-my $h=chomp_(`hostname -s`);
-
-my $window = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
-$window->signal_connect( delete_event => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0) });
-$window->set_title( _("logdrake") );
-$window->set_policy(1, 1, 1);
-$window->border_width (5) unless ($::isEmbedded);
-#$window->set_default_size( 540,460 );
-
-my $cal = gtkset_sensitive(new Gtk::Calendar(),0);
-my (undef,undef,undef,$mday) = localtime(time);
-$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 Gtk::CheckButton(_("Show only for the selected day")), clicked =>sub{$cal_mode =!$cal_mode; gtkset_sensitive($cal,$cal_mode);});
-
-### menus definition
-# the menus are not shown
-# but they provides shiny shortcut like C-q
-my @menu_items = (
- { path => _("/_File"), type => '<Branch>' },
- { path => _("/File/_New"), accelerator => _("<control>N"), callback => \&print_hello },
- { path => _("/File/_Open"), accelerator => _("<control>O"),callback => \&print_hello },
- { path => _("/File/_Save"), accelerator => _("<control>S"),callback => \&save },
- { path => _("/File/Save _As") },
- { path => _("/File/-"),type => '<Separator>' },
- { path => _("/File/_Quit"), accelerator => _("<control>Q"), callback => \&quit },
- { path => _("/_Options"), type => '<Branch>' },
- { path => _("/Options/Test") },
- { path => _("/_Help"),type => '<LastBranch>' },
- { path => _("/Help/_About...") }
- );
-my $menubar = get_main_menu( $window );
-######### menus end
-
-
-########## font and colors
-my $n = Gtk::Gdk::Font->fontset_load(_("-misc-fixed-medium-r-*-*-*-100-*-*-*-*-*-*,*"));
-my $b = Gtk::Gdk::Font->fontset_load(_("-misc-fixed-bold-r-*-*-*-100-*-*-*-*-*-*,*"));
-
-#$black = "\033[30m";
-#$red = "\033[31m";
-#$green = "\033[32m";
-#$yellow = "\033[33m";
-#$blue = "\033[34m";
-#$magenta = "\033[35m";
-#$purple = "\033[35m";
-#$cyan = "\033[36m";
-#$white = "\033[37m";
-#$darkgray = "\033[30m";
-#$col_norm = "\033[00m";
-#$col_background = "\033[07m";
-#$col_brighten = "\033[01m";
-#$col_underline = "\033[04m";
-#$col_blink = "\033[05m";
-
-my $white = my_gtk::gtkcolor(50400, 655, 20000);
-my $black = my_gtk::gtkcolor(0, 0, 0);
-my $red = my_gtk::gtkcolor(0xFFFF, 655, 655);
-my $green = my_gtk::gtkcolor(0x0, 0x9898,0x0);
-my $yellow = my_gtk::gtkcolor(0xFFFF, 0xD7D7, 0);
-my $blue = my_gtk::gtkcolor(655, 655, 0xFFFF);
-my $magenta = my_gtk::gtkcolor(0xFFFF, 655, 0xFFFF);
-my $purple = my_gtk::gtkcolor(0xA0A0, 0x2020, 0xF0F0);
-my $cyan = my_gtk::gtkcolor(0x0, 0x9898, 0x9898);
-my $darkgray = my_gtk::gtkcolor(0x2F2F, 0x4F4F, 0x4F4F);
-
-
-# Define global terms:
-# Define good notables:
-my @word_good=("starting\n", "Freeing", "Detected", "starting.", "accepted.\n", "authenticated.\n", "Ready", "active", "reloading", "saved;", "restarting", "ONLINE\n");
-my @word_warn=("dangling", "closed.\n", "Assuming", "root", "root\n", "exiting\n", "missing", "Ignored", "adminalert:", "deleting", "OFFLINE\n");
-my @word_bad=("bad");
-my @word_note=("LOGIN", "DHCP_OFFER", "optimized", "reset:", "unloaded", "disconnected", "connect", "Successful", "registered\n");
-my @line_good=("up", "DHCP_ACK", "Cleaned", "Initializing", "Starting", "success", "successfully", "alive", "found", "ONLINE\n");
-my @line_warn=("warning:", "WARNING:", "invalid", "obsolete", "bad", "Password", "detected", "timeout", "timeout:", "attackalert:", "wrong", "Lame", "FAILED", "failing", "unknown", "obsolete", "stopped.\n", "terminating.", "disabled\n", "disabled", "Lost");
-my @line_bad=("DENY", "lost", "shutting", "dead", "DHCP_NAK", "failure;", "Unable", "inactive", "terminating", "refused", "rejected", "down", "OFFLINE\n", "error\n", "ERROR\n", "ERROR:", "error", "ERROR", "error:", "failed:");
-
-# Define specifics:
-my @daemons=("named");
-
-# Now define what we want to use when:
-my $col_good = $green;
-my $col_warn = $yellow;
-my $col_bad = $red;
-my $col_note = $purple;
-my $col=$cyan;
-
-######### font and colors end
-
-my %files = (
- "auth" => { file => "/var/log/auth.log", desc => _("Authentication") },
- "user" => { file => "/var/log/user.log", desc => _("User") },
- "messages" => { file => "/var/log/messages", desc => _("Messages") },
- "syslog" => { file => "/var/log/syslog", desc => _("Syslog") },
- "explanations" => { file => "/var/log/explanations", desc => _("Mandrake Tools Explanations")}
-);
-
-my $yy=gtkset_sensitive(gtksignal_connect(new Gtk::Button(_("search")) , clicked => \&search),0);
-my $log_text = new Gtk::Text(undef, undef);
-my $refcount_search;
-#### far from window
-gtkadd($window,
- gtkpack_(new Gtk::VBox(0,5),
- if_(!$::isExplain, 0, _("A tool to monitor your logs")),
- if_(!$::isFile, 0, gtkadd(new Gtk::Frame(_("Settings")),
- gtkpack__(new Gtk::VBox(0,2),
- gtkpack__(new Gtk::VBox(0,2),
- # _("Show lines"),
- gtkpack__(new Gtk::HBox(0,0),
- " " . _("matching") . " ", $e_yes = new Gtk::Entry(),
- " " . _("but not matching") . " ", $e_no = new Gtk::Entry()
- )
- ),
- gtkpack_(new Gtk::HBox(0,0),
- 1, gtkadd(gtkset_border_width(new Gtk::Frame(_("Choose file")),2),
- gtkpack (gtkset_border_width(new Gtk::VBox(0,0),0),
- map { ${"b_". $_} = gtksignal_connect(new Gtk::CheckButton($files{$_}{desc}), clicked=> sub{$refcount_search++;gtkset_sensitive($yy,$refcount_search)}) } keys %files,
- )
- ),
- 0, gtkadd(gtkset_border_width(new Gtk::Frame(_("Calendar")),2),
- gtkpack__(gtkset_border_width(new Gtk::VBox(0,0),5),
- $cal_butt, $cal
- )
- )
- ),
- $yy,
- )
- )
- ),
- !$::isExplain ? (1, gtkadd(new Gtk::Frame(_("Content of the file")),
- createScrolledWindow($log_text)
- )) : (1, $log_text),
- if_(!$::isExplain, 0, gtkadd (gtkset_border_width(gtkset_layout(new Gtk::HButtonBox,-end), 5),
- if_ (!$::isFile, gtksignal_connect(new Gtk::Button (_("Mail/SMS alert")), clicked => sub {eval {alert_config()};
- if ($@ =~ /wizcancel/) {
- $::Wizard_no_previous = 1;
- $::Wizard_no_cancel = 1;
- #$::Wizard_finished = 1;
-# undef $::isWizard;
- $::WizardWindow->destroy if defined $::WizardWindow;
- undef $::WizardWindow;
-}; })),
- gtksignal_connect(new Gtk::Button (_("Save")), clicked => \&save),
- gtksignal_connect(new Gtk::Button ($::isEmbedded ? _("Cancel") : _("Quit")), clicked => \&quit)
- )
- )
- )
-
- );
-
-$::isFile and gtkset_usize($log_text,400,500);
-$window->realize;
-$window->show_all();
-search() if ($::isFile);
-#Gtk->main_iteration while Gtk->events_pending;
-$::isEmbedded and kill 'USR2', $::CCPID;
-Gtk->main;
-
-sub quit {
-$::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0);
-}
-
-#-------------------------------------------------------------
-# search functions
-#-------------------------------------------------------------
-sub search {
- $log_text->backward_delete($log_text->get_length());
- $log_text->freeze();
- if ($::isFile) {
- parse_file($::File);
- } else {
- foreach (keys %files) {
- parse_file($files{$_}{file}) if ${$::{"b_". $_}}->active
- };
- }
- $log_text->thaw();
- Gtk->main_iteration while Gtk->events_pending;
-}
-
-sub parse_file {
- my $file = $_[0];
-
- $file =~ s/\.gz$//;
- my $i=0;
- gtkadd(my $win_pb = (gtkset_modal new Gtk::Window(), 1),
- gtkpack(new Gtk::VBox(5,0),
- " " . _("please wait, parsing file: %s", $files{$_}{desc}) . " ",
- my $pbar = new Gtk::ProgressBar()
- )
- );
- $win_pb->set_position('center');
- $win_pb->realize();
- $win_pb->show_all();
- my $ey = $e_yes->get_chars(0, -1);
- my $en = $e_no->get_chars(0, -1);
- $ey =~ s/ OR /\|/;
- $ey =~ s/^\*$//;
- $en =~ s/^\*$/.*/;
- $ey = $ey .($::Word) if ($::isWord);
-
- if ($cal_mode) {
- my ($year, $month, $day) = $cal->get_date();
- $ey= $months[$month]."\\s{1,2}$day\\s.*$ey.*\n";
- }
-
- my @all=catMaybeCompressed ($file);
-
- if ($::isExplain) {
- my (@t, $t);
- while (@all) {
- $t = pop @all;
- next if ($t =~ /logdrake/);
- last if !($t =~ /$::Explain/);
- push @t, $t;
- }
- @all=reverse @t;
- }
-
- my $taille= @all;
- foreach (@all) {
- $i++;
- if ($i % 10) {
- $pbar->update($i/$taille);
- Gtk->main_iteration while Gtk->events_pending;
- }
-
- if (($en eq "") and /$ey/i) {logcolorize($_); next}
- if ((! /$en/i) and /$ey/i) {logcolorize($_); next}
- if ((! /$en/i) and ($ey eq "")) {logcolorize($_); next}
- }
- $win_pb->destroy();
-
- if ($::isTail) {
- open F, $file or die "E: $!";
- while (<F>) {}; #to prevent to output the file twice..
- $log_text->set_point($log_text->get_length());
- my $timer = Gtk->timeout_add( 1000, \&input_callback);
- }
-}
-
-sub input_callback {
- logcolorize($_) while <F>;
- seek F, 0, 1;
-}
-
-
-##########################################################################################
-
-sub logcolorize {
-
- # we get date & time if it is date & time (dmesg)
- s/(\D{3} .. \d\d:\d\d:\d\d )//;
- $timestamp=$1;
- @rec = split;
-
- log_output($cyan,$timestamp,$b); # date & time if any...
- log_output(($rec[0] eq $h) ? $blue : $col,"$rec[0] ",$b); # hostname
-
- if ($rec[1] eq "last") {
- log_output($green," last message repeated ",$n);
- log_output($green, $rec[4], $b);
- log_output($green," times\n",$n);
- return;
- }
- # Extract PID if present
- if ($rec[1] =~ /\[(\d+)\]\:/) {
- my($pid) = $1;
- $rec[1]=~s/\[$1\]\:// ;
- log_output ($green, $rec[1] ."[",$n);
- log_output ($black, $pid,$b);
- log_output ($green, "]: ",$n);
- }
- else {
- log_output($green, $rec[1] ." ",$n);
- }
-
-
- for ($therest=(2); $therest<=$#rec; $therest++) {
- $col=$cyan;
-
- # Check for keywords to highlight
- foreach (@word_good) { $col=$col_good if ($_ eq $rec[$therest]);}
- foreach (@word_warn) { $col=$col_warn if ($_ eq $rec[$therest]);}
- foreach (@word_bad) { $col=$col_bad if ($_ eq $rec[$therest]);}
- foreach (@word_note) { $col=$col_note if ($_ eq $rec[$therest]);}
-
- # Watch for words that indicate entire lines should be highlighted
- #foreach (@line_good) { $col=$col_good if ($_ eq $rec[$therest]);}
- #foreach (@line_warn) { $col=$col_warn if ($_ eq $rec[$therest]);}
- #foreach (@line_bad) { $col=$col_bad if ($_ eq $rec[$therest]);}
-
- log_output($col,"$rec[$therest] ",$n);
- }
- log_output($black,"\n",$n);
-}
-
-
-sub log_output {
- $log_text->insert($_[2],$_[0], undef,$_[1]);
-}
-
-
-#-------------------------------------------------------------
-# mail/sms alert
-#-------------------------------------------------------------
-
-sub alert_config {
-
- $::isWizard = 1;
- $::Wizard_pix_up = "wiz_drakgw.png"; # FIXME
- $::Wizard_title = _("Mail/SMS alert");
-
-my $cron =q(#!/usr/bin/perl
-# generated by logdrake
-use MDK::Common;
-my $r= "*** ". chomp_(`date`) . " ***\n";
-
-);
-
- my ($load,$mail,$email,$smtp,$sms,$smssend);
- $load=3;
-
- begin:
- $::Wizard_finished = 0;
- $::Wizard_no_previous = 1;
- $in->ask_okcancel(_("Mail/SMS alert configuration"),
- _("Welcome to the mail/SMS configuration utility.\n\nHere, you'll be able to set up the alert system.\n"),
- 1) or quit();
-
- step_service:
- undef $::Wizard_no_previous;
- my $l ={
- http => ["/etc/init.d/httpd", _("Apache is a World Wide Web server. It is used to serve HTML files and CGI."), '$r .= "Apache is not running\n" if (`[ -x /etc/init.d/httpd ] && LC_ALL=C /etc/init.d/httpd status` =~ /\*not\* running/);'],
- bind => ["/etc/init.d/named", _("named (BIND) is a Domain Name Server (DNS) that is used to resolve host names to IP addresses."), ],
- ftp => ["/etc/init.d/proftpd", _("proftpd"), '$r .= "FTP server (proftpd) is not running\n" unless (`[ -x /etc/init.d/proftpd ] && /etc/init.d/proftpd status 2>&1 > /dev/null`);'],
- postfix => ["/etc/init.d/postfix", _("Postfix is a Mail Transport Agent, which is the program that moves mail from one machine to another."), '$r .= "Postfix is not running\n" unless (`[ -x /etc/init.d/postfix ] && LC_ALL=C /etc/init.d/postfix status`);'],
- samba => ["/etc/init.d/smb", ("samba"), '$r .= "samba is not running\n" unless (`[ -x /etc/init.d/smb ] && LC_ALL=C /etc/init.d/smb status`);'],
- sshd => ["/etc/init.d/sshd", _("sshd"), '$r .= "sshd is not running\n" unless (`[ -x /etc/init.d/sshd ] && LC_ALL=C /etc/init.d/sshd status`);'],
- webmin => ["/etc/init.d/webmin", _("webmin"), '$r .= "webmin is not running\n" unless (`[ -x /etc/init.d/webmin ] && LC_ALL=C /etc/init.d/webmin status`);'],
- xinetd=> ["/etc/init.d/xinetd", _("xinetd"), '$r .= "xinetd is not running\n" unless (`[ -x /etc/init.d/xinetd ] && LC_ALL=C /etc/init.d/yxinetd status`);'],
- };
-
- $in->ask_from(_("service setting"),
- _("You will receive an alert if one of the selected service is no more running"),
- [ map { {label => "$_", val=> \${$_}, type => "bool", text => "$l->{$_}[1]" }; } keys %$l
- ]) or goto begin;
-
- $cron .= "#- check services\n";
- for (keys %$l) {
- $cron .= $l->{$_}[2]."\n" if (${$_});
- }
-
- step_load:
- $in->ask_from(_("load setting"),
- _("You will receive an alert if the load is higher than this value"),
- [
- { label => "load ", val => \$load, type => 'range', min => 1, max => 50 },
- ]) or goto step_service;
-
- $cron .= q@
-#- load
-my ($load) = split ' ', first(cat_("/proc/loadavg"));
-$r .= "Load is huge: $load\n" if ($load >@ . "$load);\n\n";
-
- step_output:
- $::Wizard_no_previous = 1;
- $::Wizard_finished = 1;
- $in->ask_from(_("alert configuration"),
- _("Configure the way the system will alert you"),
- [
- { label => "mail", val => \$mail, type => "bool", text => "mail output" },
- { label => "email", val => \$email, disabled => sub { !$mail; }},
- #{ label => "smtp", val => \$smtp, disabled => sub { !$mail; } },
- { label => "" },
- { label => "sms output", val => \$sms, type => "bool", text => "You need to have smsend set up (works only for some countries)" },
- { label => "smssend output", val => \$smssend , disabled => sub {!$sms;}},
- ]) or goto step_load;
-
-#output("/etc/cron.hourly/logdrake_alert.pl", ($cron));
- $cron .= q@#- report it@;
- if ($mail) {
- $cron .= q!
-open F, '|/usr/sbin/sendmail -oi -t';
-
-print F
-q(Subject: logdrake Mail Alert
-From: root@localhost
-To: ), "$email\n";
-print F $r;
-
-# EOF!;
- } elsif ($sms) {
- $in->do_pkgs->install('smssend');
- $cron .= q!system(smssend !, $smssend, q! chomp_(`date`));!
- }
-
- undef $::isWizard;
- $::WizardWindow->destroy if defined $::WizardWindow;
- undef $::WizardWindow;
-
-}
-
-
-#-------------------------------------------------------------
-# menu callback functions
-#-------------------------------------------------------------
-
-
-sub save {
- #$file_dialog = new Gtk::FileSelection(_("Save as.."));
- #$file_dialog->show();
- $yy= $in->ask_file(_("Save as.."),"/root") or return;
- output($yy,$log_text->get_chars(0,$log_text->get_length()));
-}
-
-sub print_hello {
- print "mcdtg !\n";
-}
-
-sub get_main_menu {
- my ($window) = @_;
-
- my $accel_group = new Gtk::AccelGroup();
- my $item_factory = new Gtk::ItemFactory( 'Gtk::MenuBar', '<main>', $accel_group );
- $item_factory->create_items( @menu_items );
- $window->add_accel_group( $accel_group );
- return ( $item_factory->get_widget( '<main>' ) );
-}
-
-sub create_dialog {
- my ($label, $c) = @_;
- my $ret = 0;
- my $dialog = new Gtk::Dialog;
- $dialog->signal_connect ( delete_event => sub {Gtk->main_quit();});
- $dialog->set_title(_("logdrake"));
- $dialog->border_width(10);
- $dialog->vbox->pack_start(new Gtk::Label($label),1,1,0);
-
- my $button = new Gtk::Button _("OK");
- $button->can_default(1);
- $button->signal_connect(clicked => sub { $ret=1; $dialog->destroy(); Gtk->main_quit(); });
- $dialog->action_area->pack_start($button, 1, 1, 0);
- $button->grab_default;
-
- if ($c) {
- my $button2 = new Gtk::Button _("Cancel");
- $button2->signal_connect(clicked => sub { $ret=0; $dialog->destroy(); Gtk->main_quit(); });
- $button2->can_default(1);
- $dialog->action_area->pack_start($button2, 1, 1, 0);
- }
-
- $dialog->show_all;
- Gtk->main();
- $ret;
-}
-
-sub destroy_window {
- my($widget, $windowref, $w2) = @_;
- $$windowref = undef;
- $w2 = undef if defined $w2;
- 0;
-}
-
-
-# log
-# $Log$
-# Revision 1.15 2002/03/14 18:09:12 yduret
-# fix some bug
-#
-# Revision 1.14 2002/03/14 12:25:43 yduret
-# fix * bug in field matching/ not matching
-#
-# Revision 1.13 2002/03/05 06:56:27 yduret
-# mail alert: use eval {} to catch wizcancel
-#
-# Revision 1.12 2002/02/20 10:50:37 damien
-# cosmetic change, mcc compliance
-#
-# Revision 1.11 2002/02/05 11:26:29 damien
-# wizard updated
-#
-# Revision 1.10 2002/02/05 11:16:28 damien
-# correction for mcc.
-#
-# Revision 1.9 2002/02/04 14:02:14 damien
-# corrected typo. Yvounet, check your code!!
-#
-# Revision 1.8 2002/02/04 14:00:52 damien
-# embedded, explain
-#
-# Revision 1.7 2002/02/01 22:59:27 yduret
-# ergo fix thx dadou report
-#
-# Revision 1.6 2002/02/01 18:10:06 yduret
-# fix --explain=foo bug that prevent to show anything
-#
-# Revision 1.5 2002/02/01 10:01:39 pablo
-# changed some strings to make translation easier
-#
-# Revision 1.4 2002/01/29 23:19:31 yduret
-# logdrake is now under gi/perl-install/standalone
-#
-# Revision 1.32 2002/01/27 20:47:58 yduret
-# updated, added button in logdrake main screen, bug fix
-#
-# Revision 1.31 2002/01/27 01:58:23 yduret
-# added --alert feature
-#
-# Revision 1.30 2002/01/26 20:42:30 yduret
-# --explain= feature
-#
-# Revision 1.29 2001/09/15 15:44:22 siegel
-# added missing space in "matching" line
-#
-# Revision 1.28 2001/09/15 15:34:55 siegel
-# added missing _()
-#
-# Revision 1.27 2001/09/05 16:07:22 warly
-# fix regexp for day matching
-#
-# Revision 1.26 2001/09/03 20:34:37 yduret
-# remove ok boutton taht does nothing !
-#
-# Revision 1.25 2001/09/03 20:27:29 yduret
-# fix proper call to kill 'USRx'
-#
-# Revision 1.24 2001/09/03 20:26:25 yduret
-# fix
-#
-# Revision 1.23 2001/08/28 15:43:01 yduret
-# fix window size in embedded mode
-#
-# Revision 1.22 2001/08/27 12:22:03 yduret
-# back from chamonix
-#
-# Revision 1.21 2001/08/20 15:04:55 siegel
-# added "Gtk->set_locale;"
-#
-# Revision 1.20 2001/08/18 19:46:35 siegel
-# made i18n UTF8 compliant
-#
-# Revision 1.19 2001/08/13 09:57:55 yduret
-# added a timeout to watch file
-#
-# Revision 1.18 2001/08/10 10:36:17 yduret
-# fixes
-#
-# Revision 1.17 2001/08/10 10:20:53 yduret
-# calendar added more
-#
-# Revision 1.16 2001/08/10 09:28:35 yduret
-# added calendar functionnality
-#
-# Revision 1.15 2001/08/10 01:46:05 yduret
-# corrected vnew usage (thc gc)
-#
-# Revision 1.14 2001/08/06 14:58:12 yduret
-# added isFile mode for daminounet
-#
-# Revision 1.13 2001/08/03 05:49:10 yduret
-# really fixed bug when embeded in mcc
-# use plain english instead of bad french
-#
-# Revision 1.12 2001/08/02 08:28:18 pablo
-# update pot file, s/ :/:/ for English text
-#
-# Revision 1.11 2001/08/01 19:06:05 yduret
-# pour boblack
-#
-# Revision 1.10 2001/08/01 17:30:21 yduret
-# added mapping..
-#
-# Revision 1.9 2001/08/01 13:19:14 yduret
-# ask_many_from_list
-#
-# Revision 1.8 2001/07/19 13:24:54 pablo
-# updated Croatian file
-#
-# Revision 1.7 2001/07/16 16:48:21 yduret
-# update
-#
-# Revision 1.6 2001/07/03 19:40:48 pablo
-# updated Danish file,
-# i18n'd logdrake
-#
-# Revision 1.5 2001/07/03 08:54:43 yduret
-# powered by DrakX technologie
-#
-# Revision 1.4 2001/07/02 09:47:55 yduret
-# fix bug in regexp
-#
-# Revision 1.3 2001/06/29 16:14:01 yduret
-# great upgrade
-#
-# Revision 1.2 2001/06/28 10:50:27 yduret
-# full support of color
-#
-# Revision 1.1 2001/06/27 09:22:59 yduret
-# added it..
-#
diff --git a/perl-install/standalone/lsnetdrake b/perl-install/standalone/lsnetdrake
deleted file mode 100755
index 9865cee27..000000000
--- a/perl-install/standalone/lsnetdrake
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-use network::nfs;
-use network::smb;
-
-"@ARGV" =~ /-h/ and die "usage: lsnetdrake [-h] [--nfs] [--smb]\n";
-
-my $nfs = !@ARGV || "@ARGV" =~ /-(nfs)/;
-my $smb = !@ARGV || "@ARGV" =~ /-(smb)/;
-
-$| = 1;
-$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
-
-my @l;
-push @l, network::nfs->new if $nfs;
-push @l, network::smb->new if $smb;
-
-foreach my $class (@l) {
- foreach my $server (sort_names($class->find_servers)) {
- foreach (sort_names($class->find_exports($server))) {
- print $class->to_fullstring($_), "\n";
- }
- }
-}
-
-sub sort_names {
- sort { $a->{name} cmp $b->{name} } @_;
-}
diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake
deleted file mode 100755
index f8bb9a02e..000000000
--- a/perl-install/standalone/mousedrake
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/perl
-
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use common;
-use interactive;
-use modules;
-use detect_devices;
-use Xconfig;
-use mouse;
-use c;
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: mousedrake [--auto] [--testing]\n";
-
-$::auto = /-auto/;
-$::testing = /-testing/;
-
-my $in = 'interactive'->vnew('su', 'mouse');
-
--r '/etc/modules.conf' and modules::mergein_conf('/etc/modules.conf');
-
-undef $::Plug;
-begin:
-my ($curr_env) = Xconfig::getinfoFromXF86Config('');
-my ($mouse) = mouse::detect() unless $::noauto;
-my $time_tag2;
-
-#- now try to merge $curr_env->{mouse} with $mouse.
-
-# Hack to read symlinks (when they are used in existing config):
-# This prevents mousedrake from doing stupid things like
-# ln -sf mouse /dev/mouse (this was done by me after it read
-# an old XF86Config, not -4, and found "/dev/mouse" there).
-# 2002 July 13, imz@altlinux.ru
-if ( $curr_env->{mouse}{device} eq "mouse" ) {
- $curr_env->{mouse}{device} =
- ( readlink "$prefix/dev/mouse"
- or ( log::l("reading $prefix/dev/mouse symlink failed"),
- $mouse->{device} ) );
-}
-if ( $curr_env->{mouse}{auxmouse}{device} eq "mouse1" ) {
- $curr_env->{mouse}{auxmouse}{device} =
- ( readlink "$prefix/dev/mouse1"
- or ( log::l("reading $prefix/dev/mouse1 symlink failed"),
- $mouse->{auxmouse}{device} ) );
-}
-# End of the hack.
-
-$mouse->{XMOUSETYPE} eq $curr_env->{mouse}{XMOUSETYPE} ||
- $mouse->{XMOUSETYPE} eq 'PS/2' && ($curr_env->{mouse}{XMOUSETYPE} =~ m|PS/2| ||
- $curr_env->{mouse}{auxmouse}{XMOUSETYPE} =~ m|PS/2|) and $mouse = $curr_env->{mouse};
-
-$::isEmbedded and kill USR2, $::CCPID;
-if (!$mouse || !$::auto) {
- $mouse ||= mouse::fullname2mouse("serial|Generic 2 Button Mouse");
- if ($::isEmbedded && $in->isa('interactive::gtk')) {
- require my_gtk;
- my $time_tag = Gtk->timeout_add(100, sub {
- defined $::Plug && defined $::Plug->child or return 1;
- mouse::test_mouse_standalone($mouse,$::Plug->child);
- 0;
- });
- }
- my $name = $in->ask_from_treelistf('mousedrake', _("Please, choose the type of your mouse."), '|',
- sub { join '|', map { translate($_) } split '\|', $_[0] },
- [ mouse::fullnames ],
- $mouse->{type} . '|' . $mouse->{name});
- Gtk->timeout_remove($time_tag2) if $::isEmbedded && $in->isa('interactive::gtk');
- $name or $::isEmbedded ? do { kill(USR1, $::CCPID); goto begin } : $in->exit(0);
- my $mouse_chosen = mouse::fullname2mouse($name);
- $mouse->{type} eq $mouse_chosen->{type} && $mouse->{name} eq $mouse_chosen->{name} or $mouse = $mouse_chosen;
-
- if ($mouse->{device} eq "usbmouse") {
- my ($c) = grep { $_->{driver} =~ /usb-[ou]hci/ } detect_devices::pci_probe(0) or die _("no serial_usb found\n");
- eval { modules::load($c->{driver}, "serial_usb") };
- }
-
- $mouse->{XEMU3} = 'yes' if $mouse->{nbuttons} < 3 && (!$::noauto || $in->ask_yesorno('', _("Emulate third button?"), 1));
-
- $mouse->{device} = $in->ask_from_listf(_("Mouse Port"),
- _("Please choose on which serial port your mouse is connected to."),
- \&mouse::serial_port2text,
- [ mouse::serial_ports ],
- $mouse->{device},
- ) || goto begin if $mouse->{type} eq 'serial';
-}
-
-mouse::write_conf($mouse);
--e "/var/lock/subsys/gpm" and system "service", "gpm", "restart";
-
-$::isEmbedded ? kill(USR1, $::CCPID) : $in->exit(0);
-goto begin;
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
deleted file mode 100755
index 72e15bf22..000000000
--- a/perl-install/standalone/net_monitor
+++ /dev/null
@@ -1,540 +0,0 @@
-#!/usr/bin/perl
-
-# Monitor
-
-# Copyright (C) 1999 MandrakeSoft (damien@mandrakesoft.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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 Gtk;
-use lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use my_gtk qw(:helpers :wrappers);
-#-use Data::Dumper;
-use common;
-use strict;
-use network::netconnect;
-use network::tools;
-use MDK::Common::Globals "network", qw($in $prefix $connect_file $disconnect_file $connect_prog);
-
-if ("@ARGV" =~ /--help|-h/) {
- print q(Network & Internet connection and monitoring application
-
---defaultintf interface : show this interface by default
---connect : connect to internet if not already connected
---disconnect : disconnect to internet if already connected
---force : used with (dis)connect : force (dis)connection.
---status : returns 1 if connected 0 otherwise, then exit.
---quiet : don't be interactive. To be used with (dis)connect.
-);
- exit(0);
-}
-
-if ("@ARGV" =~ /--status/) { print connected(); exit(0) }
-my $force = "@ARGV" =~ /--force/;
-my $quiet = "@ARGV" =~ /--quiet/;
-my $connect = "@ARGV" =~ /--connect/;
-my $disconnect = "@ARGV" =~ /--disconnect/;
-my ($default_intf) = "@ARGV" =~ /--defaultintf (\w+)/;
-
-if ($force) {
- $connect and system("/etc/sysconfig/network-scripts/net_cnx_up");
- $disconnect and system("/etc/sysconfig/network-scripts/net_cnx_down");
- $connect = $disconnect = 0;
-}
-$quiet and exit(0);
-init Gtk;
-my $in = 'interactive'->vnew('su', 'default');
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-
-
-my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
-$window1->signal_connect ( delete_event => sub { Gtk->exit(0); });
-$window1->set_position(1);
-$window1->set_title(_("Network Monitoring"));
-$window1->set_policy(1, 1, 1);
-$window1->set_border_width(5);
-#$::isEmbedded or $window1->set_usize(580, 320);
-
-my $colorr = my_gtk::gtkcolor(50400, 655, 20000);
-my $colort = my_gtk::gtkcolor(55400, 55400, 655);
-my $colora = my_gtk::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 $style= new Gtk::Style;
-$style->font(Gtk::Gdk::Font->fontset_load("-adobe-times-medium-r-normal-*-12-*-75-75-p-*-iso8859-*,*-r-*"));
-
-network::netconnect::load_conf($netcnx, $netc, $intf);
-network::netconnect::read_net_conf('', $netcnx, $netc);
-my $combo1 = new Gtk::Combo;
-$combo1->set_popdown_strings (network::netconnect::get_profiles() );
-$combo1->entry->set_text($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default");
-$combo1->entry->set_editable(0);
-MDK::Common::Globals::init(
- in => $in,
- prefix => '',
- connect_file => "/etc/sysconfig/network-scripts/net_cnx_up",
- disconnect_file => "/etc/sysconfig/network-scripts/net_cnx_down",
- connect_prog => "/etc/sysconfig/network-scripts/net_cnx_pg" );
-
-gtkadd($window1,
- gtkpack_(new Gtk::VBox(0,5),
- 0, _("Network Monitoring"),
- 1, gtkpack_(new Gtk::HBox(0,5),
- 1, my $notebook = new Gtk::Notebook,
- 0, gtkpack_(new Gtk::VBox(0,5),
- 0, gtkadd(gtkset_shadow_type(new Gtk::Frame(_("Settings")), 'etched_out'),
- gtkpack__(gtkset_border_width(new Gtk::VBox(0,5),5),
- gtkpack__(new Gtk::HBox(0,0),
- _("Connection type: "), my $label_cnx_type = new Gtk::Label("")),
- gtkpack__(new Gtk::HBox(0,0),
- _("Profile "), $combo1)
- )
- ),
- 1, gtkadd(gtkset_shadow_type(new Gtk::Frame(_("Statistics")), 'etched_out'),
- gtkpack__(new Gtk::VBox(0,0),
- create_packtable({ col_spacings => 1, row_spacings => 1},
- [ "", "instantaneous" , "average"],
- [ _("Sending Speed:"), my $label_st = new Gtk::Label(""), my $label_sta=new Gtk::Label("na")],
- [ _("Receiving Speed:"),my $label_sr= new Gtk::Label(""), my $label_sra=new Gtk::Label("na")],
- ),
- gtkpack__(new Gtk::HBox(0,0), " "._("Connection Time: "), my $label_ct = new Gtk::Label("")),
- )
- ),
- 0, gtkpack_(new Gtk::HBox(0,5),
- 1, gtksignal_connect(my $button_connect = gtkset_sensitive(new Gtk::Button(), 0), clicked => \&connection),
- 0, new Gtk::VSeparator,
- 0, gtkpack(new Gtk::VBox(0,5),
- gtksignal_connect(new Gtk::Button(_("Logs")), clicked => sub {
- -e "/usr/sbin/logdrake"
- ? system('/usr/sbin/logdrake --file=/var/log/messages &')
- : system('/usr/X11R6/bin/xvt -e "tail -f /var/log/messages " &')
- }),
- gtksignal_connect(my $button_close = new Gtk::Button(_("Close")), clicked => sub { Gtk->exit(0) }),
- )
- )
- )
- ),
- 0, my $statusbar = new Gtk::Statusbar
- )
- );
-$window1->show_all;
-$window1->realize;
-$combo1->entry->signal_connect( 'changed', sub {
- network::netconnect::set_profile($netcnx, $combo1->entry->get_text());
- network::netconnect::load_conf($netcnx, $netc, $intf);
- network::netconnect::set_net_conf($netcnx, $netc, $intf);
- network::netconnect::read_net_conf('', $netcnx, $netc);
- });
-my $gct = new Gtk::Gdk::GC($window1->window);
-$gct->set_foreground($colort);
-my $gcr = new Gtk::Gdk::GC($window1->window);
-$gcr->set_foreground($colorr);
-my $gca = new Gtk::Gdk::GC($window1->window);
-$gca->set_foreground($colora);
-my ($pix_c_map, $pix_c_mask) = gtkcreate_png("net_c.png");
-my ($pix_d_map, $pix_d_mask) = gtkcreate_png("net_d.png");
-my ($pix_u_map, $pix_u_mask) = gtkcreate_png("net_u.png");
-$button_connect->add(gtkpack__(new Gtk::VBox(0,3),
- my $pix_c = new Gtk::Pixmap($pix_u_map, $pix_u_mask),
- my $label_c = new Gtk::Label(_("Wait please"))
- ));
-$statusbar->push(1, _("Wait please, testing your connection..."));
-$window1->show_all();
-#$window1->set_policy (1, 1, 1);
-my $time_tag = Gtk->timeout_add(1000, \&rescan);
-my $time_tag2 = Gtk->timeout_add(20000, \&update);
-
-update();
-rescan();
-while ($isconnected == -1) {
- Gtk->main_iteration while Gtk->events_pending;
-}
-connection() if ($connect && !$isconnected || $disconnect && $isconnected);
-Gtk->main;
-Gtk->exit(0);
-
-my $during_connection;
-sub connection {
- $during_connection = 1;
- my $isconnected2 = $isconnected;
- $button_connect->set_sensitive(0);
- $button_close->set_sensitive(0);
- $statusbar->pop(1);
- $statusbar->push(1, $isconnected2 ? _("Disconnecting from Internet ") : _("Connecting to Internet "));
- if(!$isconnected2) {
- $c_time = time();
- $ct_tag = Gtk->timeout_add(1000, sub {
- my ($sec,$min,$hour) = gmtime(time() - $c_time);
- my $e = sprintf ("%02d:%02d:%02d", $hour, $min, $sec);
- $label_ct->set($e); 1; });
- } else { Gtk->timeout_remove($ct_tag) }
- my $nb_point=1;
- my $tag = Gtk->timeout_add(100, sub {
- $statusbar->pop(1);
- $statusbar->push(1, ($isconnected2 ? _("Disconnecting from Internet ") : _("Connecting to Internet "))
- . join('', map { "." } (1..$nb_point)));
- $nb_point++;
- 1;
- });
- my $netc = {};
- my $tag2 = Gtk->timeout_add(10000, sub {
- Gtk->timeout_remove($tag);
- $statusbar->pop(1);
- $statusbar->push(1, $isconnected2 ? ( $isconnected ?
- _("Disconnection from Internet failed.") :
- _("Disconnection from Internet complete.")) :
- ( $isconnected ?
- _("Connection complete.") :
- _("Connection failed.\nVerify your configuration in the Mandrake Control Center."))
- );
- my $tag3 = Gtk->timeout_add(10000, sub {
- $statusbar->pop(1);
- $statusbar->push(1, $isconnected ? _("Connected") : _("Not connected"));
- 0;
- });
- $button_connect->set_sensitive(1);
- $button_close->set_sensitive(1);
- undef $during_connection;
- 0;
- });
- Gtk->main_iteration while Gtk->events_pending;
- $tag2 = Gtk->timeout_add(1000, sub { system( $isconnected2 ? "/etc/sysconfig/network-scripts/net_cnx_down &" : "/etc/sysconfig/network-scripts/net_cnx_up &"); 0; });
-}
-
-sub rescan {
- get_val();
- foreach(@interfaces) {
- my $intf = $_;
- my $recv = $monitor->{$intf}{val}->[0];
- my $transmit = $monitor->{$intf}{val}->[8];
- my $refr = $monitor->{$intf}{referencer};
- my $reft = $monitor->{$intf}{referencet};
- $monitor->{sr} += $recv - $refr;
- $monitor->{st} += $transmit - $reft;
-
- $monitor->{$intf}{recva} += $recv - $refr;
- $monitor->{$intf}{recvan}++;
- if ($monitor->{$intf}{recvan} > 9) {
- push(@{$monitor->{$intf}{stack_ra}}, $monitor->{$intf}{recva}/10);
- $monitor->{$intf}{recva} = $monitor->{$intf}{recvan} = 0;
- } else { push(@{$monitor->{$intf}{stack_ra}}, -1) }
- shift @{$monitor->{$intf}{stack_ra}} if @{$monitor->{$intf}{stack_ra}} > 250;
-
- push(@{$monitor->{$intf}{stack_r}}, $recv - $refr);
- shift @{$monitor->{$intf}{stack_r}} if @{$monitor->{$intf}{stack_r}} > 250;
- $monitor->{$intf}{labelr}->set(formatXiB($recv - $monitor->{$intf}{initialr}));
- $monitor->{$intf}{referencer} = $recv;
-
- $monitor->{$intf}{transmita} += $transmit - $reft;
- $monitor->{$intf}{transmitan}++;
- if ($monitor->{$intf}{transmitan} > 9) {
- push(@{$monitor->{$intf}{stack_ta}}, $monitor->{$intf}{transmita}/10);
- $monitor->{$intf}{transmita} = $monitor->{$intf}{transmitan} = 0;
- } else { push(@{$monitor->{$intf}{stack_ta}}, -1) }
- shift @{$monitor->{$intf}{stack_ta}} if @{$monitor->{$intf}{stack_ta}} > 250;
-
- push(@{$monitor->{$intf}{stack_t}}, $transmit - $reft);
- shift @{$monitor->{$intf}{stack_t}} if @{$monitor->{$intf}{stack_t}} > 250;
- $monitor->{$intf}{labelt}->set(formatXiB($transmit - $monitor->{$intf}{initialt}));
- $monitor->{$intf}{referencet} = $transmit;
-
- draw_monitor($monitor->{$intf});
- }
- $label_sr->set(formatXiB($monitor->{sr}) . "/s");
- $label_st->set(formatXiB($monitor->{st}) . "/s");
- $monitor->{sra} += $monitor->{sr};
- $monitor->{sta} += $monitor->{st};
- $monitor->{nba} ++;
- if($monitor->{nba} > 9) {
- $label_sra->set(formatXiB($monitor->{sra}/10) . "/s");
- $label_sta->set(formatXiB($monitor->{sta}/10) . "/s");
- $monitor->{sra} = 0;
- $monitor->{sta} = 0;
- $monitor->{nba} = 0;
- }
- $label_cnx_type->set($netcnx->{type});
- $monitor->{$_} = 0 foreach ('sr', 'st');
- 1;
-}
-
-sub get_val {
- my @ret;
- my $a = cat_("/proc/net/dev");
- $a =~ s/^.*?\n.*?\n//;
- $a =~ s/^\s*lo:.*?\n//;
- my @line = split(/\n/, $a);
- foreach(@line) {
- s/\s*(\w*)://;
- my $intf=$1;
- push (@ret,$intf);
- $monitor->{$intf}{val} = [split()];
- $monitor->{$intf}{intf} = $intf;
- }
- @ret;
-}
-
-sub change_color {
- my ($color) = @_;
- my $window = new Gtk::Window -toplevel;
- my $doit;
- $window->signal_connect ( delete_event => sub { Gtk->main_quit() });
- $window->set_position(1);
- $window->set_title(_("Color configuration"));
- $window->set_border_width(5);
- gtkadd(gtkset_modal($window,1),
- gtkpack_(new Gtk::VBox(0,5),
- 1, my $colorsel = new Gtk::ColorSelection,
- 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("OK")), clicked => sub { $doit=1; Gtk->main_quit() }),
- gtksignal_connect(new Gtk::Button(_("Cancel")), clicked => sub { Gtk->main_quit() }),
- )
- )
- );
- $colorsel->set_color($color->red()/65535, $color->green()/65535, $color->blue()/65535, $color->pixel());
- $window->show_all();
- Gtk->main;
- $window->destroy();
- $doit or return $color;
- my (@color) = $colorsel->get_color();
- my_gtk::gtkcolor($color[0]*65535, $color[1]*65535, $color[2]*65535);
-}
-
-my $scale;
-sub update {
- connected_bg(\$isconnected);
- my @intfs = get_val();
- if($combo1->entry->get_text ne ($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default")) {
- $combo1->entry->set_text($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default");
- }
- foreach(@intfs) {
- my $intf = $_;
- if(!member($intf,@interfaces)) {
- $default_intf = $intf;
- $monitor->{$intf}{initialr} = $monitor->{$intf}{val}->[0];
- $monitor->{$intf}{initialt} = $monitor->{$intf}{val}->[8];
- $monitor->{$intf}{darea} = new Gtk::DrawingArea();
- $monitor->{$intf}{darea}->set_events(["pointer_motion_mask"]);
- $notebook->append_page(gtkshow(my $page = gtkpack_(new Gtk::VBox(0,0),
- 0, gtkpack__(gtkset_border_width(new Gtk::HBox(0,0), 5),
- gtksize($monitor->{$intf}{darea},300, 150)),
- 0, gtkpack_(new Gtk::HBox(0,0),
- 1, gtkpack__(new Gtk::VBox(0,0),
- gtkpack__(gtkset_border_width(new Gtk::HBox(0,5), 5),
- gtksignal_connect(my $button_t = gtkset_relief(new Gtk::Button(), 'none'), clicked => sub {
- $colort = change_color($colort);
- $gct->set_foreground($colort);
- $_[0]->draw(undef);
- }),
- _("sent: "), $monitor->{$intf}{labelt} = new Gtk::Label("0")),
- gtkpack__(gtkset_border_width(new Gtk::HBox(0,5), 5),
- gtksignal_connect(my $button_r = gtkset_relief(new Gtk::Button(), 'none'), clicked => sub {
- $colorr = change_color($colorr);
- $gcr->set_foreground($colorr);
- $_[0]->draw(undef);
- }),
- _("received: "), $monitor->{$intf}{labelr} = new Gtk::Label("0")),
- gtkpack__(gtkset_border_width(new Gtk::HBox(0,5), 5),
- gtksignal_connect(my $button_a = gtkset_relief(new Gtk::Button(), 'none'), clicked => sub {
- $colora = change_color($colora);
- $gca->set_foreground($colora);
- $_[0]->draw(undef);
- }),
- _("average"))
- ),
- 0, gtkpack__(gtkset_border_width(new Gtk::VBox(0,0), 5),
- gtkadd(gtkset_shadow_type(new Gtk::Frame(_("Local measure")), 'etched_out'),
- gtkpack__(gtkset_border_width(new Gtk::VBox(0,0), 5),
- gtkpack__(new Gtk::HBox(0,0),
- _('sent: '),
- my $measure_t = new Gtk::Label("0")
- ),
- gtkpack__(new Gtk::HBox(0,0),
- _('received: '),
- my $measure_r = new Gtk::Label("0")
- )
- )
- )
- )
- )
- )),
- new Gtk::Label($intf));
- foreach my $i ([$button_t, $gct],[$button_r, $gcr],[$button_a, $gca]) {
- $i->[0]->add(gtksignal_connect(gtkshow(gtksize(gtkset_usize(new Gtk::DrawingArea(), 10, 10), 10, 10)), expose_event => sub{ $_[0]->window->draw_rectangle ($i->[1], 1, 0, 0, 10, 10)} ));
- }
- $notebook->set_page($notebook->page_num($page));
- $monitor->{$intf}{page}=($notebook->page_num($page));
- $monitor->{$intf}{pixmap_db} = new Gtk::Gdk::Pixmap($monitor->{$intf}{darea}->window, 300, 150);
- $monitor->{$intf}{referencer} = $monitor->{$intf}{val}->[0];
- $monitor->{$intf}{referencet} = $monitor->{$intf}{val}->[8];
- $monitor->{$intf}{pixmap_db}->draw_rectangle ($monitor->{$intf}{darea}->style->black_gc, 1, 0, 0, 300, 150);
- $monitor->{$intf}{darea}->signal_connect( motion_notify_event =>
- sub { my ($w, $e) = @_;
- my $x = $e->{'x'} - 50;
- my $y = $e->{'y'};
- my $received = $x >= 0 ? $monitor->{$intf}{stack_r}[$x] : 0;
- my $transmitted = $x >= 0 ? $monitor->{$intf}{stack_t}[$x] : 0;
- my $type;
- $y * $scale / 150 < $transmitted and $type = _('transmitted');
- (150 - $y) * $scale / 150 < $received and $type = _('received');
- $measure_r->set(formatXiB($received));
- $measure_t->set(formatXiB($transmitted));
- });
- $monitor->{$intf}{darea}->signal_connect( expose_event => sub {
- $monitor->{$intf}{darea}->window->draw_pixmap ($monitor->{$intf}{darea}->style->bg_gc('normal'),
- $monitor->{$intf}{pixmap_db}, 0, 0, 0, 0, 300, 150);
- });
- }
- }
- foreach(@interfaces) {
- my $intf = $_;
- if(!member($intf,@intfs)) {
- $notebook->remove_page($monitor->{$intf}{page});
- }
- }
- @interfaces = @intfs;
- my $netc={};
- my $tmp;
- connected_bg(\$tmp);
- if(defined $tmp) {
- $isconnected = $tmp;
- if ($isconnected != -1 && !$during_connection) {
- if($isconnected && !in_ifconfig($netcnx->{NET_INTERFACE})) {
- $isconnected=0;
- $statusbar->pop(1);
- $statusbar->push(1, _("Warning, another internet connexion has been detected, maybe using your network"));
- } else {
- #- translators : $netcnx->{type} is the type of network connection (modem, adsl...)
- $statusbar->pop(1);
- $statusbar->push(1, $isconnected ? _("Connected") : _("Not connected"));
- }
- $label_c->set($isconnected ? _("Disconnect %s", $netcnx->{type}) : _("Connect %s", $netcnx->{type}));
- $isconnected ? $pix_c->set($pix_c_map, $pix_c_mask) : $pix_c->set($pix_d_map, $pix_d_mask);
- $button_connect->set_sensitive(1);
- }
- }
- if (!(-e $connect_file && -e $disconnect_file)) {
- $button_connect->set_sensitive(0);
- $label_c->set("No internet connection configured");
- }
- 1;
-}
-
-sub in_ifconfig {
- my ($intf) = @_;
- -e '/sbin/ifconfig' or return 1;
- $intf eq '' and return 1;
- `/sbin/ifconfig` =~ /$intf/;
-}
-
-sub draw_monitor {
- my ($o) = @_;
- defined $o->{darea} or return;
- $o->{pixmap_db}->draw_rectangle ($o->{darea}->style->black_gc, 1, 0, 0, 300, 150);
- my $maxr = 0;
- foreach (@{$o->{stack_r}}) { $maxr = $_ if $_>$maxr }
- my $maxt = 0;
- foreach (@{$o->{stack_t}}) { $maxt = $_ if $_>$maxt }
- my $ech = $maxr + $maxt;
- $ech == 0 and $ech = 1;
- $scale = $ech;
- my $step=49;
- foreach (@{$o->{stack_t}}) {
- $o->{pixmap_db}->draw_rectangle($gct, 1, $step, 0, 1, $_*150/$ech);
- $step++;
- }
- $step=49;
- my ($av1, $av2, $last_a);
- foreach (@{$o->{stack_ta}}) {
- if($_ != -1) {
- if( !defined $av1) { $av1 = $_ } else { defined $av2 or $av2 = $_ }
- if ($av1 && $av2) {
- $o->{pixmap_db}->draw_line($gca, $step-15, $av1*150/$ech, $step-5, $av2*150/$ech);
- $av1 = $av2;
- undef $av2;
- $last_a = $step-50;
- }
- }
- $step++;
- }
- $step=49;
- foreach (@{$o->{stack_r}}) {
- $o->{pixmap_db}->draw_rectangle($gcr, 1, $step, 151-$_*150/$ech, 1, $_*150/$ech);
- $step++;
- }
- $step=49;
- ($av1, $av2) = undef;
- foreach (@{$o->{stack_ra}}) {
- if($_ != -1) {
- if(!defined $av1) { $av1 = $_ } else { defined $av2 or $av2 = $_ }
- if ((defined $av1) && (defined $av2)) {
- $o->{pixmap_db}->draw_line($gca, $step-15, 151-$av1*150/$ech, $step-5, 151-$av2*150/$ech);
- $av1 = $av2;
- undef $av2;
- }
- }
- $step++;
- }
-
- my $switch = 1;
- my $gcl = new Gtk::Gdk::GC($o->{darea}->window);
- $gcl->set_foreground($o->{darea}->window->get_colormap->color_white());
- $gcl->set_line_attributes (1, 'on-off-dash', 'not-last', 'round');
- for (my $i = 30;$i<=120;$i+=30) {
- $o->{pixmap_db}->draw_line($gcl, 50, $i, 300, $i);
- my ($gc2, $text);
- my ($dif1, $dif2);
- if ($last_a) {
- $dif1 = abs(150-@{$o->{stack_ra}}[$last_a]*150/$ech - $i);
- $dif2 = abs(@{$o->{stack_ta}}[$last_a]*150/$ech - $i);
- } else {
- $dif1 = abs(150-@{$o->{stack_r}}[@{$o->{stack_r}}-1]*150/$ech - $i);
- $dif2 = abs(@{$o->{stack_t}}[@{$o->{stack_t}}-1]*150/$ech - $i);
- }
- if ($dif1 < $dif2) {
- $text = formatXiB((150-$i)*$ech/150);
- $gc2=$gcr;
- my $x_l=5;
- if ($i > 30 && $switch) {
- $o->{pixmap_db}->draw_line($gct, $x_l, 0, $x_l, $i-30);
- $o->{pixmap_db}->draw_line($gct, $x_l-1, 0, $x_l-1, $i-30);
- $o->{pixmap_db}->draw_line($gct, $x_l+1, 0, $x_l+1, $i-30);
- $o->{pixmap_db}->draw_polygon($gct, 1, $x_l-4, $i-30, $x_l+5, $i-30, $x_l, $i-25);
- }
- if ($switch) {
- $o->{pixmap_db}->draw_line($gcr, $x_l, 150, $x_l, $i);
- $o->{pixmap_db}->draw_line($gcr, $x_l-1, 150, $x_l-1, $i);
- $o->{pixmap_db}->draw_line($gcr, $x_l+1, 150, $x_l+1, $i);
- $o->{pixmap_db}->draw_polygon($gcr, 1, $x_l-5, $i, $x_l+5, $i, $x_l, $i-6);
- }
- undef $switch;
- } else {
- $text = formatXiB($i*$ech/150);
- $gc2=$gct;
- }
- my $w = $style->font->string_width($text);
- $o->{pixmap_db}->draw_string($style->font, $gc2, 45-$w, $i+5, ($text) );
- }
- $o->{darea}->draw(undef);
-}
diff --git a/perl-install/standalone/printerdrake b/perl-install/standalone/printerdrake
deleted file mode 100755
index 501119148..000000000
--- a/perl-install/standalone/printerdrake
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/perl
-
-# printerdrake
-# Copyright (C) 1999 MandrakeSoft (fpons@mandrakesoft.com)
-# Original version for printer configuration from pad.
-#
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use printerdrake;
-use printer;
-use c;
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-local $_ = join '', @ARGV;
-
-/-h/ and die "usage: printerdrake [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing] [--cups] [--lprng] [--lpd] [--pdq]\n";
-
-$::expert = /-expert/;
-$::noauto = /-noauto/;
-$::testing = /-testing/;
-
-my $printer;
-
-my $in = 'interactive'->vnew('su', 'printer');
-
-my $commandline = $_;
-
-{
-# Check whether Foomatic is installed and install it if necessary
-printerdrake::install_foomatic($in);
-
-my $w = $in->wait_message('', _("Reading printer data ..."));
-# Get what was installed before
-eval { $printer = printer::getinfo('') };
-# Choose the spooler by command line options
-$commandline =~ /-cups/ and
- $printer->{SPOOLER} = 'cups' and printer::read_configured_queues($printer);
-$commandline =~ /-lpr/ and
- $printer->{SPOOLER} = 'lpd' and printer::read_configured_queues($printer);
-$commandline =~ /-lpd/ and
- $printer->{SPOOLER} = 'lpd' and printer::read_configured_queues($printer);
-$commandline =~ /-lprng/ and
- $printer->{SPOOLER} ='lprng' and printer::read_configured_queues($printer);
-$commandline =~ /-pdq/ and
- $printer->{SPOOLER} = 'pdq' and printer::read_configured_queues($printer);
--r '/etc/modules.conf' and modules::mergein_conf('/etc/modules.conf');
-}
-
-begin:
-$::isEmbedded and kill USR2, $::CCPID;
-
-printerdrake::main($printer, $in, 1);
-
-$::isEmbedded ? kill(USR1, $::CCPID) : $in->exit(0);
-goto begin;
diff --git a/perl-install/standalone/scannerdrake b/perl-install/standalone/scannerdrake
deleted file mode 100755
index b3b4dd402..000000000
--- a/perl-install/standalone/scannerdrake
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/perl
-
-# scannerdrake $Id$
-# Yves Duret <yduret at mandrakesoft.com>
-# Copyright (C) 2001 MandrakeSoft
-#
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# 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 lib qw(/usr/lib/libDrakX);
-
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-use interactive;
-use common;
-use scanner;
-
-$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
-for (@ARGV) {
- /^--version$/ and die 'version: $Id$ '."\n";
- /^--help$/ and die 'logdrake [--version] [--help] [--manual] [--device=dev] [--update-sane=sane_desc_dir] [--update-usbtable] [--dynamic=dev]';
- /^--update-usbtable$/ and do {scanner::updateScannerDBfromUsbtable(); exit;};
- /^--update-sane=(.*)$/ and do {scanner::updateScannerDBfromSane($1); exit;};
- /^--manual$/ and $::Manual=1;
- /^--dynamic=(.*)$/ and do { dynamic($1); exit;};
-}
-
-$in = 'interactive'->vnew('su', 'default');
-$in->do_pkgs->install('sane-backends', 'xsane', if_($in->do_pkgs->is_installed('gimp'),'xsane-gimp'));
-if ($::Manual) {manual(); quit();}
-my $wait = $in->wait_message(_("Test ports"), _("Detecting devices ..."));
-@f = scanner::findScannerUsbport();
-$wait=undef;
-(@f) ? auto() : manual();
-quit();
-
-sub auto {
- foreach (@f) {
- if (member($_->{val}{DESCRIPTION}), keys %$scanner::scannerDB) {
- my $name = $_->{val}{DESCRIPTION};
- $name =~ s/\s$//; #some HP entry have a trailing space, i will correct usbtable asap
- $in->ask_yesorno('scannerdrake',_("%s found on %s, configure it ?",$name,$_->{port}),1) or manual();
- tryConfScanner($name, $_->{port});
- }
- }
-}
-
-sub manual {
- my $s = $in->ask_from_treelist('scannerdrake', _("Select a scanner"), '|', [' None', keys %$scanner::scannerDB], '' ) or return;
- return if $s eq ' None';
- tryConfScanner($s);
-}
-
-sub dynamic {
- @f = scanner::findScannerUsbport();
- foreach (@f) {
- if (member($_->{val}{DESCRIPTION}), keys %$scanner::scannerDB) {
- my $name = $_->{val}{DESCRIPTION};
- $name =~ s/\s$//; #some HP entry have a trailing space, i will correct usbtable asap
- scanner::confScanner($name, $_->{port}) unless($scanner::scannerDB->{$model}{flags}{unsupported});
- }
- }
-}
-
-sub tryConfScanner {
- # take care if interactive ouptut is needed (unsupported, parallel..)
- my ($model, $port) = @_;
- if ($scanner::scannerDB->{$model}{flags}{unsupported}) {
- $in->ask_warn('scannerdrake', _("This %s scanner is unsupported", $model));
- return;
- }
- # if ($scanner::scannerDB->{$model}{driver} =~ /Parport/) {
- # $in->ask_warn('scannerdrake', _("This %s scanner uses parallel port, which is unsupported for the moment", $model));
- # return;
- # }
- if ($scanner::scannerDB->{$model}{driver} =~ /SCSI/) {
- #$in->ask_warn('scannerdrake', _("This %s scanner uses parallel port, which is unsupported for the moment", $model));
- #return;
- }
- if ($scanner::scannerDB->{$model}{ask} =~ /DEVICE/) {
- $port='/dev/sg0';
- $in->ask_from('scannerdrake',
- _("Scannerdrake was not able to detect your %s scanner.\nPlease select the device where your scanner is plugged", $model),
- [
- { label => _("choose device"), val => \$port, list => ['/dev/sg0', '/dev/sg1', '/dev/sg2', '/dev/sg3', '/dev/sg4' ], not_edit => 0, sort => 1},
- ],
- ) or manual();
- }
-
- if ($scanner::scannerDB->{$model}{server} =~ /printerdrake/) {
- $in->ask_warn('scannerdrake', _("This %s scanner must be configured by printerdrake.\nYou can launch printerdrake from the Mandrake Control Center in Hardware section.", $model));
- return;
- }
- scanner::confScanner($model,$port);
- $in->ask_warn(_("Congratulations!"),
- _("Your %s scanner has been configured.\nYou may now scan documents using ``XSane'' from Multimedia/Graphics in the applications menu.", $model));
-
-}
-
-sub quit {
- $::isEmbedded ? kill(USR1, $::CCPID) : $in->exit(0);
-}
-
-#-----------------------------------------------
-# $Log$
-# Revision 1.11 2002/03/11 06:43:36 yduret
-# re-re-re-re-re-re-uncomment the pkgs check line.
-#
-# Revision 1.10 2002/03/10 15:25:10 yduret
-# added ASK DEVICE support
-#
-# Revision 1.9 2002/03/09 14:23:48 yduret
-# added sum up at the end
-#
-# Revision 1.8 2002/03/09 00:58:36 yduret
-# uncomment line that checks if sane rpm is installed or not (thx gc).
-# i sux,
-#
-# Revision 1.7 2002/02/18 17:32:42 yduret
-# HP OfficeJet support
-#
-# Revision 1.6 2002/02/18 16:12:07 yduret
-# scsi/parport preliminary support
-#
-# Revision 1.5 2002/01/18 20:16:48 gc
-# - move 'use standalone' up to comply to 'explanations'
-# - fix a small english problem
-#
-# Revision 1.4 2001/11/19 17:39:03 pablo
-# Corrected English errors
-#
-# Revision 1.3 2001/11/19 10:50:37 yduret
-# added dynamic support
-#
-# Revision 1.2 2001/11/12 15:19:54 yduret
-# update
-#
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
deleted file mode 100755
index bfc652d13..000000000
--- a/perl-install/standalone/service_harddrake
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/perl -w
-
-use lib qw(/usr/lib/libDrakX);
-
-use strict;
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-use MDK::Common;
-use interactive;
-use harddrake::data;
-use Storable qw(store retrieve);
-
-my $hw_sysconfdir = "/etc/sysconfig/harddrake2";
-my $last_boot_config = $hw_sysconfdir."/previous_hw";
-
-my $str = '#!/usr/bin/perl -w
-#
-# Special file generated by harddrake service (cvs revision $Revision$).
-# Do not alter it; it\'ll be overwritten by harddrake2 service
-#
-# Format is : { Config_class_ID => {
-# Device => {
-# _Fields => values} ...} ...}
-#
-';
-
-# first run ? if not read old hw config
-my %previous_config = -f $last_boot_config ? retrieve($last_boot_config) : {};
-
-my (%config, $in);
-
-# For each hw, class, detect device, compare and offer to reconfigure if
-# needed
-foreach (@harddrake::data::tree) {
- my ($Ident, $item, undef, $configurator, $detector) = @$_;
-
- # No detector ? (should never happen but who know ?)
- ref($detector) eq 'CODE' or next;
-
- my %ID = map {
- my $i = $_;
- my $name = do {
- if ($item eq "Mouse") {
- $i->{media_type} = "MOUSE";
- $i->{device};
- } elsif (defined $i->{device}) {
- $i->{media_type} = "MASS_STORAGE_MEDIA";
- $i->{device};
- } else {
- join ':', map { $i->{$_} } qw(vendor id subvendor subid);
- }
- };
- $name => $i;
- } &$detector;
- $config{$Ident} = \%ID;
-
- next if is_empty_hash_ref %previous_config;
- my $oldconfig = $previous_config{$Ident};
-
- my $msg;
- my @was_removed = difference2([ keys %$oldconfig ], [ keys %ID ]);
- $msg .= _("Some devices in the \"%s\" hardware class were removed:\n", $item) if @was_removed;
- $msg .= "- $_ was removed\n" foreach @was_removed;
-
- my @added = difference2([ keys %ID ], [ keys %$oldconfig ]);
- $msg .= _("\nSome devices in the %s class were added:\n", $item) if @added;
- $msg .= "- $_ was added\n" foreach @added;
- @added || @was_removed or next;
-
- next unless (-x $configurator);
-
- my $res;
- $SIG{ALRM} = sub { die "TIMED OUT\n" };
- undef $@;
- eval {
- alarm (5);
- $in = 'interactive'->vnew('su') unless defined $in;
- $res = $in->ask_okcancel("Hardware changes in $Ident class (5 seconds to answer)",
- $msg . "\nDo you want to run the appropriate config tool ?", 1)
- or $in->wait_message(_('Please wait'), _('Hardware probing in progress'));
- alarm (0);
- };
-
- next unless ($@); # timed out
- print "CANCELED\n" if $res;
- next unless ($res); # canceled
- if (my $pid = fork) {
- require POSIX;
- POSIX::wait();
- } else {
- exec("$configurator 2>/dev/null") or die "$configurator missing\n";
- }
-}
-
-# output new hw config
-standalone::explanations "created file $last_boot_config";
-store \%config, $last_boot_config;
-$in->exit(0) if defined $in; exit 0;
diff --git a/perl-install/standalone/service_harddrake.sh b/perl-install/standalone/service_harddrake.sh
deleted file mode 100644
index 476585b17..000000000
--- a/perl-install/standalone/service_harddrake.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-#
-# harddrake This scripts runs the harddrake hardware probe.
-#
-# chkconfig: 345 05 95
-# description: This runs the hardware probe, and optionally configures \
-# changed hardware.
-
-# This is an interactive program, we need the current locale
-
-[[ -f /etc/profile.d/lang.sh ]] && . /etc/profile.d/lang.sh
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-
-SUBSYS=/var/lock/subsys/harddrake
-
-case "$1" in
- start)
-# We (mdk) don't support updfstab (yet)
-# action "Updating /etc/fstab" /usr/sbin/updfstab
-
- gprintf "Checking for new hardware"
- /usr/share/harddrake/service_harddrake 2>/dev/null
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- action "" /bin/true
- else
- action "" /bin/false
- fi
- # We don't want to run this on random runlevel changes.
- touch $SUBSYS
-# [ /etc/modules.conf -nt /lib/modules/$(uname -r)/modules.dep ] && touch /lib/modules/$(uname -r)/modules.dep 2>/dev/null >/dev/null || : &
- exit $RETVAL
- ;;
- status)
- if [ -f $SUBSYS ]; then
- gprintf "Harddrake service was runned at boot time"
- else gprintf "Harddrake service was not runned at boot time"
- fi
- ;;
- reload)
- ;;
- stop)
- # dummy
- rm -f $SUBSYS
- ;;
- *)
- gprintf "Usage: %s {start|stop}\n" "$0"
- exit 1
- ;;
-esac