Author: mzugec
Date: Mon Jan 28 14:38:58 2008
New Revision: 43943
URL: http://svn.opensuse.org/viewcvs/yast?rev=43943&view=rev
Log:
dropped strict requires to netcat (#264309)
Modified:
trunk/printer/VERSION
trunk/printer/package/yast2-printer.changes
trunk/printer/src/common/dialogs-connection.ycp
trunk/printer/src/common/dialogs.ycp
trunk/printer/src/modules/CUPS.ycp
trunk/printer/src/modules/Printer.ycp
trunk/printer/tools/listen_remote_ipp
trunk/printer/tools/test_remote_ipp
trunk/printer/tools/test_remote_lpd
trunk/printer/tools/test_remote_novell
trunk/printer/tools/test_remote_smb
trunk/printer/tools/test_remote_socket
trunk/printer/yast2-printer.spec.in
Modified: trunk/printer/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/VERSION (original)
+++ trunk/printer/VERSION Mon Jan 28 14:38:58 2008
@@ -1 +1 @@
-2.16.6
+2.16.7
Modified: trunk/printer/package/yast2-printer.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/package/yast2-printer.changes (original)
+++ trunk/printer/package/yast2-printer.changes Mon Jan 28 14:38:58 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Jan 28 14:23:51 CET 2008 - mzugec@suse.de
+
+- dropped strict requires to netcat (#264309)
+- 2.16.7
+
+-------------------------------------------------------------------
Mon Nov 26 15:28:07 CET 2007 - mzugec@suse.cz
- accepting password with "@" in it (#225240)
Modified: trunk/printer/src/common/dialogs-connection.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/common/dialogs-connection.ycp?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/src/common/dialogs-connection.ycp (original)
+++ trunk/printer/src/common/dialogs-connection.ycp Mon Jan 28 14:38:58 2008
@@ -978,27 +978,8 @@
// label
string hent_str = _("&Hostname of Print Server");
term uspas = `VSpacing (0.2);
-/*
- integer i = findlastof (uri, "/");
- if (nil != i)
- {
- queue = Printerlib::getUriRemoteQueue (uri);
- full_hostname = Printerlib::getUriHost (uri);
- hostname = Printerlib::getReplacedString( Printerlib::getUriHost (uri), true );
- list tmp_list = splitstring(hostname, "@");
- if (size(tmp_list)==2){
- hostname = tmp_list[1]:"";
- }
- }
-*/
if (has_user_password)
{
-/*
- list l = Printerlib::getUriUsernamePassWorkgroup ( Printerlib::getReplacedString(uri, true) );
- user = l[0]:"";
- password = l[1]:"";
- workgroup = l[2]:"";
-*/
uspas = `VSquash (`VBox (
// text entry label
`TextEntry (`id (`userent), _("&Username"), user),
@@ -1018,7 +999,7 @@
queue);
term workgroup_entry = `VSpacing (0);
// menu button
- term lookup_hosts = `MenuButton (_("&Look Up"), [
+ term lookup_hosts = `MenuButton (`id(`lookup), _("&Look Up"), [
// menuentry
`item (`id (`get_hosts_special), _("Scan for &LPD Servers")),
// menuentry
@@ -1073,7 +1054,7 @@
// push button
_("L&ook Up")));
// menu button
- lookup_hosts = `MenuButton (_("&Look Up"), [
+ lookup_hosts = `MenuButton (`id(`lookup), _("&Look Up"), [
// menu item
`item (`id (`get_hosts_special), _("Scan for &IPP Servers")),
// menu item
@@ -1094,7 +1075,7 @@
// text entry label
_("&TCP Port Number"), sformat("%1", port)));
// menu button
- lookup_hosts = `MenuButton (_("&Look Up"), [
+ lookup_hosts = `MenuButton (`id(`lookup), _("&Look Up"), [
// menu item
`item (`id (`get_hosts_special), _("Scan for &Direct Socket Servers")),
// menu item
@@ -1152,6 +1133,12 @@
else UI::ChangeWidget (`id (`port), `ValidChars, "1234567890");
UI::ChangeWidget (`id (`hostnameent), `Value, hostname);
+ if (UI::WidgetExists(`test)) UI::ChangeWidget(`test, `Enabled, CUPS::enable_netcat);
+ if (UI::WidgetExists(`get_hosts_special)) UI::ChangeWidget(`get_hosts_special, `Enabled, CUPS::enable_netcat);
+ if (UI::WidgetExists(`get_hosts)) UI::ChangeWidget(`get_hosts, `Enabled, CUPS::enable_netcat);
+ if (UI::WidgetExists(`lookup)) UI::ChangeWidget(`lookup, `Enabled, CUPS::enable_netcat);
+ if (UI::WidgetExists(`get_printers)) UI::ChangeWidget(`get_printers, `Enabled, CUPS::enable_netcat);
+
symbol ret = nil;
repeat {
ret = (symbol)UI::UserInput ();
Modified: trunk/printer/src/common/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/common/dialogs.ycp?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/src/common/dialogs.ycp (original)
+++ trunk/printer/src/common/dialogs.ycp Mon Jan 28 14:38:58 2008
@@ -2271,14 +2271,14 @@
UI::ChangeWidget(`select_addr, `Enabled, listen && local);
UI::ChangeWidget(`server_name, `Enabled, !local);
- UI::ChangeWidget(`lookup_server, `Enabled, !local);
- UI::ChangeWidget(`test_ipp, `Enabled, !local);
+ UI::ChangeWidget(`lookup_server, `Enabled, !local && CUPS::enable_netcat);
+ UI::ChangeWidget(`test_ipp, `Enabled, !local && CUPS::enable_netcat);
UI::ChangeWidget(`use_default, `Enabled, !local);
boolean use_def=false;
if (!local) use_def=!(boolean) UI::QueryWidget(`use_default, `Value);
UI::ChangeWidget(`queues, `Enabled, use_def);
- UI::ChangeWidget(`lookup_queue, `Enabled, use_def);
+ UI::ChangeWidget(`lookup_queue, `Enabled, use_def && CUPS::enable_netcat);
if (event["EventReason"]:""=="Activated" && event["ID"]:`nil==`select_addr) {
CUPS::cups_server_settings["BrowseAddress"] = getAddresses(CUPS::cups_server_settings["BrowseAddress"]:[]);
}
Modified: trunk/printer/src/modules/CUPS.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/modules/CUPS.ycp?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/src/modules/CUPS.ycp (original)
+++ trunk/printer/src/modules/CUPS.ycp Mon Jan 28 14:38:58 2008
@@ -39,6 +39,9 @@
// global variables
+// in UI enable/disable
+global boolean enable_netcat = true;
+
/**
* List of detected CUPS servers
*/
Modified: trunk/printer/src/modules/Printer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/modules/Printer.ycp?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/src/modules/Printer.ycp (original)
+++ trunk/printer/src/modules/Printer.ycp Mon Jan 28 14:38:58 2008
@@ -45,7 +45,7 @@
import "URL";
import "PackageSystem";
import "URL";
-
+ import "PackageSystem";
//////////
////////// Module data
@@ -1209,6 +1209,7 @@
if (testAbort ()) return false;
Printerlib::readHplip();
+ CUPS::enable_netcat = PackageSystem::Installed("netcat");
if (! checkSpooler ()) return false;
Modified: trunk/printer/tools/listen_remote_ipp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/listen_remote_ipp?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/tools/listen_remote_ipp (original)
+++ trunk/printer/tools/listen_remote_ipp Mon Jan 28 14:38:58 2008
@@ -3,11 +3,32 @@
# Listen on UDP port 631 for incoming CUPS network server broadcasts
# and if so extract the CUPS network server name
#
-# Exits: 0 doesn't seem to have a problem
-# 1 local UDP port 631 not available (perhaps cupsd is running?)
-# 2 cannot create temporary file
-
-set -x
+# Exits: 0 doesn't seem to have a problem
+# 1 local UDP port 631 not available (perhaps cupsd is running?)
+# 2 cannot create temporary file
+# 11 netcat not executable (no netcat RPM installed?)
+# 12 fuser not executable (no psmisc RPM installed?)
+# 13 mktemp not executable (no mktemp RPM installed?)
+# 14 sed not executable (no sed RPM installed?)
+# The programs head, rm, sleep, sort are in the coreutils RPM and therefore assumed to exist.
+
+#set -x
+
+# Make sure to have a clean environment:
+export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
+export LC_ALL="POSIX"
+export LANG="POSIX"
+umask 022
+
+# Use the binaries of the operating system (no aliases, functions, /usr/local/):
+export NETCAT=$( type -ap netcat | head -n 1 )
+[ -z "$NETCAT" ] && { echo -en "\nnetcat not executable\n" 1>&2 ; exit 11 ; }
+export FUSER=$( type -ap fuser | head -n 1 )
+[ -z "$FUSER" ] && { echo -en "\nfuser not executable\n" 1>&2 ; exit 12 ; }
+export MKTEMP=$( type -ap mktemp | head -n 1 )
+[ -z "$MKTEMP" ] && { echo -en "\nmktemp not executable\n" 1>&2 ; exit 13 ; }
+export SED=$( type -ap sed | head -n 1 )
+[ -z "$SED" ] && { echo -en "\nsed not executable\n" 1>&2 ; exit 14 ; }
YAST_OUTPUT="/var/lib/YaST2/cups_network_server_name"
# The minimum timeout is 31 seconds because by default a
@@ -34,13 +55,13 @@
[ -z "$ADDITIONAL_TIMEOUT" ] && ADDITIONAL_TIMEOUT=1
# Test whether local UDP port 631 is not available for connecting
-fuser -n udp 631 &>/dev/null && exit 1
+$FUSER -n udp 631 &>/dev/null && { echo -en "\nUDP port 631 already in use\n" 1>&2 ; exit 1 ; }
# Create temporary file
-OUTPUT=$(mktemp -u /tmp/$MY_NAME.XXXXXX) || exit 2
+OUTPUT=$( $MKTEMP -u /tmp/$MY_NAME.XXXXXX ) || { echo -en "\nCannot create temporary file\n" 1>&2 ; exit 2 ; }
# Listen on UDP port 631 for CUPS network server packages
-netcat -u -l -p 631 1>$OUTPUT 2>/dev/null &
+$NETCAT -u -l -p 631 1>$OUTPUT 2>/dev/null &
NETCAT_PID=$!
# sleep is not interrupted by signals (except SIGKILL)
@@ -52,11 +73,11 @@
# then "wait $!" would be interrupted
[ -z "$SIGHUP_RECEIVED" ] && sleep $ADDITIONAL_TIMEOUT & wait $!
-# as "netcat -w" does not work together with "-u" we send SIGTERM
-kill $NETCAT_PID &>/dev/null
-
-# extract the CUPS network server name from the output
-# and store it to be available for YaST
-sed -n -e 's/^.*ipp:\/\/\(.*\):.*$/\1/p' $OUTPUT 1>$YAST_OUTPUT
+# as "netcat -w" does not work together with "-u" we send SIGKILL
+kill -9 $NETCAT_PID &>/dev/null
+# extract the CUPS network server names from the output
+# and store them to be available for YaST
+$SED -n -e 's/^.*ipp:\/\/\(.*\):.*$/\1/p' $OUTPUT | sort -u 1>$YAST_OUTPUT
exit 0
+
Modified: trunk/printer/tools/test_remote_ipp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/test_remote_ipp?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/tools/test_remote_ipp (original)
+++ trunk/printer/tools/test_remote_ipp Mon Jan 28 14:38:58 2008
@@ -7,13 +7,33 @@
# 2 the remote host $1 is unreachable
# 3 no connection possible to port 631 on host $1 (no cups server running ?)
# 4 queue does not accept a print job (queue does not exist or queueing disabled ?)
+# 10 ping not executable (no iputils RPM installed?)
+# 11 netcat not executable (no netcat RPM installed?)
+# (12=fuser,13=mktemp,14=sed: see listen_remote_ipp)
+# 15 lp not executable (no cups-client RPM installed?)
+# The program head is in the coreutils RPM and therefore assumed to exist.
#
-# Johannes Meixner , 2000, 2002
+# Johannes Meixner , 2000, 2002, 2007
# Jan Holesovsky , 2000
# Jiri Srain , 2002
# $Id$
#set -x
+
+# Make sure to have a clean environment:
+export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
+export LC_ALL="POSIX"
+export LANG="POSIX"
+umask 022
+
+# Use the binaries of the operating system (no aliases, functions, /usr/local/):
+export PING=$( type -ap ping | head -n 1 )
+[ -z "$PING" ] && { echo -en "\nping not executable\n" 1>&2 ; exit 10 ; }
+export NETCAT=$( type -ap netcat | head -n 1 )
+[ -z "$NETCAT" ] && { echo -en "\nnetcat not executable\n" 1>&2 ; exit 11 ; }
+export LP=$( type -ap lp | head -n 1 )
+[ -z "$LP" ] && { echo -en "\nlp not executable\n" 1>&2 ; exit 15 ; }
+
MY_NAME=${0##*/}
HOST="$1"
QUEUE="$2"
@@ -22,20 +42,14 @@
[ -z "$TIMEOUT" ] && TIMEOUT=10
# test whether the remote host is accessible
-ping -c 1 -w $TIMEOUT $HOST || { echo -en "\nHost $HOST unreachable\n" ; exit 2 ; }
+$PING -c 1 -w $TIMEOUT $HOST || { echo -en "\nHost $HOST unreachable\n" ; exit 2 ; }
# test whether connection is possible to port 631 (ipp) on the remote host
-netcat -w $TIMEOUT -z $HOST 631 || { echo -en "\nNo connection possible to port 635 (ipp)\n" ; exit 3 ; }
-
-# test the queue and server
-echo -en "\r" | lp -d $QUEUE -h $HOST 2>&1;
-
-RES=$?
+$NETCAT -w $TIMEOUT -z $HOST 631 || { echo -en "\nNo connection possible to port 635 (IPP) on host $HOST\n" ; exit 3 ; }
-if [ $RES -eq 0 ];
- then
- exit 0;
-else
- exit 4;
-fi
+# test whether the queue on the server accepts print jobs
+echo -en "\r" | $LP -d $QUEUE -h $HOST 2>&1
+[ "$?" = "0" ] && { echo -en "\nQueue $QUEUE on host $HOST accepts print jobs\n" ; exit 0 ; }
+echo -en "\nQueue $QUEUE on host $HOST does not accept print jobs\n"
+exit 4
Modified: trunk/printer/tools/test_remote_lpd
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/test_remote_lpd?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/tools/test_remote_lpd (original)
+++ trunk/printer/tools/test_remote_lpd Mon Jan 28 14:38:58 2008
@@ -10,13 +10,35 @@
# 2 the remote host $1 is unreachable
# 3 no connection possible to port 515 on host $1 (no lpd running ?)
# 4 queue does not accept a print job (queue does not exist or queueing disabled ?)
+# 10 ping not executable (no iputils RPM installed?)
+# 11 netcat not executable (no netcat RPM installed?)
+# 12 fuser not executable (no psmisc RPM installed?)
+# 13 mktemp not executable (no mktemp RPM installed?)
+# The programs head, mkfifo, sleep, tr, rm are in the coreutils RPM and therefore assumed to exist.
#
-# Johannes Meixner , 2000, 2002
+# Johannes Meixner , 2000, 2002, 2007
# Jan Holesovsky , 2000
# Jiri Srain , 2002
# $Id$
#set -x
+
+# Make sure to have a clean environment:
+export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
+export LC_ALL="POSIX"
+export LANG="POSIX"
+umask 022
+
+# Use the binaries of the operating system (no aliases, functions, /usr/local/):
+export PING=$( type -ap ping | head -n 1 )
+[ -z "$PING" ] && { echo -en "\nping not executable\n" 1>&2 ; exit 10 ; }
+export NETCAT=$( type -ap netcat | head -n 1 )
+[ -z "$NETCAT" ] && { echo -en "\nnetcat not executable\n" 1>&2 ; exit 11 ; }
+export FUSER=$( type -ap fuser | head -n 1 )
+[ -z "$FUSER" ] && { echo -en "\nfuser not executable\n" 1>&2 ; exit 12 ; }
+export MKTEMP=$( type -ap mktemp | head -n 1 )
+[ -z "$MKTEMP" ] && { echo -en "\nmktemp not executable\n" 1>&2 ; exit 13 ; }
+
MY_NAME=${0##*/}
HOST="$1"
QUEUE="$2"
@@ -25,25 +47,25 @@
[ -z "$TIMEOUT" ] && TIMEOUT=10
# test whether the remote host is accessible
-ping -c 1 -w $TIMEOUT $HOST || { echo -en "\nHost $HOST unreachable\n" ; exit 2 ; }
+$PING -c 1 -w $TIMEOUT $HOST || { echo -en "\nHost $HOST unreachable\n" ; exit 2 ; }
# test whether connection is possible to port 515 (lpd) on the remote host
-netcat -w $TIMEOUT -z $HOST 515 || { echo -en "\nNo connection possible to port 515 (lpd)\n" ; exit 3 ; }
+$NETCAT -w $TIMEOUT -z $HOST 515 || { echo -en "\nNo connection possible to port 515 (lpd)\n" ; exit 3 ; }
# Find an available local port for connecting
PORT=$(for I in 721 722 723 724 725 726 727 728 729 730 731
do
- fuser -n tcp $I &>/dev/null || { echo $I ; break ; }
+ $FUSER -n tcp $I &>/dev/null || { echo $I ; break ; }
done)
# Create temporary fifos
-TMP_IN=$(mktemp -u /tmp/$MY_NAME.in.XXXXXX)
-TMP_OUT=$(mktemp -u /tmp/$MY_NAME.out.XXXXXX)
+TMP_IN=$( $MKTEMP -u /tmp/$MY_NAME.in.XXXXXX )
+TMP_OUT=$( $MKTEMP -u /tmp/$MY_NAME.out.XXXXXX)
mkfifo $TMP_IN
mkfifo $TMP_OUT
# Test the queue:
-# Use source port $PORT and destination port 515 (lpd)
+# Use source port $PORT and destination port 515 (LPD)
# "\002$QUEUE\n" is a request to receive a new job for $QUEUE
# The remote lpd sends '\000' if it accepts the request. Then we must
# send "\001\n" back which is a request to cancel the new job.
@@ -52,26 +74,25 @@
# But as there may be no response from the remote port we have additionally
# a time bomb which would kill the netcat process after $TIMEOUT.
-netcat -w $TIMEOUT -p $PORT $HOST 515 <$TMP_IN >$TMP_OUT 2>/dev/null &
+$NETCAT -w $TIMEOUT -p $PORT $HOST 515 <$TMP_IN >$TMP_OUT 2>/dev/null &
NETCAT_PID=$!
{ sleep ${TIMEOUT}s ; kill $NETCAT_PID &>/dev/null ; } &
RESULT=""
{ echo -en "\002$QUEUE\n" ; \
- RESULT=$(head --bytes=1 <$TMP_OUT | tr '\000' '0') ; \
+ RESULT=$( head --bytes=1 <$TMP_OUT | tr '\000' '0' ) ; \
[ "$RESULT" = "0" ] && echo -en "\001\n" ; } >$TMP_IN
rm $TMP_IN
rm $TMP_OUT
-[ "$RESULT" = "0" ] \
- && { echo -en "\nQueue $QUEUE on host $HOST accepts print jobs\n" ; exit 0 ; } \
- || echo -en "\nQueue $QUEUE on host $HOST does not accept print jobs\n"
+[ "$RESULT" = "0" ] && { echo -en "\nQueue $QUEUE on host $HOST accepts print jobs\n" ; exit 0 ; }
+
+echo -en "\nQueue $QUEUE on host $HOST does not accept print jobs\n"
# If $QUEUE does not accept jobs, print $QUEUE status in long format.
# "\004$QUEUE\n" is a request to receive $QUEUE status (very long output in case of LPRng).
-
echo -en "\nStatus of the queue $QUEUE\n"
-echo -en "\004$QUEUE\n" | netcat -w $TIMEOUT -p $PORT $HOST 515
+echo -en "\004$QUEUE\n" | $NETCAT -w $TIMEOUT -p $PORT $HOST 515
exit 4
Modified: trunk/printer/tools/test_remote_novell
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/test_remote_novell?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/tools/test_remote_novell (original)
+++ trunk/printer/tools/test_remote_novell Mon Jan 28 14:38:58 2008
@@ -5,13 +5,26 @@
# Exits: 0 doesn't seem to have a problem
# 1 remote host $1 or queue $2 not set
# 4 queue does not accept a print job (queue does not exist or queueing disabled ?)
+# (10=ping,11=netcat,12=fuser,13=mktemp,14=sed,15=lp,16=smbclient: see test_remote_smb)
+# 17 nprint not executable (no ncpfs RPM installed?)
#
-# Johannes Meixner , 2000, 2002
+# Johannes Meixner , 2000, 2002, 2007
# Jan Holesovsky , 2000
# Jiri Srain , 2002
# $Id$
#set -x
+
+# Make sure to have a clean environment:
+export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
+export LC_ALL="POSIX"
+export LANG="POSIX"
+umask 022
+
+# Use the binaries of the operating system (no aliases, functions, /usr/local/):
+export NPRINT=$( type -ap nprint | head -n 1 )
+[ -z "$NPRINT" ] && { echo -en "\nnprint not executable\n" 1>&2 ; exit 17 ; }
+
MY_NAME=${0##*/}
HOST=$1
QUEUE=$2
@@ -22,15 +35,9 @@
[ -z "$TIMEOUT" ] && TIMEOUT=10
-# test the queue and server
-echo -en "\r" | nprint -S "$HOST" -U "$USER" -P "$PASSWORD" -q "$QUEUE" - 2>&1
-
-RES=$?
-
-if [ $RES -eq 0 ];
- then
- exit 0;
-else
- exit 4;
-fi
+# test whether the queue on the server accepts print jobs
+echo -en "\r" | $NPRINT -S "$HOST" -U "$USER" -P "$PASSWORD" -q "$QUEUE" - 2>&1
+[ "$?" = "0" ] && { echo -en "\nQueue $QUEUE on host $HOST accepts print jobs\n" ; exit 0 ; }
+echo -en "\nQueue $QUEUE on host $HOST does not accept print jobs\n"
+exit 4
Modified: trunk/printer/tools/test_remote_smb
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/test_remote_smb?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/tools/test_remote_smb (original)
+++ trunk/printer/tools/test_remote_smb Mon Jan 28 14:38:58 2008
@@ -7,13 +7,30 @@
# 2 the remote host $1 is unreachable
# 3 no connection possible to port 631 on host $1 (no cups server running ?)
# 4 queue does not accept a print job (queue does not exist or queueing disabled ?)
+# 10 ping not executable (no iputils RPM installed?)
+# (11=netcat,12=fuser,13=mktemp,14=sed,15=lp: see test_remote_ipp)
+# 16 smbclient not executable (no samba-client RPM installed?)
+# The programs head, mkfifo, sleep, tr, rm are in the coreutils RPM and therefore assumed to exist.
#
-# Johannes Meixner , 2000, 2002
+# Johannes Meixner , 2000, 2002, 2007
# Jan Holesovsky , 2000
# Jiri Srain , 2002
# $Id$
#set -x
+
+# Make sure to have a clean environment:
+export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
+export LC_ALL="POSIX"
+export LANG="POSIX"
+umask 022
+
+# Use the binaries of the operating system (no aliases, functions, /usr/local/):
+export PING=$( type -ap ping | head -n 1 )
+[ -z "$PING" ] && { echo -en "\nping not executable\n" 1>&2 ; exit 10 ; }
+export SMBCLIENT=$( type -ap smbclient | head -n 1 )
+[ -z "$SMBCLIENT" ] && { echo -en "\nsmbclient not executable\n" 1>&2 ; exit 16 ; }
+
MY_NAME=${0##*/}
WORKGROUP=$1
HOST=$2
@@ -26,19 +43,13 @@
[ -z "$TIMEOUT" ] && TIMEOUT=10
# test whether the remote host is accessible
-ping -c 1 -w $TIMEOUT $HOST || { echo -en "\nHost $HOST unreachable\n" ; exit 2 ; }
+$PING -c 1 -w $TIMEOUT $HOST || { echo -en "\nHost $HOST unreachable\n" ; exit 2 ; }
-# test the queue and server
-echo -e "\nTesting $QUEUE on $WORKGROUP $HOST:"
+# test whether the queue on the server accepts print jobs
+echo -e "\nTesting $QUEUE on $WORKGROUP/$HOST:"
test -z $PASSWORD && PASSWORD="-N"
-echo -en "\r" | smbclient "//$HOST/$QUEUE" "$PASSWORD" -c "print -" -U "$USER" -W "$WORKGROUP"
-
-RES=$?
-
-if [ $RES -eq 0 ];
- then
- exit 0;
-else
- exit 4;
-fi
+echo -en "\r" | $SMBCLIENT "//$HOST/$QUEUE" "$PASSWORD" -c "print -" -U "$USER" -W "$WORKGROUP"
+[ "$?" = "0" ] && { echo -en "\nShare $QUEUE on $WORKGROUP/$HOST accepts print jobs\n" ; exit 0 ; }
+echo -en "\nShare $QUEUE on $WORKGROUP/$HOST does not accept print jobs\n"
+exit 4
Modified: trunk/printer/tools/test_remote_socket
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/tools/test_remote_socket?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/tools/test_remote_socket (original)
+++ trunk/printer/tools/test_remote_socket Mon Jan 28 14:38:58 2008
@@ -7,12 +7,28 @@
# 2 the remote host $1 is unreachable
# 3 no connection possible to port 9100 or port $2 on host $1
# 4 port 9100 or port $2 on host $1 does not accept data
+# 10 ping not executable (no iputils RPM installed?)
+# 11 netcat not executable (no netcat RPM installed?)
+# The program head is in the coreutils RPM and therefore assumed to exist.
#
-# Johannes Meixner 2002
+# Johannes Meixner 2002, 2007
# Jiri Srain , 2002
# $Id$
#set -x
+
+# Make sure to have a clean environment:
+export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
+export LC_ALL="POSIX"
+export LANG="POSIX"
+umask 022
+
+# Use the binaries of the operating system (no aliases, functions, /usr/local/):
+export PING=$( type -ap ping | head -n 1 )
+[ -z "$PING" ] && { echo -en "\nping not executable\n" 1>&2 ; exit 10 ; }
+export NETCAT=$( type -ap netcat | head -n 1 )
+[ -z "$NETCAT" ] && { echo -en "\nnetcat not executable\n" 1>&2 ; exit 11 ; }
+
MY_NAME=${0##*/}
HOST="$1"
[ -z "$HOST" ] && { echo -en "\nUsage:\n$MY_NAME HOST [PORT [TIMEOUT]]\n" 1>&2 ; exit 1 ; }
@@ -22,16 +38,14 @@
[ -z "$TIMEOUT" ] && TIMEOUT=10
# test whether the remote host is accessible
-ping -c 1 -w $TIMEOUT $HOST || { echo -en "\nHost $HOST unreachable\n" ; exit 2 ; }
+$PING -c 1 -w $TIMEOUT $HOST || { echo -en "\nHost $HOST unreachable\n" ; exit 2 ; }
# test whether connection is possible to $PORT on the remote host
-netcat -w $TIMEOUT -z $HOST $PORT || { echo -en "\nNo connection possible to port $PORT\n" ; exit 3 ; }
+$NETCAT -w $TIMEOUT -z $HOST $PORT || { echo -en "\nNo connection possible to port $PORT\n" ; exit 3 ; }
# test whether $PORT on the remote host accepts data
-echo -en "\r" | netcat -w $TIMEOUT $HOST $PORT 2>&1
-RESULT=$?
-[ "$RESULT" = "0" ] \
- && { echo -en "\nPort $PORT on host $HOST accepts data\n" ; exit 0 ; } \
- || echo -en "\nPort $PORT on host $HOST does not accept data\n"
+echo -en "\r" | $NETCAT -w $TIMEOUT $HOST $PORT 2>&1
+[ "$?" = "0" ] && { echo -en "\nPort $PORT on host $HOST accepts data\n" ; exit 0 ; }
+echo -en "\nPort $PORT on host $HOST does not accept data\n"
exit 4
Modified: trunk/printer/yast2-printer.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/yast2-printer.spec.in?rev=43943&r1=43942&r2=43943&view=diff
==============================================================================
--- trunk/printer/yast2-printer.spec.in (original)
+++ trunk/printer/yast2-printer.spec.in Mon Jan 28 14:38:58 2008
@@ -3,7 +3,8 @@
@HEADER@
BuildRequires: blocxx-devel cups-devel cups-drivers cups-drivers-stp gcc-c++ libxcrypt-devel openssl-devel docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer popt-devel sgml-skel update-desktop-files yast2 yast2-devtools yast2-testsuite yast2-core-devel zlib-devel
-Requires: netcat zlib blocxx
+Requires: zlib blocxx
+Recommends: netcat
Requires: /usr/bin/host cups-libs
Requires: yast2 >= 2.16.12
#Requires: cups >= 1.2
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org