diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-01-13 09:01:04 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-01-13 09:01:04 +0000 |
commit | 8ace139532ce4f5d8cba9e1533aeb2db2180a6cb (patch) | |
tree | ae9110d4908af05d1d520c66ff77a2688ee0f4fa /perl-install/printer | |
parent | 80ebe4ae36c84e74c2e2d7b58ca8524f0a6205ad (diff) | |
download | drakx-8ace139532ce4f5d8cba9e1533aeb2db2180a6cb.tar drakx-8ace139532ce4f5d8cba9e1533aeb2db2180a6cb.tar.gz drakx-8ace139532ce4f5d8cba9e1533aeb2db2180a6cb.tar.bz2 drakx-8ace139532ce4f5d8cba9e1533aeb2db2180a6cb.tar.xz drakx-8ace139532ce4f5d8cba9e1533aeb2db2180a6cb.zip |
add_spooler_to_security_level(), configure_queue()
and config_sane() :
factorize common code, aka resuse MDK::Common
Diffstat (limited to 'perl-install/printer')
-rw-r--r-- | perl-install/printer/main.pm | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index e53442866..592843631 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -156,10 +156,7 @@ sub add_spooler_to_security_level { $sp = $spooler eq "lpr" || $spooler eq "lprng" ? "lpd" : $spooler; my $file = "$::prefix/etc/security/msec/server.$level"; if (-f $file) { - local *F; - open F, ">> $file" or return 0; - print F "$sp\n"; - close F; + eval { append_to_file($file, "$sp\n") } or return 0; } return 1; } @@ -1544,9 +1541,7 @@ sub configure_queue($) { # Add a comment line containing the path of the used PPD file to the # end of the PPD file if ($printer->{currentqueue}{ppd} ne '1') { - local *F; - open F, ">> $::prefix/etc/cups/ppd/$printer->{currentqueue}{queue}.ppd"; - print F "*%MDKMODELCHOICE:$printer->{currentqueue}{ppd}\n"; + append_to_file("$::prefix/etc/cups/ppd/$printer->{currentqueue}{queue}.ppd", "*%MDKMODELCHOICE:$printer->{currentqueue}{ppd}\n"); } # Copy the old queue's PPD file to the new queue when it is renamed, # to conserve the option settings @@ -2137,11 +2132,8 @@ sub config_sane { # config file /etc/sane.d/hpoj.conf necessary, the HPOJ driver finds the # scanner automatically) return if member("hpoj", chomp_(cat_("$::prefix/etc/sane.d/dll.conf"))); - local *F; - open F, ">> $::prefix/etc/sane.d/dll.conf" or - die "can't write SANE config in /etc/sane.d/dll.conf: $!"; - print F "hpoj\n"; - close F; + eval { append_to_file("$::prefix/etc/sane.d/dll.conf", "hpoj\n") } or + die "can't write SANE config in /etc/sane.d/dll.conf: $!"; } sub config_photocard { |