diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-04-25 12:26:16 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-04-25 12:26:16 +0000 |
commit | 126777bc019a54afb4ec51299f2cf9d2841698aa (patch) | |
tree | 97f76e571902ead55ba138f1156a4b4f00b9b779 /perl-install/standalone/autosetupprintqueues | |
parent | f1f67448efc714873378dfeb8279fae68054a90a (diff) | |
download | drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.gz drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.bz2 drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.xz drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.zip |
re-sync after the big svn loss
Diffstat (limited to 'perl-install/standalone/autosetupprintqueues')
-rwxr-xr-x | perl-install/standalone/autosetupprintqueues | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/perl-install/standalone/autosetupprintqueues b/perl-install/standalone/autosetupprintqueues deleted file mode 100755 index 2f9af40a2..000000000 --- a/perl-install/standalone/autosetupprintqueues +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (C) 2003-2005 Mandriva -# -# Till Kamppeter <till@mandrakesoft.com> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License Version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -use strict; -use lib qw(/usr/lib/libDrakX); -use standalone; -use printer::printerdrake; -use printer::main; - -# Read mode in which we will run -my $commandline = join('', @ARGV); -$commandline =~ /-(auto|nogui|gui|waitforgui)\b/; -my $gui = $1; -$gui ||= "auto"; - -$gui = "nogui" if (! -x "/usr/X11R6/bin/X"); - -if ($gui ne "nogui") { - # Auto-detect whether we go in non-X mode or not - my $desktopuser; - $desktopuser = `cat /var/run/console.lock 2>/dev/null` or - $desktopuser = `cat /var/run/console/console.lock 2>/dev/null`; - if (!$desktopuser) { - if ($gui eq "auto") { - # Non-X mode - $gui = "nogui"; - } elsif ($gui eq "waitforgui") { - # Wait until a user logs in on the system's X console - while (!($desktopuser = `cat /var/run/console.lock 2>/dev/null`)) { - sleep(5); - } - # Wait for the window manager to start - sleep(10); - $gui = "gui"; - } else { - # "gui" was requested but no user logged in - die "Cannot start in '--gui' mode, no user logged in!\n"; - } - } else { - # X mode (a user is logged in) - $gui = "gui"; - } - - if ($gui eq "gui") { - # Allow root's windows to be opened on the user's display and - # start printerdrake then, in a mode to do nothing else than - # automatically setting up print queues. - my $userhome = - `getent passwd $desktopuser|awk -F: '{print \$6}' 2>&1`; - chomp $userhome; - my $errfile = "/dev/null"; - if (-r "$userhome/.Xauthority") { - system "export DISPLAY=\":0.0\"; export USER=$desktopuser; [ -r /etc/sysconfig/i18n ] >> $errfile 2>&1 && for l in `cat /etc/sysconfig/i18n`; do export \$l; done >> $errfile 2>&1; [ -r $userhome/.i18n ] >> $errfile 2>&1 && for l in `cat $userhome/.i18n`; do export \$l; done >> $errfile 2>&1; export XAUTHORITY=$userhome/.Xauthority; /usr/sbin/printerdrake --onlyautoqueue >> $errfile 2>&1;"; - } else { - system "export DISPLAY=\":0.0\"; export USER=$desktopuser; [ -r /etc/sysconfig/i18n ] >> $errfile 2>&1 && for l in `cat /etc/sysconfig/i18n`; do export \$l; done >> $errfile 2>&1; [ -r $userhome/.i18n ] >> $errfile 2>&1 && for l in `cat $userhome/.i18n`; do export \$l; done >> $errfile 2>&1; /bin/su $desktopuser -c \"/usr/X11R6/bin/xhost +localhost >> $errfile 2>&1\"; /usr/sbin/printerdrake --onlyautoqueue >> $errfile 2>&1; /bin/su $desktopuser -c \"/usr/X11R6/bin/xhost -localhost >> $errfile 2>&1\""; - } - exit 0; - } -} - -# Data structure for printer data -my $printer; - -# Dummy variable needed to call the subroutines of the printerdrake.pm -# module. The real data structure is not needed for non-interactive -# non-X mode -my $in; - -# Run the subroutines of printerdrake.pm in non-interactive non-X mode -$::noX = 1; - -# Subroutines of printerdrake.pm used for automatic setup of print queues -$::autoqueue = 1; - -# Do not let printerdrake ask for the spooler -$printer->{SPOOLER} ||= 'cups'; - -# Get info about already installed print queues -eval { $printer = printer::main::getinfo('') }; - -# Run the automatic, non-interactive print queue setup of printerdrake -printer::printerdrake::init($printer, $in); - |