[X2Go-Commits] [live-build-x2go] 13/166: added tcp printing feature

git-admin at x2go.org git-admin at x2go.org
Mon Nov 20 02:16:39 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch feature/mate-minidesktop
in repository live-build-x2go.

commit 64297293c28a8ce8faaafcb84ebd68f5d1b3ce34
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Tue Dec 27 18:15:38 2016 +0100

    added tcp printing feature
---
 .../includes.chroot/lib/live/config/2500-tcpprint  | 76 ++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/config/includes.chroot/lib/live/config/2500-tcpprint b/config/includes.chroot/lib/live/config/2500-tcpprint
new file mode 100755
index 0000000..ded7412
--- /dev/null
+++ b/config/includes.chroot/lib/live/config/2500-tcpprint
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+TcpPrint ()
+{
+
+# Output startup message
+#
+echo -n " tcpprint"
+
+if grep -q " *tcpprint *" /proc/cmdline ; then
+        TCPPRINTONLYFROM=$(cat /proc/cmdline | \
+                       tr ' ' '\n' | \
+                       awk -F'=' ' /^tcpprintonlyfrom=/ { print $2 }')
+	if [ -n "$TCPPRINTONLYFROM" ] ; then
+		TCPPRINTONLYFROM="only_from = $TCPPRINTONLYFROM"
+	fi
+	# Backgrounding
+	(
+
+	while ! lsmod | grep -q "^lp"; do
+		# Wait till modprobe lp has occurred
+		# -> this means /dev is fully populated
+		# => USB-Printers can be detected now, too
+		sleep 30
+	done
+
+	PRINTERDEVICES=""
+	[ -d /dev/usb ] && PRINTERDEVICES=$(find /dev/usb -type c -name "lp*" | sort)
+	PRINTERDEVICES="$PRINTERDEVICES $(find /dev/ -maxdepth 1 -type c -name "lp*" | sort)"
+
+	echo "\nSetting up local printers ..." >>/dev/tty9
+
+	# Create a listening port for a TCP/9100-RAW-printer
+	#
+	# printers may be at /dev/lp_ and at /dev/usb/lp_
+	PRINTERCOUNT=0
+	for PRINTERDEV in $PRINTERDEVICES; do 
+		PORTNUMBER=$((PRINTERCOUNT+9100))
+		echo "jetdirect${PRINTERCOUNT} ${PORTNUMBER}/tcp" >>/etc/services
+		cat >/etc/xinetd.d/jetdirect${PRINTERCOUNT} << JETDIRCONF 
+service jetdirect${PRINTERCOUNT}
+{
+	socket_type = stream
+	protocol = tcp
+	wait = no
+	user = root
+	server = /bin/dd
+	server_args = of=$PRINTERDEV bs=1024k
+	groups = yes
+	disable = no
+	instances = 1
+	$TCPPRINTONLYFROM
+}
+JETDIRCONF
+		echo "Mapping $PRINTERDEV => $PORTNUMBER" >>/dev/tty9
+		PRINTERCOUNT=$((PRINTERCOUNT+1))
+	done
+
+	echo "#Local printer config: Done." >/etc/xinetd.d/jetdirect
+
+	if ps -C xinetd --no-header >/dev/null ; then
+		echo -n "xinetd needs to be restarted, trying to do that ..." >>/dev/tty9
+		if /etc/init.d/xinetd restart; then
+			echo -n " success. All done." >>/dev/tty9
+		else
+			echo -n " error." >>/dev/tty9
+		fi
+	else
+		echo -n "No xinetd restart necessary. All done." >>/dev/tty9
+	fi
+
+	) &
+fi
+}
+
+TcpPrint

--
Alioth's /srv/git/code.x2go.org/live-build-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git


More information about the x2go-commits mailing list