diff options
Diffstat (limited to 'perl-install/printer/printerdrake.pm')
| -rw-r--r-- | perl-install/printer/printerdrake.pm | 4880 |
1 files changed, 0 insertions, 4880 deletions
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm deleted file mode 100644 index 80183e877..000000000 --- a/perl-install/printer/printerdrake.pm +++ /dev/null @@ -1,4880 +0,0 @@ -package printer::printerdrake; -# $Id$ - -use strict; - -use common; -use modules; -use network::network; -use log; -use interactive; -use printer::main; -use printer::services; -use printer::detect; -use printer::default; -use printer::data; - -my $shortdistroname = "Mandrakelinux"; - -my $hp1000fwtext = N("The HP LaserJet 1000 needs its firmware to be uploaded after being turned on. Download the Windows driver package from the HP web site (the firmware on the printer's CD does not work) and extract the firmware file from it by decompressing the self-extracting '.exe' file with the 'unzip' utility and searching for the 'sihp1000.img' file. Copy this file into the '/etc/printer' directory. There it will be found by the automatic uploader script and uploaded whenever the printer is connected and turned on. -"); - -1; - -sub config_cups { - my ($printer, $security, $in, $upNetwork) = @_; - - local $::isWizard = 0; - # Check whether the network functionality is configured and - # running - if (!check_network($printer, $in, $upNetwork, 0)) { return 0 }; - - #$in->set_help('configureRemoteCUPSServer') if $::isInstall; - #- hack to handle cups remote server printing, - #- first read /etc/cups/cupsd.conf for variable BrowsePoll address:port - # Return value: 0 when nothing was changed ("Apply" never pressed), 1 - # when "Apply" was at least pressed once. - my $retvalue = 0; - # Read CUPS config file - @{$printer->{cupsconfig}{cupsd_conf}} = - printer::main::read_cupsd_conf(); - printer::main::read_cups_config($printer); - # Read client.conf file - my ($daemonless_cups, $remote_cups_server) = - printer::main::read_client_conf(); - # Read state of japanese text printing mode - my $jap_textmode = printer::main::get_jap_textmode(); - # Read state for auto-correction of cupsd.conf - $printer->{cupsconfig}{autocorrection} = - printer::main::get_cups_autoconf(); - my $oldautocorr = $printer->{cupsconfig}{autocorrection}; - # Human-readable strings for hosts onto which the local printers - # are shared - my $maindone; - while (!$maindone) { - my $sharehosts = printer::main::makesharehostlist($printer); - my $browsepoll = printer::main::makebrowsepolllist($printer); - my $buttonclicked; - #- Show dialog - if ($in->ask_from_( - { - title => N("CUPS printer configuration"), - messages => N("Here you can choose whether the printers connected to this machine should be accessible by remote machines and by which remote machines.") . - N("You can also decide here whether printers on remote machines should be automatically made available on this machine."), - }, - [ - { text => N("The printers on this machine are available to other computers"), type => 'bool', - val => \$printer->{cupsconfig}{localprintersshared}, - disabled => sub { - $daemonless_cups; - } }, - { text => N("Automatically find available printers on remote machines"), type => 'bool', - val => \$printer->{cupsconfig}{remotebroadcastsaccepted}, - disabled => sub { - $daemonless_cups; - } }, - { val => N("Printer sharing on hosts/networks: ") . - ($printer->{cupsconfig}{customsharingsetup} ? - N("Custom configuration") : - ($#{$sharehosts->{list}} >= 0 ? - ($#{$sharehosts->{list}} > 1 ? - join(", ", @{$sharehosts->{list}}[0,1]) . " ..." : - join(", ", @{$sharehosts->{list}})) : - N("No remote machines"))), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = "sharehosts"; - 1; - }, - disabled => sub { - $daemonless_cups || - (!$printer->{cupsconfig}{localprintersshared} && - !$printer->{cupsconfig}{remotebroadcastsaccepted}); - } }, - { val => N("Additional CUPS servers: ") . - ($#{$browsepoll->{list}} >= 0 ? - ($#{$browsepoll->{list}} > 1 ? - join(", ", @{$browsepoll->{list}}[0,1]) . " ..." : - join(", ", @{$browsepoll->{list}})) : - N("None")), - type => 'button', - help => N("To get access to printers on remote CUPS servers in your local network you only need to turn on the \"Automatically find available printers on remote machines\" option; the CUPS servers inform your machine automatically about their printers. All printers currently known to your machine are listed in the \"Remote printers\" section in the main window of Printerdrake. If your CUPS server(s) is/are not in your local network, you have to enter the IP address(es) and optionally the port number(s) here to get the printer information from the server(s)."), - clicked_may_quit => sub { - $buttonclicked = "browsepoll"; - 1; - }, - disabled => sub { - $daemonless_cups; - } }, - { text => N("Japanese text printing mode"), - help => N("Turning on this allows to print plain text files in Japanese language. Only use this function if you really want to print text in Japanese, if it is activated you cannot print accentuated characters in latin fonts any more and you will not be able to adjust the margins, the character size, etc. This setting only affects printers defined on this machine. If you want to print Japanese text on a printer set up on a remote machine, you have to activate this function on that remote machine."), - type => 'bool', - val => \$jap_textmode, - disabled => sub { - $daemonless_cups; - } }, - if_($printer->{expert}, - { text => N("Automatic correction of CUPS configuration"), - type => 'bool', - help => N("When this option is turned on, on every startup of CUPS it is automatically made sure that - -- if LPD/LPRng is installed, /etc/printcap will not be overwritten by CUPS - -- if /etc/cups/cupsd.conf is missing, it will be created - -- when printer information is broadcasted, it does not contain \"localhost\" as the server name. - -If some of these measures lead to problems for you, turn this option off, but then you have to take care of these points."), - val => \$printer->{cupsconfig}{autocorrection}, - disabled => sub { - $daemonless_cups; - } }), - { val => N("Remote CUPS server and no local CUPS daemon") . - ": " . - ($daemonless_cups ? - N("On") . "; " . N("Server") . ": " . - $remote_cups_server : - N("Off")), - help => N("In this mode the local CUPS daemon will be stopped and all printing requests go directly to the server specified below. Note that it is not possible to define local print queues then and if the specified server is down it cannot be printed at all from this machine."), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = "daemonlesscups"; - 1; - } }, - ] - ) - ) { - if ($buttonclicked eq "sharehosts") { - # Show dialog to add hosts to share printers to - my $subdone = 0; - my $choice; - while (!$subdone) { - # Entry should be edited when double-clicked - $buttonclicked = "edit"; - $in->ask_from_( - { title => N("Sharing of local printers"), - messages => N("These are the machines and networks on which the locally connected printer(s) should be available:"), - ok => "", - cancel => "", - }, - # List the hosts - [ { val => \$choice, format => \&translate, - sort => 0, separator => "####", - tree_expanded => 1, - quit_if_double_click => 1, - allow_empty_list => 1, - list => $sharehosts->{list} }, - { val => N("Add host/network"), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = "add"; - 1; - } }, - { val => N("Edit selected host/network"), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = "edit"; - 1; - }, - disabled => sub { - return $#{$sharehosts->{list}} < 0; - } }, - { val => N("Remove selected host/network"), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = "remove"; - 1; - }, - disabled => sub { - return $#{$sharehosts->{list}} < 0; - } }, - { val => N("Done"), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = ""; - $subdone = 1; - 1; - } }, - ] - ); - if ($buttonclicked eq "add" || - $buttonclicked eq "edit") { - my ($hostchoice, $ip); - if ($buttonclicked eq "add") { - # Use first entry as default for a new entry - $hostchoice = N("Local network(s)"); - } else { - if ($sharehosts->{invhash}{$choice} =~ /^\@/) { - # Entry to edit is not an IP address - $hostchoice = $choice; - } else { - # Entry is an IP address - $hostchoice = - N("IP address of host/network:"); - $ip = $sharehosts->{invhash}{$choice}; - } - } - my @menu = N("Local network(s)"); - my @interfaces = - printer::detect::getNetworkInterfaces(); - foreach my $interface (@interfaces) { - push @menu, N("Interface \"%s\"", $interface); - } - push @menu, N("IP address of host/network:"); - # Show the dialog - my $address; - my $oldaddress = - ($buttonclicked eq "edit" ? - $sharehosts->{invhash}{$choice} : ""); - if ($in->ask_from_( - { title => N("Sharing of local printers"), - messages => N("Choose the network or host on which the local printers should be made available:"), - callbacks => { - complete => sub { - if ($hostchoice eq - N("IP address of host/network:") && - $ip =~ /^\s*$/) { - - $in->ask_warn(N("Error"), N("Host/network IP address missing.")); - return 1, 1; - } - if ($hostchoice eq - N("IP address of host/network:") && - !printer::main::is_network_ip($ip)) { - - $in->ask_warn(N("Error"), -N("The entered host/network IP is not correct.\n") . -N("Examples for correct IPs:\n") . - "192.168.100.194\n" . - "10.0.0.*\n" . - "10.1.*\n" . - "192.168.100.0/24\n" . - "192.168.100.0/255.255.255.0\n" -); - return 1, 1; - } - if ($hostchoice eq $menu[0]) { - $address = '@LOCAL'; - } elsif ($hostchoice eq $menu[-1]) { - $address = $ip; - } else { - ($address) = - grep { $hostchoice =~ /$_/ } - @interfaces; - $address = "\@IF($address)"; - } - # Check whether item is duplicate - if ($address ne $oldaddress && - member($address, - @{$printer->{cupsconfig}{clientnetworks}})) { - $in->ask_warn(N("Error"), - N("This host/network is already in the list, it cannot be added again.\n")); - if ($hostchoice eq - N("IP address of host/network:")) { - return 1, 1; - } else { - return 1, 0; - } - } - return 0; - }, - }, - }, - # List the host types - [ { val => \$hostchoice, format => \&translate, - type => 'list', - sort => 0, - list => \@menu }, - { val => \$ip, - disabled => sub { - $hostchoice ne - N("IP address of host/network:"); - } }, - ], - )) { - # OK was clicked, insert new item into the list - if ($buttonclicked eq "add") { - push(@{$printer->{cupsconfig}{clientnetworks}}, - $address); - } else { - @{$printer->{cupsconfig}{clientnetworks}} = - map { ($_ eq - $sharehosts->{invhash}{$choice} ? - $address : $_) } - @{$printer->{cupsconfig}{clientnetworks}}; - } - # Refresh list of hosts - $sharehosts = - printer::main::makesharehostlist($printer); - # We have modified the configuration now - $printer->{cupsconfig}{customsharingsetup} = 0; - # Position the list cursor on the new/modified - # item - $choice = $sharehosts->{hash}{$address}; - } - } elsif ($buttonclicked eq "remove") { - @{$printer->{cupsconfig}{clientnetworks}} = - grep { $_ ne $sharehosts->{invhash}{$choice} } - @{$printer->{cupsconfig}{clientnetworks}}; - # Refresh list of hosts - $sharehosts = - printer::main::makesharehostlist($printer); - # We have modified the configuration now - $printer->{cupsconfig}{customsharingsetup} = 0; - } - } - # If we have no entry in the list, we do not - # share the local printers, mark this - if ($#{$printer->{cupsconfig}{clientnetworks}} < 0) { - $printer->{cupsconfig}{localprintersshared} = 0; - $printer->{cupsconfig}{remotebroadcastsaccepted} = 0; - } - } elsif ($buttonclicked eq "browsepoll") { - # Show dialog to add hosts to "BrowsePoll" from - my $subdone = 0; - my $choice; - while (!$subdone) { - # Entry should be edited when double-clicked - $buttonclicked = "edit"; - $in->ask_from_( - { title => N("Accessing printers on remote CUPS servers"), - messages => N("Add here the CUPS servers whose printers you want to use. You only need to do this if the servers do not broadcast their printer information into the local network."), - ok => "", - cancel => "", - }, - # List the hosts - [ { val => \$choice, format => \&translate, - sort => 0, separator => "####", - tree_expanded => 1, - quit_if_double_click => 1, - allow_empty_list => 1, - list => $browsepoll->{list} }, - { val => N("Add server"), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = "add"; - 1; - } }, - { val => N("Edit selected server"), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = "edit"; - 1; - }, - disabled => sub { - return $#{$browsepoll->{list}} < 0; - } }, - { val => N("Remove selected server"), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = "remove"; - 1; - }, - disabled => sub { - return $#{$browsepoll->{list}} < 0; - } }, - { val => N("Done"), - type => 'button', - clicked_may_quit => sub { - $buttonclicked = ""; - $subdone = 1; - 1; - } }, - ] - ); - if ($buttonclicked eq "add" || - $buttonclicked eq "edit") { - my ($ip, $port); - if ($buttonclicked eq "add") { - # Use default port - $port = '631'; - } else { - if ($browsepoll->{invhash}{$choice} =~ - /^([^:]+):([^:]+)$/) { - # Entry to edit has IP and port - $ip = $1; - $port = $2; - } else { - # Entry is only an IP, no port, so take - # the default port 631 - $ip = $browsepoll->{invhash}{$choice}; - $port = '631'; - } - } - # Show the dialog - my $address; - my $oldaddress = - ($buttonclicked eq "edit" ? - $browsepoll->{invhash}{$choice} : ""); - if ($in->ask_from_( - { title => N("Accessing printers on remote CUPS servers"), - messages => N("Enter IP address and port of the host whose printers you want to use.") . ' ' . - N("If no port is given, 631 will be taken as default."), - callbacks => { - complete => sub { - if ($ip =~ /^\s*$/) { - $in->ask_warn(N("Error"), N("Server IP missing!")); - return 1, 0; - } - if ($ip !~ - /^\s*(\d+\.\d+\.\d+\.\d+)\s*$/) { - $in->ask_warn(N("Error"), -N("The entered IP is not correct.\n") . -N("Examples for correct IPs:\n") . - "192.168.100.194\n" . - "10.0.0.2\n" -); - return 1, 0; - } else { - $ip = $1; - } - if ($port !~ /\S/) { - $port = '631'; - } elsif ($port !~ /^\s*(\d+)\s*$/) { - return 1, 1; - } else { - $port = $1; - } - $address = "$ip:$port"; - # Check whether item is duplicate - if ($address ne $oldaddress &&a
losetup /dev/loop0 /tmp/ /dev/loop0 /mnt/initrd
chmod a+w /mnt/initrd
full_stage2: $(BASE)/depslist $(BASE)/hdlist
sudo rm -rf $(DEST)
mkdir -p $(DEST)
$(MAKE) get_needed_files
$(MAKE) stage2
stage2:
$(MAKE) install_pms
$(SUDO) rm -rf $(STAGE2TMP)
install -d $(STAGE2TMP)
$(SUDO) cp -a $(DEST)/* $(STAGE2TMP)
$(SUDO) umount /mnt/stage2 ||:
dd if=/dev/zero of=$(STAGE2) bs=1M count=15
$(MKE2FS) -N 1000 $(STAGE2)
$(SUDO) mount -t ext2 $(STAGE2) /mnt/stage2 -o loop
# hack to reduce the STAGE2 image
rm $(STAGE2TMP)/usr/X11R6/bin/XF86_VGA16
for i in /usr/share/locale /usr/share/keymaps /usr/share/xmodmap $(REP4PMS)/po; do \
name=`basename $$i` ; \
(cd $(STAGE2TMP)/$$i ; find * | cpio -o 2>/dev/null | bzip2 > ../$$name.cpio.bz2 ; cd .. ; rm -rf $$name) \
done
$(SUDO) cp -a $(STAGE2TMP)/* /mnt/stage2
$(SUDO) rm -rf $(STAGE2TMP)
$(SUDO) umount $(STAGE2)
gzip -f -9 $(STAGE2)
@#rm -rf /mnt/initrd/*
@#cp -a $(DEST)/* /mnt/initrd
@#sync
@#dd if=/dev/loop0 | gzip -9 > /tmp/t/Mandrake/base/stage2.img
# function f() { grep "$*" /usr/include/*.h /usr/include/*/*.h; }
#
# install -s install/install install1/bin/install ; install -s installinit/init install1/bin/init
# mount /tmp/initrd /mnt/disk/ -o loop ; ; umount /mnt/disk ; gzip -c /tmp/initrd > /tmp/initrd.img ; mcopy -o /tmp/initrd.img a:
|
