diff options
author | pad <pad@mandriva.com> | 1999-09-05 21:28:36 +0000 |
---|---|---|
committer | pad <pad@mandriva.com> | 1999-09-05 21:28:36 +0000 |
commit | 38dce4a6d02d689b7aefa2b5f925ac5441c51a89 (patch) | |
tree | 78e8513e786585460ab499c1614e46dfbf1e25be /perl-install/printer.pm | |
parent | feaf2a529e993fee5bd71560d883ef354537ed6a (diff) | |
download | drakx-38dce4a6d02d689b7aefa2b5f925ac5441c51a89.tar drakx-38dce4a6d02d689b7aefa2b5f925ac5441c51a89.tar.gz drakx-38dce4a6d02d689b7aefa2b5f925ac5441c51a89.tar.bz2 drakx-38dce4a6d02d689b7aefa2b5f925ac5441c51a89.tar.xz drakx-38dce4a6d02d689b7aefa2b5f925ac5441c51a89.zip |
code clarification + bugfix
Diffstat (limited to 'perl-install/printer.pm')
-rw-r--r-- | perl-install/printer.pm | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm index b02fe3a10..2ea70fe8e 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -255,7 +255,7 @@ my $PRINTER_FILTER_DIR = "/usr/lib/rhs/rhs-printfilters"; NCP => [qw(NCPHOST NCPQUEUE NCPUSER NCPPASSWD)], ); @papersize_type = qw(letter legal ledger a3 a4); -$spooldir = "/var/spool/lpd/"; +$spooldir = "/var/spool/lpd"; #-##################################################################################### @@ -329,10 +329,12 @@ sub read_printer_db(;$) { #------------------------------------------------------------------------------ sub create_spool_dir($) { my ($queue_path) = @_; - my $complete_path = "$prefix$queue_path"; - - mkdir "$complete_path", 0755 - or die "An error has occurred - can't create $complete_path : $!"; + my $complete_path = "$prefix/$queue_path"; + + unless (-d $complete_path) { + mkdir "$complete_path", 0755 + or die "An error has occurred - can't create $complete_path : $!"; + } #-redhat want that "drwxr-xr-x root lp" my $gid_lp = (getpwnam("lp"))[3]; @@ -348,7 +350,7 @@ sub create_spool_dir($) { #------------------------------------------------------------------------------ sub create_config_file($$%) { my ($inputfile, $outpufile, %toreplace) = @_; - my ($in, $out) = ("$prefix$inputfile", "$prefix$outpufile"); + my ($in, $out) = ("$prefix/$inputfile", "$prefix/$outpufile"); local *OUT; local *IN; @@ -356,20 +358,18 @@ sub create_config_file($$%) { open IN , "<$in" or die "Can't open $in $!"; if ($::testing) { - open OUT, ">$out" or die "Can't open $out $!"; - } else { *OUT = *STDOUT + } else { + open OUT, ">$out" or die "Can't open $out $!"; } while (<IN>) { if (/@@@(.*)@@@/) { - my $r = $toreplace{$1} or die "I can't replace $1"; + my $r = $toreplace{$1}; s/@@@(.*)@@@/$r/g; } print OUT; } - - } @@ -414,7 +414,7 @@ sub configure_queue($) { my $get_name_file = sub { my ($name) = @_; - ("$PRINTER_FILTER_DIR/$name.in", "$entry->{SPOOLDIR}$name") + ("$PRINTER_FILTER_DIR/$name.in", "$entry->{SPOOLDIR}/$name") }; my ($filein, $file); my %fieldname = (); @@ -484,9 +484,9 @@ sub configure_queue($) { #-now the printcap file local *PRINTCAP; if ($::testing) { - open PRINTCAP, ">$prefix/etc/printcap" or die "Can't open printcap file $!"; - } else { *PRINTCAP = *STDOUT; + } else { + open PRINTCAP, ">$prefix/etc/printcap" or die "Can't open printcap file $!"; } print PRINTCAP $intro_printcap_test; @@ -513,11 +513,11 @@ sub configure_queue($) { } else { #- (pcentry->Type == (PRINTER_SMB | PRINTER_NCP)) print PRINTCAP "\t:lp=/dev/null:\\\n"; - print PRINTCAP "\t:af=$entry->{SPOOLDIR}acct\\\n"; + print PRINTCAP "\t:af=$entry->{SPOOLDIR}/acct\\\n"; } #- cheating to get the input filter! - print PRINTCAP "\t:if=$entry->{SPOOLDIR}filter:\n"; + print PRINTCAP "\t:if=$entry->{SPOOLDIR}/filter:\n"; } |