From 3b24a2e128f2938d6d827fdbc696865b9bb0db23 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Mon, 30 Sep 2013 17:00:07 +0200 Subject: Added new param 'username' --- printerd | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'printerd') diff --git a/printerd b/printerd index ef93722..05a1052 100755 --- a/printerd +++ b/printerd @@ -4,13 +4,28 @@ # incoming data into UNIX lpd, which starts a helper program when a print- # job is incoming. -USER="$1" +USER="manuel" BUSYBOX="busybox" IP="0.0.0.0" PORT="515" SPOOLDIR="/var/spool" SPOOLQUEUE="STANDARD" -GUIBINARY="printerGUI" + + +# SHALL BE UNNECESSARY HENCE printerd RUNS IN USERCONTEXT +## If there are more than 1 seats open, quit +#if [ $(loginctl list-seats) != "seat0" ]; then +# exit +#fi +# +## Get the name(s) of the users physically using the machine +#NAME=$( loginctl | awk '$3 !~ /root/, $4 ~ /seat0/ { print $3 }' | sort -u ) +# +## Print error in case of multiple users +#if (( $(echo $NAME | wc -w ) > 1 )) ; then +# echo "[$0] To many users on this seat. Usernames: $NAME" > /tmp/debug-report/printer +# exit +#fi # Create the directory for the queue mkdir -p "$SPOOLDIR/$SPOOLQUEUE" @@ -20,7 +35,6 @@ mkdir -p "$SPOOLDIR/$SPOOLQUEUE" chown $USER:$USER "$SPOOLDIR/$SPOOLQUEUE" # Start the lpdaemon listening on the given port -exec "$BUSYBOX" tcpsvd -Eu "$USER:$USER" "$IP" "$PORT" \ - "$BUSYBOX" lpd "$SPOOLDIR" \ - "$GUIBINARY" +"$BUSYBOX" tcpsvd -Eu "$USER:$USER" "$IP" "$PORT" \ + "$BUSYBOX" lpd "$SPOOLDIR" sh -c 'printerGUI ms1144 $DATAFILE' & -- cgit v1.2.3-55-g7522