diff options
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-x | perl-install/standalone/XFdrake | 66 | ||||
-rwxr-xr-x | perl-install/standalone/adduserdrake | 73 | ||||
-rwxr-xr-x | perl-install/standalone/diskdrake | 14 | ||||
-rwxr-xr-x | perl-install/standalone/drakboot | 41 | ||||
-rwxr-xr-x | perl-install/standalone/drakgw | 367 | ||||
-rwxr-xr-x | perl-install/standalone/draknet | 33 | ||||
-rwxr-xr-x | perl-install/standalone/draksec | 34 | ||||
-rwxr-xr-x | perl-install/standalone/drakxconf | 4 | ||||
-rwxr-xr-x | perl-install/standalone/drakxservices | 20 | ||||
-rw-r--r-- | perl-install/standalone/icons/findf.xpm | 57 | ||||
-rw-r--r-- | perl-install/standalone/icons/ftin.xpm | 46 | ||||
-rw-r--r-- | perl-install/standalone/icons/ftout.xpm | 46 | ||||
-rwxr-xr-x | perl-install/standalone/keyboarddrake | 33 | ||||
-rwxr-xr-x | perl-install/standalone/livedrake | 23 | ||||
-rwxr-xr-x | perl-install/standalone/mousedrake | 51 | ||||
-rwxr-xr-x | perl-install/standalone/printerdrake | 25 |
16 files changed, 601 insertions, 332 deletions
diff --git a/perl-install/standalone/XFdrake b/perl-install/standalone/XFdrake index 46c5b6f63..88db4c23d 100755 --- a/perl-install/standalone/XFdrake +++ b/perl-install/standalone/XFdrake @@ -17,43 +17,45 @@ # 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 lib qw(/usr/lib/libDrakX); -use common qw(:file); +use interactive; use Xconfigurator; use Xconfig; +use c; local $_ = join '', @ARGV; -/-h/ and die "usage: XFdrake [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing]\n"; +/-h/ and die "usage: XFdrake [--xf3] [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing]\n"; -$::beginner = /--beginner/; -$::expert = /--expert/; -$::auto = /--auto/; -$::noauto = /--noauto/; -$::skiptest = /--skiptest/; -$::testing = /--testing/; -$::isStandalone = 1; +my $i = {}; -my $hasX = do { `xtest`; $? == 0 }; - -my $in; if ($hasX) { - require 'interactive_gtk.pm'; - $in = interactive_gtk->new; -} else { - *log::l = undef; - *log::l = sub {}; - require 'interactive_newt.pm'; - $in = interactive_newt->new; -} - -Xconfigurator::main('', Xconfig::getinfo(), $in, -# sub { -# use install_any; -# print "Here\n"; -# my ($X) = glob_("/mnt/disk/XFree86-$_[0]-*") or die "$_[0]'s X server rpm not found"; -# pkgs::install('', [ { name => $_[0], file => $X } ], 1, 0); -# } -); - -exec 'true' if $hasX; #- workaround for perl-GTK +$::isStandalone = 1; +$::force_xf3 = /-xf3/; +$::beginner = /-beginner/; +$::expert = /-expert/; +$::auto = /-auto/; +$::noauto = /-noauto/; +$::testing = /-testing/; +$i->{skiptest} = /-skiptest/; + +my $in = interactive->vnew('su'); + +my $f = "/usr/X11R6/lib/X11/Cards"; +if (!-e $f) { $in->suspend; system("urpmi --auto --best-output XFree86 XFree86-75dpi-fonts"); $in->resume; } +-e $f or die "install XFree86 first!\n"; + +`pidof xfs` > 0 or system("/etc/rc.d/init.d/xfs start"); + +system("mount /proc 2>/dev/null"); # ensure /proc is mounted for pci probing + +Xconfig::getinfoFromXF86Config($i) if $0 =~ Xdrakres; +Xconfig::getinfo($i); + +Xconfigurator::main('', $i, $in, 0, -e "/etc/pcmcia", + sub { my ($server, @l) = @_; + $in->suspend; + system("urpmi --auto --best-output XFree86-$server " . join(' ', @l)); + $in->resume; + }); +$in->exit(0); diff --git a/perl-install/standalone/adduserdrake b/perl-install/standalone/adduserdrake index 52fbdfd68..1ce283f8c 100755 --- a/perl-install/standalone/adduserdrake +++ b/perl-install/standalone/adduserdrake @@ -4,23 +4,34 @@ use lib qw(/usr/lib/libDrakX); use common qw(:common :functional :system :file); use interactive; +use any; local $_ = join '', @ARGV; -/-h/ and die "usage: adduserdrake [--beginner] [--expert]\n"; +/-h/ and die "usage: adduserdrake [--beginner] [--expert] [<users...>]\n"; -$::beginner = /--beginner/; -$::expert = /--expert/; +$::beginner = /-beginner/; +$::expert = /-expert/; $::isStandalone = 1; -my $in = vnew interactive('su'); - my @etc_pass_fields = qw(name pw uid gid realname home shell); -my @shells = map { "/bin/$_" } qw(bash tcsh zsh ash ksh); +my @shells = grep { -x $_ } map { "/bin/$_" } qw(bash tcsh zsh ash ksh); my $isMD5 = cat_("/etc/pam.d/passwd") =~ /md5/; -my $security = $ENV{SECURITY_LEVEL}; +my $isShadow = cat_("/etc/pam.d/passwd") =~ /shadow/; +my $security = $ENV{SECURE_LEVEL}; + + + +if (my @l = grep { ! /^-/ } @ARGV) { + addusers(map {{ name => $_, realname => $_ }} @l); + exit 0; +} + +my $in = interactive->vnew('su'); +my @users; new: +$u = { icon => translate('automagic') }; if ($in->ask_from_entries_refH( [ _("Add user"), _("Accept user"), _("Done") ], _("Enter a user\n%s", $users ? _("(already added %s)", join(", ", map { $_->{realname} || $_->{name} } @users)) : ''), @@ -32,6 +43,8 @@ if ($in->ask_from_entries_refH( _("Password (again)") => {val => \$u->{password2}, hidden => 1}, ), $::beginner ? () : ( _("Shell") => {val => \$u->{shell}, list => \@shells, not_edit => !$::expert} + ), $security > 3 ? () : ( + _("Icon") => {val => \$u->{icon}, list => [ any::facesnames() ], icon2f => \&any::face2xpm }, ), ], focus_out => sub { @@ -40,29 +53,43 @@ if ($in->ask_from_entries_refH( } }, complete => sub { - $u->{password} eq $u->{password2} or $o->ask_warn('', [ _("The passwords do not match"), _("Please try again") ]), return (1,3); - $security > 3 && length($u->{password}) < 6 and $o->ask_warn('', _("This password is too simple")), return (1,2); - $u->{name} or $o->ask_warn('', _("Please give a user name")), return (1,0); - $u->{name} =~ /^[a-z0-9_-]+$/ or $o->ask_warn('', _("The user name must contain only lower cased letters, numbers, `-' and `_'")), return (1,0); - member($u->{name}, map { $_->{name} } @users) and $o->ask_warn('', _("This user name is already added")), return (1,0); + $u->{password} eq $u->{password2} or $in->ask_warn('', [ _("The passwords do not match"), _("Please try again") ]), return (1,3); + $security > 3 && length($u->{password}) < 6 and $in->ask_warn('', _("This password is too simple")), return (1,2); + $u->{name} or $in->ask_warn('', _("Please give a user name")), return (1,0); + $u->{name} =~ /^[a-z0-9_-]+$/ or $in->ask_warn('', _("The user name must contain only lower cased letters, numbers, `-' and `_'")), return (1,0); + member($u->{name}, map { $_->{name} } @users) and $in->ask_warn('', _("This user name is already added")), return (1,0); + print $u->{icon}, "\n"; return 0; }, )) { push @users, $u; - $u->{pw} = $isMD5 ? c::crypt_md5($u->{password}, salt(8)) : crypt($u->{password}, salt(2)); - system("adduser $u->{name}"); + goto new; +} + +addusers(@users); + +sub addusers { + my @u = map { $_->{name} } my @users = @_; + + foreach (@users) { + $_->{pw} = any::crypt($_->{password}, $isMD5); + $_->{shell} ||= "/bin/bash"; + } + + system("adduser $_") foreach @u; + any::addUsers('', @_); + substInFile { - if (/^$u->{name}:/) { - chomp; - my %l; @l{@etc_pass_fields} = split ':'; - add2hash($u, \%l); - $_ = join(':', @$u{@etc_pass_fields}) . "\n"; + foreach my $u (@users) { + if (/^$u->{name}:/) { + chomp; + my %l; @l{@etc_pass_fields} = split ':'; + add2hash($u, \%l); + $_ = join(':', @$u{@etc_pass_fields}) . "\n"; + } } } "/etc/passwd"; - - $u = {}; - goto new; + system("pwconv") if $isShadow; } - $in->exit(0); diff --git a/perl-install/standalone/diskdrake b/perl-install/standalone/diskdrake index a3ffafe83..6696f29f4 100755 --- a/perl-install/standalone/diskdrake +++ b/perl-install/standalone/diskdrake @@ -22,7 +22,7 @@ # DiskDrake is also based upon the libfdisk and the install from Red Hat Software -use lib qw(/usr/lib/libDrakX .); +use lib qw(/usr/lib/libDrakX); use common qw(:common :functional); use diskdrake; use interactive_gtk; @@ -30,9 +30,15 @@ use detect_devices; use fsedit; use fs; use log; +use c; +local $_ = join '', @ARGV; + +/-h/ and die "usage: diskdrake [--expert] [--testing]\n"; + +$::expert = /-expert/; +$::testing = /-testing/; $::isStandalone = 1; -#$::expert = 1; if ($>) { $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; @@ -56,11 +62,11 @@ my $hds = I'll try to go on blanking bad partitions"), $err]); }; -$SIG{__DIE__} = sub { chomp $_[0]; log::l("ERROR: $_[0]") }; +$SIG{__DIE__} = sub { chomp (my $m = $_[0]); log::l("ERROR: $m") }; my $fstab = [ fsedit::get_fstab(@$hds) ]; fs::get_mntpoints_from_fstab($fstab); fs::check_mounted($fstab); diskdrake::main($hds, {}, $in); -exec "true"; +$in->exit(0); diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index 33af4079a..b5656dc4a 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -2,23 +2,48 @@ use lib qw(/usr/lib/libDrakX); -use common qw(:system :file :functional); +use common qw(:common :file :functional); use interactive; use any; -use lilo; +use bootloader; use detect_devices; use fsedit; +use fs; use c; local $_ = join '', @ARGV; -/-h/ and die "usage: drakboot\n"; +/-h/ and die "usage: drakboot [--expert]\n"; +$::expert = /-expert/; $::isStandalone = 1; -my $in = vnew interactive('su'); +my $in = interactive->vnew('su'); -my $bootloader = lilo::read('', '/etc/lilo.conf'); +my %l = ( + arch() !~ /sparc|alpha/ ? ( + _("Configure LILO/GRUB") => '', + _("Create a boot floppy") => ['/usr/X11R6/bin/drakfloppy'], + ) : (), + _("Format floppy") => [ '/usr/bin/kfloppy', '/usr/bin/gfloppy' ], +); + +while (my ($k, $v) = each %l) { + $v or next; + foreach (@$v) { + -x $_ and $l{$k} = $_, last; + } + -x $l{$k} or delete $l{$k}; +} + +if ($ENV{DISPLAY} && c::Xtest($ENV{DISPLAY})) { + my $cmd = $l{$in->ask_from_list(_("Choice"), _("What do you want to do?"), [ keys %l ])}; + exec $cmd if $cmd; +} + +my $bootloader = bootloader::read('', '/etc/lilo.conf'); +local ($_) = `detectloader`; +$bootloader->{methods} = { lilo => 1, grub => !!/grub/i }; my $hds = catch_cdie { fsedit::hds([ detect_devices::hds() ], {}) } sub { 1 }; my $fstab = [ fsedit::get_fstab(@$hds) ]; @@ -27,11 +52,9 @@ fs::get_mntpoints_from_fstab($fstab); ask: any::setupBootloader($in, $bootloader, $hds, $fstab, $ENV{SECURE_LEVEL}) or $in->exit(0); -eval { lilo::install('', $bootloader) }; -my $err = $@; -eval { lilo::install_grub('', $bootloader, $fstab, $hds) }; +eval { bootloader::install('', $bootloader, $fstab, $hds) }; -if ($err && $@) { +if ($@) { $in->ask_warn('', [ _("Installation of LILO failed. The following error occured:"), grep { !/^Warning:/ } cat_("/tmp/.error") ]); diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw index 2ebd926db..27ab1c028 100755 --- a/perl-install/standalone/drakgw +++ b/perl-install/standalone/drakgw @@ -13,33 +13,158 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -$drakgw_version = "0.9.0"; - use lib qw(/usr/lib/libDrakX); use common qw(:system :file); use interactive; use log; use c; +use netconnect; +use detect_devices; local $_ = join '', @ARGV; -/-h/ and die "usage: drakgw [--expert]\n"; +/-h/ and die "usage: drakgw [--version --verbose]\n"; +/-version/ and die 'version: $Id$ '."\n"; -$::expert = /-expert/ || cat_("/etc/sysconfig/system") =~ /^TYPE="?expert/m; #" +$::verbose = /-verbose/; +$::direct = /-direct/; $::isStandalone = 1; my $in = vnew interactive('su'); +my $sysconf_network = "/etc/sysconfig/network"; +my $conf_linuxconf = "/etc/conf.linuxconf"; +my $rc_firewall = "/etc/rc.d/rc.firewall.inet_sharing"; +my $dhcpd_conf = "/etc/dhcpd.conf"; +my $cups_conf = "/etc/cups/cupsd.conf"; + + +my $drakgw_setup = "/etc/sysconfig/inet_sharing"; + +sub start_daemons() +{ + my $cups_used = 0; + log::l("[drakgw] Starting daemons\n"); + if (-f "/etc/rc.d/init.d/cups") + { + if (grep(/is running/, `/etc/rc.d/init.d/cups status`)) + { + $cups_used = 1; + (system("/etc/rc.d/init.d/cups stop") == 0) or die "Could not stop the CUPS daemon"; + } + } + grep(/is running/, `/etc/rc.d/init.d/dhcpd status`) and ((system("/etc/rc.d/init.d/dhcpd stop") == 0) or die "Could not stop the dhcp server"); + grep(/error: cannot connect/, `/etc/rc.d/init.d/named status 2>&1`) or ((system("/etc/rc.d/init.d/named stop") == 0) or die "Could not stop the named server"); + (system("/etc/rc.d/init.d/network restart") == 0) or die "Could not restart the network"; + (system("sh /etc/rc.d/rc.firewall") == 0) or die "Could not start the firewall script"; + (system("/etc/rc.d/init.d/named start") == 0) or die "Could not start the caching nameserver"; + (system("/sbin/chkconfig --level 345 named on") == 0) or die "Could not chkconfig named"; + (system("/etc/rc.d/init.d/dhcpd start") == 0) or die "Could not start the dhcp server"; + (system("/sbin/chkconfig --level 345 dhcpd on") == 0) or die "Could not chkconfig dhcpd"; + if ($cups_used == 1) + { + (system("/etc/rc.d/init.d/cups start") == 0) or die "Could not start the CUPS daemon"; + } + local *DRAKGW_SETUP; open DRAKGW_SETUP, ">$drakgw_setup" or die "Can't open $drakgw_setup"; + print DRAKGW_SETUP "INET_SHARING=enabled\n"; + close DRAKGW_SETUP; +} + +sub stop_daemons() +{ + log::l("[drakgw] Stopping daemons\n"); + grep(/is running/, `/etc/rc.d/init.d/dhcpd status`) and ((system("/etc/rc.d/init.d/dhcpd stop") == 0) or die "Could not stop the dhcp server"); + grep(/Connection refused/, `/etc/rc.d/init.d/named status 2>&1`) or ((system("/etc/rc.d/init.d/named stop") == 0) or die "Could not stop the named server"); + (system("/etc/rc.d/init.d/ipchains stop") == 0) or die "Could not stop ipchains"; + (system("/sbin/chkconfig --level 345 named off") == 0) or die "Could not chkconfig named"; + (system("/sbin/chkconfig --level 345 dhcpd off") == 0) or die "Could not chkconfig dhcpd"; + + local *DRAKGW_SETUP; open DRAKGW_SETUP, ">$drakgw_setup" or die "Can't open $drakgw_setup"; + print DRAKGW_SETUP "INET_SHARING=disabled\n"; + close DRAKGW_SETUP; +} + +sub install_rpm($) +{ + $in->suspend; + system("urpmi --auto --best-output $_[0]"); + $in->resume; +} + +sub fatal_quit($) +{ + log::l("[drakgw] FATAL: $_[0]\n"); + (defined $wait_configuring) and (undef $wait_configuring); + $in->ask_warn('', $_[0]); + $in->exit(-1); +} + + +#- ********************************** +#- * 0th step: verify if we are already set up + +if (-f $drakgw_setup) +{ + open DRAKGW_SETUP, "$drakgw_setup" or die "Can't open $drakgw_setup"; + my @drakgw_setup_content = <DRAKGW_SETUP>; + close DRAKGW_SETUP; + + if (grep(/enabled/, @drakgw_setup_content)) + { + 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.\n +What would you like to do?"), + [ _("disable"), _("reconfigure"), _("dismiss") ]); + if ($r eq _("disable")) + { + stop_daemons(); + -f "$dhcpd_conf.drakgwdisable" and (unlink("$dhcpd_conf.drakgwdisable") or die "Could not unlink $dhcpd_conf.drakgwdisable"); + rename($dhcpd_conf, "$dhcpd_conf.drakgwdisable") or die "Could not rename $dhcpd_conf to $dhcpd_conf.drakgwdisable"; + -f "$rc_firewall.drakgwdisable" and (unlink("$rc_firewall.drakgwdisable") or die "Could not unlink $rc_firewall.drakgwdisable"); + rename($rc_firewall, "$rc_firewall.drakgwdisable") or die "Could not rename $rc_firewall to $rc_firewall.drakgwdisable"; + log::l("[drakgw] Disabled\n"); + $in->exit(0); + } + ($r eq _("dismiss")) and $in->exit(0); + } + elsif (grep(/disabled/, @drakgw_setup_content)) + { + 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.\n +What would you like to do?"), + [ _("enable"), _("reconfigure"), _("dismiss") ]); + if ($r eq _("enable")) + { + -f $dhcpd_conf and rename($dhcpd_conf, "$dhcpd_conf.old"); + rename("$dhcpd_conf.drakgwdisable", $dhcpd_conf) or die "Could not find configuration. Please reconfigure."; + -f $rc_firewall and rename($rc_firewall, "$rc_firewall.old"); + rename("$rc_firewall.drakgwdisable", $rc_firewall) or die "Could not find configuration. Please reconfigure."; + start_daemons(); + log::l("[drakgw] Enabled\n"); + $in->exit(0); + } + ($r eq _("dismiss")) and $in->exit(0); + } + else + { + $in->ask_warn("Unrecognized config file", _("Config file content could not be interpreted.")); + $in->exit(-1); + } +} + + + #- ********************************** #- * 1st step: detect/setup -$in->ask_okcancel(_("Internet Connection Sharing"), - _("Your computer can be configured so that its Internet connection shall be shared ". - "with other computers.\n". - "Note: you need a dedicated Network Adapter to set up a Local Area Network (LAN).\n\n". - "Would you like to setup the Internet Connection Sharing?"), 1) or $in->exit(0); +$::direct or $in->ask_okcancel(_("Internet Connection Sharing"), + _("Your computer can be configured to share its Internet connection.\n +Note: you need a dedicated Network Adapter to set up a Local Area Network (LAN).\n +Would you like to setup the Internet Connection Sharing?"), 1) or $in->exit(0); #my @pci_ethernet_cards; #require pci_probing::main; @@ -48,15 +173,24 @@ $in->ask_okcancel(_("Internet Connection Sharing"), #($#pci_ethernet_cards == -1) and $in->ask_warn('', _("No PCI network ethernet devices found!")) and $in->exit(0); # ## push @pci_ethernet_cards, [ "NETWORK_ETHERNET", "Fake ne2000", "ne2k" ]; -# -#my @configured_devices = map { /ifcfg-(\S+)/; $1 } `ls /etc/sysconfig/network-scripts/ifcfg*`; -# + +my @configured_devices = map { /ifcfg-(\S+)/; $1 } `ls /etc/sysconfig/network-scripts/ifcfg*`; + #my @active_devices = `/sbin/ifconfig | grep ^[a-z] | awk '{print \$1}'`; chop @active_devices; -my %aliased_devices; (/^alias\s+(eth[0-9])\s+(\S+)/) and ($aliased_devices{$1} = $2) foreach (`cat /etc/modules.conf`); -my @all_cards = map { "Interface $_ (using module $aliased_devices{$_})" } (keys %aliased_devices); +my %aliased_devices; (/^alias\s+(eth[0-9])\s+(\S+)/) and ($aliased_devices{$1} = $2) foreach cat_("/etc/modules.conf"); +my $card_netconnect = netconnect::get_net_device("/"); +(defined $card_netconnect) and log::l("[drakgw] Information from netconnect: ignore card $card_netconnect\n"); +my @all_cards_getnet = detect_devices::getNet(); +my @all_cards; +foreach my $card (@all_cards_getnet) +{ + log::l("[drakgw] Have network card: $card\n"); + next if ($card eq $card_netconnect); + push @all_cards, exists $aliased_devices{$card} ? "Interface $card ("._("using module")." $aliased_devices{$card})" : "Interface $card"; +} +log::l("[drakgw] Available network cards: ".join(" ; ", @all_cards)."\n"); - # print "pci_detection: "; print ">".$_->[2]."< " foreach (@pci_ethernet_cards); # print "\nconfigured: "; print ">".$_."< " foreach (@configured_devices); # print "\nactive: "; print ">".$_."< " foreach (@active_devices); @@ -86,46 +220,45 @@ my @all_cards = map { "Interface $_ (using module $aliased_devices{$_})" } (keys my $interface; if ($#all_cards == -1) { - $in->ask_warn(_("No NIC on your system!"), - _("No ethernet network adapter is currently configured on your\n". - "system. Please run the hardware configuration tool.")); + $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.")); $in->exit(0); } elsif ($#all_cards == 0) { $interface = $all_cards[0]; - $in->ask_okcancel(_("Network interface"), - _("There is only one configured network adapter on your system:\n\n$interface\n\n". - "Would you like to setup your Local Area Network with that adapter?"), 1) or $in->exit(0); + $::verbose and ($in->ask_okcancel(_("Network interface"), + _("There is only one configured network adapter on your system:\n\n$interface\n\nWould you like to setup your Local Area Network with that adapter?"), 1) or $in->exit(0)); } else { $interface = $in->ask_from_list(_("Choose the network interface"), - _("Here are the configured network adapters on your system; please\n". - "choose which one to use to setup your Local Area Network."), + _("Please choose what network adapter will be connected to your Local Area Network."), \@all_cards, ); defined $interface or $in->exit(0); } $interface =~ /(eth[0-9]+)/ or die("Internal error"); my $device = $1; +log::l("[drakgw] Choosing network card: $device\n"); + +grep(/$device/, @configured_devices) and + ($in->ask_okcancel('', _("Warning, the network adapter is already configured.\nWould you like to reconfigure?")) or $in->exit(0)); #- setup the address for the LAN -my $lan_address = "192.168.0.0"; -$::expert and ($lan_address = $in->ask_from_entry(_("Local Area Network specification"), - _("You may now decide which class C network will be your LAN.\n"), - _("Network:"), $lan_address, - ) or $in->exit(0)); -($lan_address =~ /^([0-9]+\.[0-9]+\.[0-9]+)\.0$/) or die "Invalid network.\n"; -$lan_address = $1; +my $full_lan_address = "192.168.0.0"; +#$::expert and ($full_lan_address = $in->ask_from_entry(_("Local Area Network specification"), +# _("You may now decide which class C network to use.\n"), +# _("Network:"), $full_lan_address, +# ) or $in->exit(0)); +($full_lan_address =~ /^([0-9]+\.[0-9]+\.[0-9]+)\.0$/) or die "Invalid network.\n"; +my $lan_address = $1; #- test for potential conflict with other networks -my @configured_devices = map { /ifcfg-(\S+)/; $1 } `ls /etc/sysconfig/network-scripts/ifcfg-*`; - foreach (@configured_devices) { if ($_ ne $device) @@ -134,27 +267,32 @@ foreach (@configured_devices) my $ifcfg = "/etc/sysconfig/network-scripts/ifcfg-$_"; open IFCFG, "$ifcfg" or die "Can't open $ifcfg"; my @ifcfg_content = <IFCFG>; - grep(/$lan_address/, @ifcfg_content) and $in->ask_warn('', _("Potential LAN address conflict found in current config of $_!\n")) and $in->exit(0); + grep(/$lan_address/, @ifcfg_content) and + $in->ask_warn('', _("Potential LAN address conflict found in current config of $_!\n")) and $in->exit(0); close IFCFG; } } -#- ask for confirmation +#- test for potential conflict with previous firewall config -$in->ask_okcancel(_("Internet Connection Sharing - setup of $device"), - _("The following interface is about to be configured:\n\n$interface\n\n". - "It will be setup on a Local Area Network ($lan_address.0); additionnally, IP forwarding ". - "and masquerading will be enabled, together with a DHCP server.\n". - "You will then be able to connect other computers to this network, with automatic ". - "DHCP configuration."), 1) or $in->exit(0); +my @chain_rules; +(-f "/etc/sysconfig/ipchains" or ((-x "/sbin/ipchains") and (@chain_rules = `/sbin/ipchains -L`) and ($#chain_rules > 2))) + and ($in->ask_okcancel(_("Firewalling configuration detected!"), + _("Warning! An existing firewalling configuration has been detected. You may need some manual fix after installation. Proceed?"), 1) or $in->exit(0)); +#- ask for confirmation +# +#$in->ask_okcancel(_("Internet Connection Sharing - setup"), +# _("The local network is about to be configured.\n") . +# "You will then be able to connect other computers to this network, with automatic ". +# "DHCP configuration."), 1) or $in->exit(0); #- ********************************** #- * 2nd step: configure -my $wait_configuring = $in->wait_message('Configuring...', _("Configuring scripts, installing software, starting daemons...")); +$wait_configuring = $in->wait_message(_("Configuring..."), _("Configuring scripts, installing software, starting servers...")); #- setup the /etc/sysconfig/network-script/ script @@ -174,15 +312,48 @@ EOF close IFCFG; -#- install and setup the FORWARD and MASQ stuff with IPCHAINS +#- install and setup the RPM packages + +my $rpms_to_install; +my %bin2rpm = ( "/sbin/ipchains" => "ipchains", + "/usr/sbin/dhcpd" => "dhcp", + $conf_linuxconf => "linuxconf", + "/usr/sbin/named" => "bind", + "/var/named/named.local" => "caching-nameserver" ); + +-e $_ or $rpms_to_install .= "$bin2rpm{$_} " foreach (keys %bin2rpm); +install_rpm($rpms_to_install); +-e $_ or fatal_quit(_("Problems installing package $bin2rpm{$_}")) foreach (keys %bin2rpm); + + +#- setup the masquerading configuration + +if (-f "/etc/rc.d/rc.firewall") +{ + local *RCFIREWALL; + open RCFIREWALL, "/etc/rc.d/rc.firewall" or die "Can't open /etc/rc.d/rc.firewall"; + my @rcfirewall_content = <RCFIREWALL>; + close RCFIREWALL; + grep(/\/etc\/rc\.d\/rc\.firewall\.inet_sharing/, @rcfirewall_content) or push @rcfirewall_content, "# Added by drakgw\n[ -x /etc/rc.d/rc.firewall.inet_sharing ] && /etc/rc.d/rc.firewall.inet_sharing\n"; + open RCFIREWALL, ">/etc/rc.d/rc.firewall" or die "Can't open /etc/rc.d/rc.firewall"; + print RCFIREWALL @rcfirewall_content; + close RCFIREWALL; +} +else +{ + local *RCFIREWALL; open RCFIREWALL, ">/etc/rc.d/rc.firewall" or die "Can't open /etc/rc.d/rc.firewall"; + print RCFIREWALL <<EOF; +#!/bin/sh +# +# Automatically generated by drakgw -my $f = "/sbin/ipchains"; --e $f or system("urpmi --auto ipchains"); --e $f or ($in->ask_warn('', _("Could not install ipchains RPM with urpmi.")) and $in->exit(0)); +[ -x /etc/rc.d/rc.firewall.inet_sharing ] && /etc/rc.d/rc.firewall.inet_sharing +EOF + chmod 0700, "/etc/rc.d/rc.firewall"; +} -my $rcfirewall = "/etc/rc.d/rc.firewall"; --f $rcfirewall and rename($rcfirewall, "$rcfirewall.old"); -local *RCFIREWALL; open RCFIREWALL, ">$rcfirewall" or die "Can't open $rcfirewall"; +-f $rc_firewall and rename($rc_firewall, "$rc_firewall.old"); +local *RCFIREWALL; open RCFIREWALL, ">$rc_firewall" or die "Can't open $rc_firewall"; print RCFIREWALL <<EOF; #!/bin/sh # @@ -205,11 +376,11 @@ print RCFIREWALL <<EOF; # RealAudio WILL function but in TCP mode. This can cause a reduction # in sound quality # -#/sbin/modprobe ip_masq_raudio +/sbin/modprobe ip_masq_raudio # Supports the masquerading of IRC DCC file transfers # -#/sbin/modprobe ip_masq_irc +/sbin/modprobe ip_masq_irc # Supports the masquerading of Quake and QuakeWorld by default. This modules is @@ -223,16 +394,16 @@ print RCFIREWALL <<EOF; #/sbin/modprobe ip_masq_quake # #Quake I/II/III / QuakeWorld (ports 26000, 27000, 27910, 27960) -#/sbin/modprobe ip_masq_quake 26000,27000,27910,27960 +/sbin/modprobe ip_masq_quake 26000,27000,27910,27960 # Supports the masquerading of the CuSeeme video conferencing software # -#/sbin/modprobe ip_masq_cuseeme +/sbin/modprobe ip_masq_cuseeme #Supports the masquerading of the VDO-live video conferencing software # -#/sbin/modprobe ip_masq_vdolive +/sbin/modprobe ip_masq_vdolive #CRITICAL: Enable IP forwarding since it is disabled by default since @@ -286,31 +457,25 @@ echo "1" > /proc/sys/net/ipv4/ip_forward /sbin/ipchains -A forward -s $lan_address.0/24 -j MASQ EOF close RCFIREWALL; -chmod 0700, $rcfirewall; +chmod 0700, $rc_firewall; #- be sure that FORWARD_IPV4 is enabled in /etc/sysconfig/network -my $sysconf_network = "/etc/sysconfig/network"; open SYSCONF_NETWORK, "$sysconf_network" or die "Can't open $sysconf_network"; my @sysconf_network_content = <SYSCONF_NETWORK>; close SYSCONF_NETWORK; -($_ =~ /^FORWARD_IPV4=/ and $_="FORWARD_IPV4=true\n") foreach (@sysconf_network_content); +($_ =~ /^FORWARD_IPV4=/ and $_="FORWARD_IPV4=true\n") foreach @sysconf_network_content; grep(/^FORWARD_IPV4=/, @sysconf_network_content) or push @sysconf_network_content, "FORWARD_IPV4=true\n"; open SYSCONF_NETWORK, ">$sysconf_network" or die "Can't open $sysconf_network"; print SYSCONF_NETWORK @sysconf_network_content; close SYSCONF_NETWORK; -#- install and setup the DHCP server +#- setup the DHCP server -$f = "/usr/sbin/dhcpd"; --e $f or system("urpmi --auto dhcp"); --e $f or ($in->ask_warn('', _("Could not install dhcp RPM with urpmi.")) and $in->exit(0)); - -my $dhcpdconf = "/etc/dhcpd.conf"; --f $dhcpdconf and rename($dhcpdconf, "$dhcpdconf.old"); -local *DHCPDCONF; open DHCPDCONF, ">$dhcpdconf" or die "Can't open $dhcpdconf"; +-f $dhcpd_conf and rename($dhcpd_conf, "$dhcpd_conf.old"); +local *DHCPDCONF; open DHCPDCONF, ">$dhcpd_conf" or die "Can't open $dhcpd_conf"; print DHCPDCONF <<EOF; subnet $lan_address.0 netmask 255.255.255.0 { # default gateway @@ -320,7 +485,7 @@ subnet $lan_address.0 netmask 255.255.255.0 { option domain-name "homelan.org"; option domain-name-servers $lan_address.1; - range dynamic-bootp $lan_address.16 $lan_address.255; + range dynamic-bootp $lan_address.16 $lan_address.253; default-lease-time 21600; max-lease-time 43200; } @@ -330,50 +495,66 @@ close DHCPDCONF; #- put the interface for the dhcp server in linuxconf config, for the /etc script of dhcpd -my $conf_linuxconf = "/etc/conf.linuxconf"; open CONF_LINUXCONF, "$conf_linuxconf" or die "Can't open $conf_linuxconf"; my @conf_linuxconf_content = <CONF_LINUXCONF>; close CONF_LINUXCONF; -($_ =~ /^DHCP.interface/ and $_="DHCP.interface $device\n") foreach (@conf_linuxconf_content); +($_ =~ /^DHCP.interface/ and $_="DHCP.interface $device\n") foreach @conf_linuxconf_content; grep(/DHCP.interface/, @conf_linuxconf_content) or push @conf_linuxconf_content, "DHCP.interface $device\n"; open CONF_LINUXCONF, ">$conf_linuxconf" or die "Can't open $conf_linuxconf"; print CONF_LINUXCONF @conf_linuxconf_content; close CONF_LINUXCONF; - -#- install the BIND and caching nameserver stuff - -$f = "/usr/sbin/named"; --e $f or system("urpmi --auto bind"); --e $f or ($in->ask_warn('', _("Could not install bind RPM with urpmi.")) and $in->exit(0)); - -$f = "/var/named/named.local"; --e $f or system("urpmi --auto caching-nameserver"); --e $f or ($in->ask_warn('', _("Could not install caching-nameserver RPM with urpmi.")) and $in->exit(0)); - +#- 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. +#- +#- These steps are only done when the CUPS package is installed. + +if (-f $cups_conf) +{ + open CONF_CUPS, "$cups_conf" or die "Can't open $cups_conf"; + my @cups_conf_content = <CONF_CUPS>; + close CONF_CUPS; + ($_ =~ /ServerName[^:]/ and $_="ServerName $lan_address.1\n") foreach @cups_conf_content; + grep(/ServerName[^:]/, @cups_conf_content) or push @cups_conf_content, "ServerName $lan_address.1\n"; + grep(/^BrowseAddress $lan_address.255/, @cups_conf_content) or push @cups_conf_content, "BrowseAddress $lan_address.255\n"; + open CONF_CUPS, ">$cups_conf" or die "Can't open $conf_linuxconf"; + print CONF_CUPS @cups_conf_content; + close CONF_CUPS; +} #- start the daemons -(system("/etc/rc.d/init.d/network restart") == 0) or die "Could not restart the network"; -(system("/etc/rc.d/rc.firewall") == 0) or die "Could not start the firewall script"; -grep(/is running/, `/etc/rc.d/init.d/dhcpd status`) and ((system("/etc/rc.d/init.d/dhcpd stop") == 0) or die "Could not stop the dhcp server"); -(system("/etc/rc.d/init.d/dhcpd start") == 0) or die "Could not start the dhcp server"; -(system("/sbin/chkconfig --level 345 dhcpd on") == 0) or die "Could not chkconfig dhcpd"; -grep(/Connection refused/, `/etc/rc.d/init.d/named status 2>&1`) or ((system("/etc/rc.d/init.d/named stop") == 0) or die "Could not stop the named server"); -(system("/etc/rc.d/init.d/named start") == 0) or die "Could not start the caching nameserver"; -(system("/sbin/chkconfig --level 345 named on") == 0) or die "Could not chkconfig named"; +start_daemons(); + +#- bye-bye message undef $wait_configuring; -$in->ask_warn(_("Everything configured!"), - _("Everything has been configured.\n". - "You may now connect computers on your Local Area Network,\n". - "using automatic DHCP network configuration.")); +$in->ask_warn(_("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\n"); $in->exit(0); - -# 0.9.0 Thu Aug 17 15:03:40 2000 -# - first version + +#------------------------------------------------- +#- $Log$ +#- Revision 1.1.1.1 2000/11/28 16:54:21 damien +#- branch to build the firewall install. +#- +#- 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/draknet b/perl-install/standalone/draknet index d34342dec..38194c3dd 100755 --- a/perl-install/standalone/draknet +++ b/perl-install/standalone/draknet @@ -1,7 +1,6 @@ #!/usr/bin/perl -#- CHANGE THIS! (dam's) -# DrakFuck +# DrakNet # Copyright (C) 1999 MandrakeSoft (damien@mandrakesoft.com) # @@ -19,20 +18,21 @@ # 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 lib qw(/usr/lib/libDrakX); use interactive; use netconnect; -#use Xconfig; use c; local $_ = join '', @ARGV; -#/-h/ and die "usage: DrakFuck[--xf3] [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing]\n"; +#/-h/ and die "usage: draknet[--xf3] [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing]\n"; -my $i = {}; +my $netcnx = {}; $::isStandalone = 1; +$::isWizard = 0; +$::wizard_xpm = "/usr/share/pixmaps/internet.xpm"; #$::force_xf3 = /-xf3/; #$::beginner = /-beginner/; #$::expert = /-expert/; @@ -45,19 +45,12 @@ $::isStandalone = 1; #-e $f or system("urpmi --auto XFree86 XFree86-75dpi-fonts"); #-e $f or die "install XFree86 first!\n"; -my $in = vnew interactive;#('su'); - -#`pidof xfs` > 0 or system("/etc/rc.d/init.d/xfs start"); - -#system("mount /proc 2>/dev/null"); # ensure /proc is mounted for pci probing - -#Xconfig::getinfoFromXF86Config($i) if $0 =~ Xdrakres; -#Xconfig::getinfo($i); - -#Xconfigurator::main('', $i, $in, 0, -e "/etc/pcmcia", sub { system("urpmi --auto XFree86-$_[0]") }); - -#netconnect::isdn_ask('', $i, $in, -e "/etc/pcmcia"); -netconnect::isdn_detect('', $i, $in, -e "/etc/pcmcia"); -#netconnect::isdn_write_config('', $i, $in, -e "/etc/pcmcia"); +my $in = vnew interactive('su'); +$::isStandalone and my $wait=$in->wait_message('', "", 1); +netconnect::intro('', $netcnx, $in, -e "/etc/pcmcia", sub { + $in->suspend; + system("urpmi --auto --best-output " . join(' ', @_)); + $in->resume; + }); $in->exit(0); diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec index 8877501b5..4dff6de7b 100755 --- a/perl-install/standalone/draksec +++ b/perl-install/standalone/draksec @@ -2,7 +2,7 @@ use lib qw(/usr/lib/libDrakX); -use common qw(:system); +use common qw(:system :file); use interactive; use mouse; use c; @@ -11,24 +11,48 @@ local $_ = join '', @ARGV; /-h/ and die "usage: draksec [--expert]\n"; -$::expert = /--expert/; +$::expert = /-expert/ || cat_("/etc/sysconfig/system") =~ /^CLASS="?expert/m; #" $::isStandalone = 1; my $in = vnew interactive('su'); my %m = reverse (my %l = ( - 0 => _("Windows(TM)"), + 0 => _("Welcome To Crackers"), 1 => _("Poor"), 2 => _("Low"), 3 => _("Medium"), 4 => _("High"), 5 => _("Paranoid"), )); +my %help = ( + 0 => _("This level is to be used with care. It makes your system more easy to use, +but very sensitive: it must not be used for a machine connected to others +or to the Internet. There is no password access."), + 1 => _("Password are now enabled, but use as a networked computer is still not recommended."), + 2 => _("Few improvements for this security level, the main one is that there are +more security warnings and checks."), + 3 => _("This is the standard security recommended for a computer that will be used +to connect to the Internet as a client. There are now security checks. "), + 4 => _("With this security level, the use of this system as a server becomes possible. +The security is now high enough to use the system as a server which accept +connections from many clients. "), + 5 => _("We take level 4 features, but now the system is entirely closed. +Security features are at their maximum."), +); + delete @l{0,1,5} unless $::expert; +delete @help{0,1,5} unless $::expert; -if (my $level = $in->ask_from_list('', _("Choose security level"), [ values %l ], $l{$ENV{SECURE_LEVEL}})) { +if (my $level = $in->ask_from_list('', _("Choose security level") . "\n\n" . + join('', map { "$l{$_}: $help{$_}\n\n" } keys %l), + [ values %l ], $l{$ENV{SECURE_LEVEL}})) { my $w = $in->wait_message('', _("Setting security level")); - system("/etc/security/msec/init.sh ". $m{$level}); + $in->suspend; + + $ENV{LILO_PASSWORD} = ''; # make it non interactive + system "/usr/sbin/msec", $m{$level}; + + $in->resume; } $in->exit(0); diff --git a/perl-install/standalone/drakxconf b/perl-install/standalone/drakxconf index f4adb9989..e4e4e9bd3 100755 --- a/perl-install/standalone/drakxconf +++ b/perl-install/standalone/drakxconf @@ -11,7 +11,7 @@ use c; local $_ = join '', @ARGV; -/-h/ and die "usage: draxconf\n"; +/-h/ and die "usage: drakxconf\n"; $::isStandalone = 1; @@ -20,7 +20,7 @@ my $in = vnew interactive('su'); my $choice = $in->ask_from_list("drakxconf", _("Choose the tool you want to use"), [ grep { my $prog = $_; int grep { -x "$_/$prog" } split ":", $ENV{PATH} } - qw(XFdrake diskdrake keyboarddrake mousedrake netdrake printerdrake ) ]) or c::_exit(0); #- workaround for perl-GTK + qw(XFdrake adduserdrake diskdrake drakxservices keyboarddrake mousedrake netdrake printerdrake draksec drakboot) ]) or c::_exit(0); #- workaround for perl-GTK $in->end; diff --git a/perl-install/standalone/drakxservices b/perl-install/standalone/drakxservices index 621def75f..63318a031 100755 --- a/perl-install/standalone/drakxservices +++ b/perl-install/standalone/drakxservices @@ -2,8 +2,10 @@ use lib qw(/usr/lib/libDrakX); -use common qw(:common :functional); +use common qw(:common :functional :file); use interactive; +use services; +use log; local $_ = join '', @ARGV; @@ -12,19 +14,7 @@ local $_ = join '', @ARGV; $::isStandalone = 1; my $in = vnew interactive('su'); - -my @l = map { chop; $_ } `cd /etc/rc.d/init.d ; grep -l "chkconfig:" *`; -my @before = map { bool(@_ = glob("/etc/rc.d/rc*.d/*$_")) } @l; - -my $after = $in->ask_many_from_list("drakxservices", -_("Choose which services should be automatically started at boot time"), - \@l, \@before); - -mapn { - my ($name, $before, $after) = @_; - if ($before != $after) { - system("chkconfig", $after ? "--add" : "--del", $name); - } -} \@l, \@before, $after; +my $l = services::ask($in); +services::doit($in, $l) if $l; $in->exit(0); diff --git a/perl-install/standalone/icons/findf.xpm b/perl-install/standalone/icons/findf.xpm index 91b25cee5..792007335 100644 --- a/perl-install/standalone/icons/findf.xpm +++ b/perl-install/standalone/icons/findf.xpm @@ -1,28 +1,31 @@ /* XPM */ -/* Drawn by Nico Schwiring and Mark Donohoe for the K Desktop Environment */ -/* See http://www.kde.org */ -static char*kfind[]={ -"16 16 6 1", -"# c #000000", -"d c #c0c0c0", -"a c #ffffff", -"b c #0000ff", -"c c #bebeff", -". c None", -".###########....", -"#aaaaaaaaaaa#...", -"#aaaaaaaabca#...", -"#aaaaaaaaaba#...", -"#aaaad###daa#...", -"#aaad#aaa#da#...", -"#aaa#acaca#a#...", -"#aaa#abbaa#a#...", -"#aaa#aabca#a#...", -"#aaad#aaa##a#...", -"#bcaad####a##...", -"#abaaaaaaa#a#...", -"#aaaaaaaaaa#a#..", -"#aabcaaaaaaa#a#.", -".###########.#a#", -"..............#."}; - +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 index e70d56d19..d0326d3ce 100644 --- a/perl-install/standalone/icons/ftin.xpm +++ b/perl-install/standalone/icons/ftin.xpm @@ -1,24 +1,30 @@ /* XPM */ -static char * kmfolderin_xpm[] = { -/* width height num_colors chars_per_pixel */ -"15 13 5 1", -/* colors */ +static char * ftin_xpm[] = { +"15 22 5 1", " c None", -". c red3", -"X c white", -"o c #c0c0c0", -"O c #808080", -/* pixels */ +". c #CD0000", +"+ c #FFFFFF", +"@ c #C0C0C0", +"# c #808080", +" ", +" ", +" ", +" ", +" ", " . . ", " ... ", -" ...XXXXXXXX", -" ...ooooooXX", -" .......XXXXXO", -" .....oooXXOX", -" XX...XXXXXOXO", -" Xooo.oooXXOXOX", -"XXXXXXXXXXOXOX ", -"OOOOOOOOOOXOX ", -"XXXXXXXXXXOX ", -"OOOOOOOOOOX ", -"XXXXXXXXXX "}; +" ...++++++++", +" ...@@@@@@++", +" .......+++++#", +" .....@@@++#+", +" ++...+++++#+#", +" +@@@.@@@++#+#+", +"++++++++++#+#+ ", +"##########+#+ ", +"++++++++++#+ ", +"##########+ ", +"++++++++++ ", +" ", +" ", +" ", +" "}; diff --git a/perl-install/standalone/icons/ftout.xpm b/perl-install/standalone/icons/ftout.xpm index db28a8e5d..b4e0135b8 100644 --- a/perl-install/standalone/icons/ftout.xpm +++ b/perl-install/standalone/icons/ftout.xpm @@ -1,24 +1,30 @@ /* XPM */ -static char * kmfolderout_xpm[] = { -/* width height num_colors chars_per_pixel */ -"15 13 5 1", -/* colors */ +static char * ftout_xpm[] = { +"15 22 5 1", " c None", -". c blue4", -"X c white", -"o c #c0c0c0", -"O c #808080", -/* pixels */ +". c #00008B", +"+ c #FFFFFF", +"@ c #C0C0C0", +"# c #808080", +" ", +" ", +" ", +" ", +" ", " . ", " ... ", -" .....XXXXXXX", -" .......ooooXX", -" ...XXXXXXXO", -" X...ooooXXOX", -" XX...XXXXXOXO", -" Xoo.X.ooXXOXOX", -"XXXXXXXXXXOXOX ", -"OOOOOOOOOOXOX ", -"XXXXXXXXXXOX ", -"OOOOOOOOOOX ", -"XXXXXXXXXX "}; +" .....+++++++", +" .......@@@@++", +" ...+++++++#", +" +...@@@@++#+", +" ++...+++++#+#", +" +@@.+.@@++#+#+", +"++++++++++#+#+ ", +"##########+#+ ", +"++++++++++#+ ", +"##########+ ", +"++++++++++ ", +" ", +" ", +" ", +" "}; diff --git a/perl-install/standalone/keyboarddrake b/perl-install/standalone/keyboarddrake index 9bb77e6bb..b12a3f152 100755 --- a/perl-install/standalone/keyboarddrake +++ b/perl-install/standalone/keyboarddrake @@ -7,23 +7,24 @@ use interactive; use keyboard; use Xconfigurator_consts; use common qw(:system); +use c; local $_ = join '', @ARGV; -/-h/ and die "usage: keyboarddrake [--expert]\n"; +/-h/ and die _("usage: keyboarddrake [--expert]\n"); -$::expert = /--expert/; +$::expert = /-expert/; $::isStandalone = 1; -my $in = vnew interactive; +my $in = interactive->vnew('su'); -my $keyboard = keyboard::text2keyboard( - $in->ask_from_list_(_("Keyboard"), - _("What is your keyboard layout?"), - [ keyboard::list() ], - keyboard::keyboard2text(keyboard::read('')))); +my $keyboard = $in->ask_from_listf_(_("Keyboard"), + _("Please, choose your keyboard layout."), + \&keyboard::keyboard2text, + [ keyboard::xmodmaps() ], + keyboard::read()); -my $isNotDelete = $::expert && !$in->ask_yesorno("BackSpace", "Do you want the BackSpace to return Delete in console?", 1); +my $isNotDelete = $::expert && !$in->ask_yesorno("BackSpace", _("Do you want the BackSpace to return Delete in console?"), 1); my $kmap = keyboard::keyboard2kmap($keyboard); `loadkeys $kmap`; @@ -32,14 +33,24 @@ my $xkb = keyboard::keyboard2xkb($keyboard); `setxkbmap $xkb`; my $f = "/etc/X11/XF86Config"; +my $g = "/etc/X11/XF86Config-4"; + substInFile { - if (/^Section "Keyboard"/ .. /^EndSection/) { + if (/^Section\s+"Keyboard"/ .. /^EndSection/) { s|^(\s*XkbLayout\s+).*|$1"$xkb"| and $_ .= join '', map { " $_\n" } @{$xkb_options{$xkb} || []}; s,^(\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) } @{$xkb_options{$xkb} || []}; + s,^(\s*Option\s+"(XkbVariant|XkbOptions)"\s+).*,,; # remove existing one + } +} $g if -e $g && !$::testing; + keyboard::write('', $keyboard, $isNotDelete); -exec 'true' if ref($in) =~ /gtk/; #- workaround for perl-GTK +$in->exit(0); diff --git a/perl-install/standalone/livedrake b/perl-install/standalone/livedrake index 397294543..f93cfefbb 100755 --- a/perl-install/standalone/livedrake +++ b/perl-install/standalone/livedrake @@ -2,16 +2,15 @@ use lib qw(/usr/lib/libDrakX); -use common qw(:common :system); +use common qw(:common :system :file); use interactive; -use mouse; +use run_program; use c; local $_ = join '', @ARGV; -/-h/ and die "usage: livedrake [--auto] [--testing]\n"; +/-h/ and die "usage: livedrake [--testing]\n"; -$::auto = /-auto/; $::testing = /-testing/; $::isStandalone = 1; @@ -24,29 +23,23 @@ while (! -x "$cd_mntpoint/Mandrake/mdkinst/usr/bin/perl-install/live_install") { $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); - eval { fs::mount("/mnt/cdrom") }; + 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/"; - exec "./live_install"; + $::testing or exec "./live_install"; } $in->ask_warn('', _("Unable to start live upgrade !!!\n")); $in->exit(1); -sub unlockCdrom(;$) { +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; - eval { $cdrom and ioctl detect_devices::tryOpen($1), c::CDROM_LOCKDOOR(), 0 }; -} - -sub ejectCdrom(;$) { - my ($cdrom) = @_; - $cdrom or cat_("/proc/mounts") =~ m|(/dev/\S+)\s+/mnt/cdrom\s| and $cdrom = $1; my $f = eval { $cdrom && detect_devices::tryOpen($cdrom) } or return; - getFile("XXX"); #- close still opened filehandle - eval { fs::umount("/mnt/cdrom") }; + run_program::run("umount", "/mnt/cdrom"); + ioctl $f, c::CDROM_LOCKDOOR(), 0; ioctl $f, c::CDROMEJECT(), 1; } diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake index 852c5e612..397a1f12a 100755 --- a/perl-install/standalone/mousedrake +++ b/perl-install/standalone/mousedrake @@ -2,50 +2,47 @@ use lib qw(/usr/lib/libDrakX); -use common qw(:system); +use common qw(:common :system); use interactive; use mouse; +use c; +require 'dumpvar.pl'; local $_ = join '', @ARGV; -/-h/ and die "usage: mousedrake [--auto] [--noauto] [--testing]\n"; +/-h/ and die "usage: mousedrake [--auto] [--testing]\n"; -$::auto = /--auto/; -$::noauto = /--noauto/; -$::testing = /--testing/; +$::auto = /-auto/; +$::testing = /-testing/; $::isStandalone = 1; -my $in = vnew interactive; +my $in = vnew interactive('su'); -my $mouse = mouse::detect() unless $::noauto; +my ($mouse) = mouse::detect() unless $::noauto; -if (!(my $name = $mouse->{FULLNAME}) || !$::auto) { - $name ||= "Generic Mouse (serial)"; - $name = $in->ask_from_list_('', _("What is the type of your mouse?"), [ mouse::names() ], $name); - $mouse = mouse::name2mouse($name); +if (!$mouse || !$::auto) { + $mouse ||= mouse::fullname2mouse("serial|Generic 2 Button Mouse"); + my $name = $in->ask_from_treelistf('', _("Please, choose the type of your mouse."), '|', + sub { join '|', map { translate($_) } split '\|', $_[0] }, + [ mouse::fullnames ], + $mouse->{type} . '|' . $mouse->{name}); + $mouse = mouse::fullname2mouse($name); if ($mouse->{device} eq "usbmouse") { + require pci_probing::main; my ($c) = pci_probing::main::probe("serial_usb") or die _("no serial_usb found\n"); eval { modules::load($c->[1], "serial_usb") }; } } - $mouse->{XEMU3} = 'yes' if $mouse->{nbuttons} < 3 && (!$::noauto || $in->ask_yesorno('', _("Emulate third button?"), 1)); -$mouse->{device} = mouse::serial_ports_names2dev( - $in->ask_from_list(_("Mouse Port"), - _("Which serial port is your mouse connected to?"), - [ mouse::serial_ports_names() ])) if $mouse->{device} eq "ttyS"; - -mouse::write('', $mouse); -modules::write_conf("/etc/conf.modules") if $mouse->{device} eq "usbmouse" && !$::testing; +$o->{mouse}{device} = + $o->ask_from_listf(_("Mouse Port"), + _("Please choose on which serial port your mouse is connected to."), + \&mouse::serial_port2text, + [ mouse::serial_ports ]) if $mouse->{type} eq 'serial'; -my $f = "/etc/X11/XF86Config"; -substInFile { - if (/^Section "Pointer"/ .. /^EndSection/) { - s|^(\s*Protocol\s+).*|$1 "$mouse->{XMOUSETYPE}"|; - s|^(\s*Device\s+).*|$1 "/dev/mouse"|; - } -} $f if -e $f && !$::testing; +dumpValue(\$mouse); +mouse::write_conf($mouse); -exec 'true' if ref($in) =~ /gtk/; #- workaround for perl-GTK +$in->exit(0); diff --git a/perl-install/standalone/printerdrake b/perl-install/standalone/printerdrake index 3ccd01311..cee224da9 100755 --- a/perl-install/standalone/printerdrake +++ b/perl-install/standalone/printerdrake @@ -21,22 +21,29 @@ use lib qw(/usr/lib/libDrakX); use interactive; +use printer; use printerdrake; +use c; local $_ = join '', @ARGV; /-h/ and die "usage: printerdrake [--beginner] [--expert] [--auto] [--noauto] [--skiptest] [--testing]\n"; -$::beginner = /--beginner/; -$::expert = /--expert/; -$::auto = /--auto/; -$::noauto = /--noauto/; -$::skiptest = /--skiptest/; -$::testing = /--testing/; +$::beginner = /-beginner/; +$::expert = /-expert/; +$::auto = /-auto/; +$::noauto = /-noauto/; +$::skiptest = /-skiptest/; +$::testing = /-testing/; $::isStandalone = 1; -my $in = vnew interactive; +my $printer; eval { $printer = printer::getinfo('') }; +/-lpr/ and $printer->{mode} = 'lpr'; +/-cups/ and $printer->{mode} = 'CUPS'; +$printer->{mode} ||= 'CUPS'; #- assume this default if nothing found. -printerdrake::main('', printerdrake::getinfo(''), $in, sub { `urpmi --auto $_[0]` }); +my $in = vnew interactive('su'); -exec 'true' if ref($in) =~ /gtk/; #- workaround for perl-GTK +printerdrake::main($printer, $in, sub { $in->suspend; system("urpmi --auto --best-output " . join(' ', @_)); $in->resume; }); + +$in->exit(0); |