diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/Makefile | 2 | ||||
-rw-r--r-- | perl-install/Makefile.drakxtools | 2 | ||||
-rw-r--r-- | perl-install/Newt/Newt.xs | 3 | ||||
-rw-r--r-- | perl-install/c/stuff.xs.pm | 16 | ||||
-rw-r--r-- | perl-install/fsedit.pm | 45 | ||||
-rw-r--r-- | perl-install/install2.pm | 8 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 32 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 1 | ||||
-rw-r--r-- | perl-install/interactive.pm | 8 | ||||
-rw-r--r-- | perl-install/interactive_gtk.pm | 4 | ||||
-rw-r--r-- | perl-install/interactive_newt.pm | 2 | ||||
-rw-r--r-- | perl-install/lang.pm | 2 | ||||
-rw-r--r-- | perl-install/log.pm | 32 | ||||
-rw-r--r-- | perl-install/share/compssList | 9 | ||||
-rwxr-xr-x | perl-install/standalone/XFdrake | 5 | ||||
-rwxr-xr-x | perl-install/standalone/diskdrake | 3 | ||||
-rwxr-xr-x | perl-install/standalone/drakxconf | 27 | ||||
-rwxr-xr-x | perl-install/standalone/drakxservices | 30 | ||||
-rwxr-xr-x | perl-install/standalone/keyboarddrake | 5 | ||||
-rwxr-xr-x | perl-install/standalone/mousedrake | 5 | ||||
-rwxr-xr-x | perl-install/standalone/printerdrake | 5 |
21 files changed, 212 insertions, 34 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile index 96028e3af..1e1ee064e 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -33,7 +33,7 @@ tar-drakxtools: clean $(MAKE) -C ../tools clean cd .. ; rm -rf drakxtools ; cp -af perl-install drakxtools ; cp -af tools/ddcprobe tools/pnp_serial drakxtools cd ../drakxtools ; rm -rf install* ForMakefile.pm pkgs.pm ftp.pm t.pm standalone/CVS ; mv Makefile.drakxtools Makefile ; mv -f standalone/* . - cd .. ; tar cfy drakxtools.tar.bz2 --exclude CVS $(patsubst %,drakxtools/%,Makefile MonitorsDB Newt c ddcprobe pnp_serial po pci_probing resize_fat diskdrake diskdrake.rc XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake *.pm) + cd .. ; tar cfy drakxtools.tar.bz2 --exclude CVS $(patsubst %,drakxtools/%,Makefile MonitorsDB Newt c ddcprobe pnp_serial po pci_probing resize_fat diskdrake diskdrake.rc XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake drakxconf drakxservices *.pm) cd .. ; rm -rf drakxtools $(DIRS): diff --git a/perl-install/Makefile.drakxtools b/perl-install/Makefile.drakxtools index 8bc1ab03c..d48457a8e 100644 --- a/perl-install/Makefile.drakxtools +++ b/perl-install/Makefile.drakxtools @@ -16,7 +16,7 @@ $(DIRS): install: install -d $(BINDEST) $(ETCDEST) $(SBINDEST) $(LIBDEST) $(X11DEST) $(DIRS:%=$(LIBDEST)/%) - install diskdrake XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake $(SBINDEST) + install diskdrake XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake drakxconf drakxservices $(SBINDEST) install -s ddcprobe/ddcxinfos pnp_serial/pnp_serial $(SBINDEST) for i in *.pm ; do perl -pe '$$_ = "\n" if /\s*use\s+(diagnostics|vars|strict)/' $$i > $(LIBDEST)/$$i ; done diff --git a/perl-install/Newt/Newt.xs b/perl-install/Newt/Newt.xs index e60583de1..e3e71be68 100644 --- a/perl-install/Newt/Newt.xs +++ b/perl-install/Newt/Newt.xs @@ -63,6 +63,9 @@ newtFinished() void newtCls() +#void +#newtSuspend() + int newtCenteredWindow(width,height,title) int width; diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index 6ca1e32d3..322266c67 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -5,6 +5,7 @@ print ' #include <ctype.h> #include <unistd.h> +#include <syslog.h> #include <fcntl.h> #include <resolv.h> #include <sys/types.h> @@ -96,6 +97,21 @@ lseek_sector(fd, sector, offset) RETVAL void +openlog(ident) + char *ident + CODE: + openlog(ident, 0, 0); + +void +closelog() + +void +syslog(mesg) + char *mesg + CODE: + syslog(LOG_WARNING, mesg); + +void setsid() void diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 1bca50f5c..4e31ae49a 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -105,17 +105,50 @@ sub get_root($) { } sub get_root_ { get_root([ get_fstab(@{$_[0]}) ]) } +sub is_one_big_fat { + my ($hds) = @_; + @$hds == 1 or return; + + my @l = fsedit::get_fstab(@$hds); + @l == 1 && isFat($l[0]) && fsedit::free_space(@$hds) < 10 << 11; +} + sub computeSize($$$$) { my ($part, $best, $hds, $suggestions) = @_; my $max = $part->{maxsize} || $part->{size}; - my $tot_ratios = sum(map { $_->{ratio} } grep { !has_mntpoint($_->{mntpoint}, $hds) } @$suggestions); + return min($max, $best->{size}) unless $best->{ratio}; + + my $free_space = free_space(@$hds); + my @l = my @L = grep { + if (!has_mntpoint($_->{mntpoint}, $hds) && $free_space >= $_->{size}) { + $free_space -= $_->{size}; + 1; + } else { 0 } } @$suggestions; + + my $tot_ratios = 0; + while (1) { + my $old_free_space = $free_space; + my $old_tot_ratios = $tot_ratios; + + $tot_ratios = sum(map { $_->{ratio} } @l); + last if $tot_ratios == $old_tot_ratios; + + @l = grep { + if ($_->{ratio} && $_->{maxsize} && $tot_ratios && + $_->{size} + $_->{ratio} / $tot_ratios * $old_free_space >= $_->{maxsize}) { + return min($max, $best->{maxsize}) if $best->{mntpoint} eq $_->{mntpoint}; + $free_space -= $_->{maxsize} - $_->{size}; + 0; + } else { + $_->{ratio}; + } + } @l; + } + my $size = min($max, $best->{size} + $free_space * ($tot_ratios && $best->{ratio} / $tot_ratios)); - min($max, - $best->{maxsize} || $max, - $best->{size} - + free_space(@$hds) - * ($tot_ratios && $best->{ratio} / $tot_ratios)); + #- verify other entry can fill the hole + if (grep { $_->{size} < $max - $size } @L) { $size } else { $max } } sub suggest_part($$$;$) { diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 4aa49b6e4..650ade256 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -123,6 +123,12 @@ $o = $::o = { #- packages => [ qw() ], partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0, autoformat => 0 }, #- , readonly => 0 #- security => 2, + partitions => [ + { mntpoint => "/boot", size => 10 << 11, type => 0x83, maxsize => 30 << 11 }, + { mntpoint => "/", size => 300 << 11, type => 0x83, ratio => 5, maxsize => 1500 << 11 }, + { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 }, + { mntpoint => "/home", size => 300 << 11, type => 0x83, ratio => 5 }, + ], #- partitions => [ #- { mntpoint => "/boot", size => 16 << 11, type => 0x83 }, #- { mntpoint => "/", size => 256 << 11, type => 0x83 }, @@ -604,7 +610,7 @@ sub main { "DRAKX_PASSWORD=$o->{lilo}{password}\n", 'DRAKX_USERS="', join(" ", map { $_->{name} } @{$o->{users} || []}), qq("\n)); run_program::rooted($o->{prefix}, "/etc/security/msec/init.sh", $o->{security}); - unlink "$o->{prefix}/tmp/secure.DrakX"; +# unlink "$o->{prefix}/tmp/secure.DrakX"; run_program::rooted($o->{prefix}, "kudzu", "-q"); # -q <=> fermetagueuleconnard diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 7afb02d4b..460835d18 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -245,6 +245,38 @@ sub selectLanguage { sub doPartitionDisks($$) { my ($o, $hds, $raid) = @_; + if (!$::isStandalone && fsedit::is_one_big_fat($hds)) { + #- wizard + my $min_linux = 600 << 11; + my $min_freewin = 100 << 11; + + my ($part) = fsedit::get_fstab(@{$o->{hds}}); + my $w = $o->wait_message(_("Resizing"), _("Computing fat filesystem bounds")); + my $resize_fat = eval { resize_fat::main->new($part->{device}, devices::make($part->{device})) }; + my $min_win = $resize_fat->min_size; + if (!$@ && $part->{size} > $min_linux + $min_freewin + $min_win && $o->ask_okcancel('', +_("TODO"))) { + my $oldsize = $part->{size}; + $hds->[0]{isDirty} = $hds->[0]{needKernelReread} = 1; + $part->{size} -= $min_linux; + partition_table::adjustEnd($hds->[0], $part); + + local *log::l = sub { $w->set(join(' ', @_)) }; + eval { $resize_fat->resize($part->{size}) }; + if ($@) { + $part->{size} = $oldsize; + $o->ask_warn('', _("Automatic resizing failed")); + } else { + $part->{isFormatted} = 1; + eval { fsedit::auto_allocate($hds, $o->{partitions}) }; + if (!$@) { + partition_table::write($hds->[0]) unless $::testing; + return; + } + } + } + } + while (1) { diskdrake::main($hds, $raid, interactive_gtk->new, $o->{partitions}); if (!grep { isSwap($_) } fsedit::get_fstab(@{$o->{hds}})) { diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 8f7603dce..634a2cc72 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -787,6 +787,7 @@ sub setupXfree { { local $::testing = 0; #- unset testing local $::auto = $::beginner; local $::noauto = $::expert && !$o->ask_yesorno('', _("Try to find PCI devices?"), 1); + $::noauto = $::noauto; #- no warning Xconfigurator::main($o->{prefix}, $o->{X}, $o, $o->{allowFB}, sub { install_any::pkg_install($o, "XFree86-$_[0]"); diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index 6686f2999..824bd795f 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -39,11 +39,16 @@ sub new($) { } sub vnew { + my ($type, $su) = @_; + $su = $su eq "su"; require c; if (c::Xtest($ENV{DISPLAY} ||= ":0")) { + $su && $> && exec "kdesu", "-c", "$0 @ARGV"; require interactive_gtk; interactive_gtk->new; } else { + $su && $> && die "you must be root to run this program"; + require 'log.pm'; undef *log::l; *log::l = sub {}; # otherwise, it will bother us :( require interactive_newt; @@ -51,6 +56,9 @@ sub vnew { } } +sub end {} +sub exit { exit($_[0]) } + #-###################################################################################### #- Interactive functions #-###################################################################################### diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index 00ec1731a..c857ea85b 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -19,6 +19,10 @@ use my_gtk qw(:helpers :wrappers); #- $o->SUPER::ask_warn(@_); #-} +sub exit { + c::_exit($_[0]) #- workaround +} + sub ask_from_listW { my ($o, $title, $messages, $l, $def) = @_; diff --git a/perl-install/interactive_newt.pm b/perl-install/interactive_newt.pm index 729453c60..5094efe13 100644 --- a/perl-install/interactive_newt.pm +++ b/perl-install/interactive_newt.pm @@ -20,10 +20,12 @@ sub new() { Newt::changeColors; Newt::Cls; Newt::SetSuspendCallback; + open STDERR,">/dev/null"; bless {}, $_[0]; } sub end() { Newt::Finished } +sub exit() { end; exit($_[0]) } END { end() } sub myTextbox { diff --git a/perl-install/lang.pm b/perl-install/lang.pm index 0b498e413..9cf281af2 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -200,7 +200,7 @@ sub load_po($) { $s .= "\%$lang = ("; #- $lang = substr($lang, 0, 2); - my $f; -e ($f = "$_/po/$lang.po") and last foreach @INC; + my $f; -e ($f = "$_/po/$lang.po ") and last foreach @INC; unless (-e $f) { -e ($f = "$_") and last foreach @INC; $f = commands::install_cpio("$f/po", "$lang.po"); diff --git a/perl-install/log.pm b/perl-install/log.pm index 2e1da1a77..853cabc8c 100644 --- a/perl-install/log.pm +++ b/perl-install/log.pm @@ -2,6 +2,7 @@ package log; use diagnostics; use strict; +use c; #-##################################################################################### @@ -14,33 +15,42 @@ my $logDebugMessages = 0; #-###################################################################################### #- Functions #-###################################################################################### -sub fd() { fileno LOG } sub F() { *LOG } sub l { $logOpen or openLog(); - print LOG "* ", @_, "\n"; - print LOG2 "* ", @_, "\n"; + if ($::isStandalone) { + c::syslog(join "", @_); + } else { + print LOG "* ", @_, "\n"; + print LOG2 "* ", @_, "\n"; + } } sub ld { $logDebugMessages and &l } sub w { &l } sub openLog(;$) { if ($::isStandalone) { - open LOG, ">&STDERR"; - } elsif ($_[0]) { #- useLocal - open LOG, "> $_[0]";# or die "no log possible :("; + c::openlog("DrakX"); } else { - open LOG, "> /dev/tty3" or open LOG, ">> /tmp/install.log";# or die "no log possible :("; + if ($_[0]) { #- useLocal + open LOG, "> $_[0]";# or die "no log possible :("; + } else { + open LOG, "> /dev/tty3" or open LOG, ">> /tmp/install.log";# or die "no log possible :("; + } + open LOG2, ">> /tmp/ddebug.log";# or die "no log possible :("; + select((select(LOG), $| = 1)[0]); + select((select(LOG2), $| = 1)[0]); } - open LOG2, ">> /tmp/ddebug.log";# or die "no log possible :("; - select((select(LOG), $| = 1)[0]); - select((select(LOG2), $| = 1)[0]); exists $ENV{DEBUG} and $logDebugMessages = 1; $logOpen = 1; } -sub closeLog() { close LOG; close LOG2; } +sub closeLog() { + if ($::isStandalone) { + c::closelog(); + } else { close LOG; close LOG2; } +} #-###################################################################################### #- Wonderful perl :( diff --git a/perl-install/share/compssList b/perl-install/share/compssList index 84ce8e384..c590aaf90 100644 --- a/perl-install/share/compssList +++ b/perl-install/share/compssList @@ -289,6 +289,7 @@ kdf 88 0 66 kdiff 82 0 60 kdiskcat 82 0 60 kdpms 82 0 60 +kernel-headers 1 10 94 kernelcfg 15 90 80 kfortune 82 0 60 kfsstatus 82 0 60 @@ -306,7 +307,7 @@ klilo 82 0 60 klyx 70 0 58 kmag 82 0 60 kmemmon 82 0 60 -kmol 82 0 60 +kmom 82 0 60 kmpg 82 0 60 knetload 82 0 60 knewmail 82 0 60 @@ -480,7 +481,7 @@ mod_perl 0 89 31 mod_php3 0 79 21 mod_php3-imap 0 79 20 mod_php3-pgsql 0 79 20 -mouseconfig 90 0 90 +mouseconfig 0 0 0 mpage 55 0 80 mpg123 47 0 42 mswordview 60 0 54 @@ -601,7 +602,7 @@ slang-devel 7 0 70 sliplogin 0 23 7 slocate 99 99 99 slrn 56 0 50 -sndconfig 90 0 90 +sndconfig 0 0 0 sox 56 99 80 sox-devel 8 0 70 space_sounds 62 0 55 @@ -701,7 +702,7 @@ xboard 54 0 48 xboing 53 0 47 xcdroast 59 0 53 xchat 58 0 52 -Xconfigurator 90 0 81 +Xconfigurator 0 0 0 xcpustate 53 0 47 xdaliclock 57 0 51 xdelta 6 0 5 diff --git a/perl-install/standalone/XFdrake b/perl-install/standalone/XFdrake index 28864acc1..f4d4cb263 100755 --- a/perl-install/standalone/XFdrake +++ b/perl-install/standalone/XFdrake @@ -22,6 +22,7 @@ use lib qw(/usr/lib/libDrakX); use interactive; use Xconfigurator; use Xconfig; +use c; local $_ = join '', @ARGV; @@ -35,8 +36,8 @@ $::skiptest = /--skiptest/; $::testing = /--testing/; $::isStandalone = 1; -my $in = vnew interactive; +my $in = vnew interactive('su'); Xconfigurator::main('', Xconfig::getinfo(), $in, 0, sub { `urpmi --auto XFree86-$_[0]` }); -exec 'true' if ref($in) =~ /gtk/; #- workaround for perl-GTK +$in->exit(0); diff --git a/perl-install/standalone/diskdrake b/perl-install/standalone/diskdrake index 1a9bba3c3..036fa500a 100755 --- a/perl-install/standalone/diskdrake +++ b/perl-install/standalone/diskdrake @@ -30,6 +30,7 @@ use detect_devices; use fsedit; use fs; use log; +use c; local $_ = join '', @ARGV; @@ -68,4 +69,4 @@ 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/drakxconf b/perl-install/standalone/drakxconf new file mode 100755 index 000000000..f4adb9989 --- /dev/null +++ b/perl-install/standalone/drakxconf @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +use lib qw(/usr/lib/libDrakX); + + +use interactive; +use keyboard; +use Xconfigurator_consts; +use common qw(:system); +use c; + +local $_ = join '', @ARGV; + +/-h/ and die "usage: draxconf\n"; + +$::isStandalone = 1; + +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 + +$in->end; + +exec $choice, @ARGV or $in->exit(1); diff --git a/perl-install/standalone/drakxservices b/perl-install/standalone/drakxservices new file mode 100755 index 000000000..621def75f --- /dev/null +++ b/perl-install/standalone/drakxservices @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use lib qw(/usr/lib/libDrakX); + +use common qw(:common :functional); +use interactive; + +local $_ = join '', @ARGV; + +/-h/ and die "usage: drakxservices\n"; + +$::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; + +$in->exit(0); diff --git a/perl-install/standalone/keyboarddrake b/perl-install/standalone/keyboarddrake index 9bb77e6bb..96d345ae6 100755 --- a/perl-install/standalone/keyboarddrake +++ b/perl-install/standalone/keyboarddrake @@ -7,6 +7,7 @@ use interactive; use keyboard; use Xconfigurator_consts; use common qw(:system); +use c; local $_ = join '', @ARGV; @@ -15,7 +16,7 @@ local $_ = join '', @ARGV; $::expert = /--expert/; $::isStandalone = 1; -my $in = vnew interactive; +my $in = vnew interactive('su'); my $keyboard = keyboard::text2keyboard( $in->ask_from_list_(_("Keyboard"), @@ -42,4 +43,4 @@ substInFile { keyboard::write('', $keyboard, $isNotDelete); -exec 'true' if ref($in) =~ /gtk/; #- workaround for perl-GTK +$in->exit(0); diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake index daacb90e9..748f5761d 100755 --- a/perl-install/standalone/mousedrake +++ b/perl-install/standalone/mousedrake @@ -5,6 +5,7 @@ use lib qw(/usr/lib/libDrakX); use common qw(:system); use interactive; use mouse; +use c; local $_ = join '', @ARGV; @@ -15,7 +16,7 @@ $::noauto = /--noauto/; $::testing = /--testing/; $::isStandalone = 1; -my $in = vnew interactive; +my $in = vnew interactive('su'); my $mouse = mouse::detect() unless $::noauto; @@ -48,4 +49,4 @@ substInFile { } } $f if -e $f && !$::testing; -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..6f5a03218 100755 --- a/perl-install/standalone/printerdrake +++ b/perl-install/standalone/printerdrake @@ -22,6 +22,7 @@ use lib qw(/usr/lib/libDrakX); use interactive; use printerdrake; +use c; local $_ = join '', @ARGV; @@ -35,8 +36,8 @@ $::skiptest = /--skiptest/; $::testing = /--testing/; $::isStandalone = 1; -my $in = vnew interactive; +my $in = vnew interactive('su'); printerdrake::main('', printerdrake::getinfo(''), $in, sub { `urpmi --auto $_[0]` }); -exec 'true' if ref($in) =~ /gtk/; #- workaround for perl-GTK +$in->exit(0); |