From 06edf44669168d733e87aaf77a2d6d2ae98b622f Mon Sep 17 00:00:00 2001 From: Yves Duret Date: Sat, 30 Mar 2002 10:21:18 +0000 Subject: bugs fixes, code clean up, more mdkish.. --- perl-install/standalone/drakbackup | 76 ++++++++++++++++---------------------- perl-install/standalone/drakfont | 25 +++++-------- 2 files changed, 42 insertions(+), 59 deletions(-) (limited to 'perl-install') diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup index 05a2ad165..bc7528b8d 100755 --- a/perl-install/standalone/drakbackup +++ b/perl-install/standalone/drakbackup @@ -272,26 +272,14 @@ sub daemon_mode { interactive_mode(); sub all_user_list { - my ($username) = @_; - my $passwdfile = "/etc/passwd"; - my $user; - my $uid; + my ($uname, $uid); @all_user_list = (); - - open (PASSWD, $passwdfile) or exit 1; - while (defined(my $line = )) { - chomp($line); - ($user, $uid) = (split(/:/, $line))[0, 2]; - if ($uid >= 500 || $uid == 0 ) { - push @all_user_list, $user; - } - } - close (PASSWD); - if ($DEBUG) { - print "/-- User list --/ \n"; - print " -> $_\n" foreach (@all_user_list); - print "\n"; - } + 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 { @@ -959,31 +947,31 @@ sub advanced_where_net_ftp { 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), + $box_where_net = gtkpack__(new Gtk::VBox(0, 15), + new Gtk::HSeparator, + my $check_where_net_ftp = new Gtk::CheckButton( _("Use FTP connection to backup") ), + new Gtk::HSeparator, + 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), + gtkpack_(new Gtk::HBox(0,10), + 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), + 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), + 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), + ), + 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), ), @@ -1244,15 +1232,15 @@ sub advanced_where{ 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_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 { @@ -1267,11 +1255,11 @@ sub advanced_where{ 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_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")), diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont index 80bcc560e..817e2c0a8 100755 --- a/perl-install/standalone/drakfont +++ b/perl-install/standalone/drakfont @@ -181,9 +181,8 @@ 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 $ttmkfdir = '/usr/sbin/ttmkfdir'; my $ghostscript; -#my $ttmkfdir = '/usr/sbin/ttmkfdir'; # Global lists, just to manipulate it easily. # my @font_list => list of fonts to install. @@ -352,15 +351,13 @@ sub put_font_dir { } $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 ; for i in *.TTF; do mv -f $i `basename $i .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`; + system ('cd '.$drakfont_dir.'/ttf && $ttmkfdir > fonts.dir' ); $interactive and progress($pbar2, 0.10, _("True Type install done")); - my $update_chkfontpath = "$chkfontpath -a $drakfont_dir/ttf"; + my $restart_xfs = "$chkfontpath -a $drakfont_dir/ttf"; if ($so && $gs) { my @glob_drak = glob ("$drakfont_dir/tmp/tmp/*.ttf"); @@ -376,7 +373,7 @@ sub put_font_dir { 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"; + $restart_xfs .= "; $chkfontpath -a $drakfont_dir/Type1"; } if (!$so && $gs) { @@ -391,7 +388,7 @@ sub put_font_dir { 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"; + $restart_xfs .= "; $chkfontpath -a $drakfont_dir/Type1"; } if ($so && !$gs) { @@ -407,7 +404,7 @@ sub put_font_dir { 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"; + $restart_xfs .= "; $chkfontpath -a $drakfont_dir/Type1"; } $interactive and progress($pbar2, 0.01, _("done")); @@ -415,10 +412,8 @@ sub put_font_dir { 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'); + system ($restart_xfs); + system('kill -USR1 `/sbin/pidof xfs` 2&1>/dev/null'); $interactive and progress($pbar3, 0.30, _("done")); } } -- cgit v1.2.1