diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2004-09-01 11:13:37 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2004-09-01 11:13:37 +0000 |
commit | 1981a5cae03aa21e411055a007aea2a5539ba708 (patch) | |
tree | 321f5f9bba5aebb3eb855ea7f434c99d7192a80b /perl-install/printer | |
parent | 8def2378cfbc0d16131378e0dec7d19e15425307 (diff) | |
download | drakx-backup-do-not-use-1981a5cae03aa21e411055a007aea2a5539ba708.tar drakx-backup-do-not-use-1981a5cae03aa21e411055a007aea2a5539ba708.tar.gz drakx-backup-do-not-use-1981a5cae03aa21e411055a007aea2a5539ba708.tar.bz2 drakx-backup-do-not-use-1981a5cae03aa21e411055a007aea2a5539ba708.tar.xz drakx-backup-do-not-use-1981a5cae03aa21e411055a007aea2a5539ba708.zip |
- If cupsd.conf is read but does not exist, use default settings for all settings which are required. This prevents from writing a corrupt cupsd.conf
- Write cupsd.conf only if it exists already (cups package installed).
- Create /etc/cups directory if it does not exist when client.conf is written
- Return something reasonable if client.conf is tried to be read but does not exist.
- Write mime.convs only if it exists already (cups package installed).
Diffstat (limited to 'perl-install/printer')
-rw-r--r-- | perl-install/printer/main.pm | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 185c17f8b..21f6bf24e 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -702,6 +702,10 @@ sub get_usermode() { $sysconfig{USER_MODE} eq 'expert' ? 1 : 0 } sub set_jap_textmode { my $textmode = ($_[0] ? 'cjk' : ''); + # Do not write mime.convs if the file does not exist, as then + # CUPS is not installed and the created mime.convs will be broken. + # When installing CUPS later it will not work. + return 1 if (! -r "$::prefix/etc/cups/mime.convs"); substInFile { s!^(\s*text/plain\s+\S+\s+\d+\s+)\S+(\s*$)!$1${textmode}texttops$2! } "$::prefix/etc/cups/mime.convs"; @@ -719,11 +723,44 @@ sub get_jap_textmode() { # Handling of /etc/cups/cupsd.conf sub read_cupsd_conf() { - cat_("$::prefix/etc/cups/cupsd.conf"); + # If /etc/cups/cupsd.conf a default cupsd.conf will be put out to avoid + # writing of a broken cupsd.conf file when we write it back later. + my @cupsd_conf = cat_("$::prefix/etc/cups/cupsd.conf"); + if (!@cupsd_conf) { + @cupsd_conf = map { /\n$/s or "$_\n" } split('\n', +'LogLevel info +TempDir /var/spool/cups/tmp +Port 631 +Browsing On +BrowseAddress @LOCAL +BrowseDeny All +BrowseAllow 127.0.0.1 +BrowseAllow @LOCAL +BrowseOrder deny,allow +<Location /> +Order Deny,Allow +Deny From All +Allow From 127.0.0.1 +Allow From @LOCAL +</Location> +<Location /admin> +AuthType Basic +AuthClass System +Order Deny,Allow +Deny From All +Allow From 127.0.0.1 +</Location> +'); + } + return @cupsd_conf; } sub write_cupsd_conf { my (@cupsd_conf) = @_; + # Do not write cupsd.conf if the file does not exist, as then + # CUPS is not installed and the created cupsd.conf will be broken. + # When installing CUPS later it will not start. + return 1 if (! -r "$::prefix/etc/cups/cupsd.conf"); output("$::prefix/etc/cups/cupsd.conf", @cupsd_conf); } @@ -1386,6 +1423,7 @@ sub clean_cups_config { # Handling of /etc/cups/client.conf sub read_client_conf() { + return (0, undef) if (! -r "$::prefix/etc/cups/client.conf"); my @client_conf = cat_("$::prefix/etc/cups/client.conf"); my @servers = handle_configs::read_directives(\@client_conf, "ServerName"); @@ -1396,6 +1434,8 @@ sub read_client_conf() { sub write_client_conf { my ($daemonless_cups, $remote_cups_server) = @_; + # Create the directory for client.conf if needed + (-d "$::prefix/etc/cups/" ) || mkdir ("$::prefix/etc/cups/") || return 1; my (@client_conf) = cat_("$::prefix/etc/cups/client.conf"); if ($daemonless_cups) { handle_configs::set_directive(\@client_conf, |