[X2Go-Commits] [live-build-x2go] 02/58: added tcp printing feature

git-admin at x2go.org git-admin at x2go.org
Tue Feb 14 09:34:05 CET 2017


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

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

commit 5dfd7be69c2596d35c1d319b9f38c2c0764bf8de
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 ++++++++++++++++++++
 config/package-lists/utils.list.chroot             |    2 +-
 2 files changed, 77 insertions(+), 1 deletion(-)

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
diff --git a/config/package-lists/utils.list.chroot b/config/package-lists/utils.list.chroot
index 6214968..f5ca145 100644
--- a/config/package-lists/utils.list.chroot
+++ b/config/package-lists/utils.list.chroot
@@ -1 +1 @@
-acpid acpi-support atftp kbd psmisc rsync screen vim x11vnc x11vnc-data
+acpid acpi-support atftp kbd psmisc rsync screen vim x11vnc x11vnc-data xinetd

--
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