From 31f11061fa43cce6da819ea38db7a6f1de572f7d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 6 Feb 2014 20:45:47 +0100 Subject: [printergui] Force using old version as build system changed from qmake to cmake and the build script isn't updated yet --- remote/modules/printergui/printergui.build | 3 +++ remote/modules/printergui/printergui.conf | 1 + 2 files changed, 4 insertions(+) (limited to 'remote/modules/printergui') diff --git a/remote/modules/printergui/printergui.build b/remote/modules/printergui/printergui.build index 5803d8e8..a11469d2 100644 --- a/remote/modules/printergui/printergui.build +++ b/remote/modules/printergui/printergui.build @@ -2,6 +2,9 @@ fetch_source() { git clone "${REQUIRED_GIT}" src + cd src + git checkout "$REQUIRED_COMMIT" + cd .. } build() { diff --git a/remote/modules/printergui/printergui.conf b/remote/modules/printergui/printergui.conf index 26203a80..c556444e 100644 --- a/remote/modules/printergui/printergui.conf +++ b/remote/modules/printergui/printergui.conf @@ -1,4 +1,5 @@ REQUIRED_GIT="git://git.openslx.org/openslx-ng/printergui.git" +REQUIRED_COMMIT="e36d365f291702528f8bd47d2f9" REQUIRED_BINARIES=" printergui " -- cgit v1.2.3-55-g7522 From 2fa9696eac4c7c3a0402eb4bb63cc9ed35e1b580 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Fri, 7 Feb 2014 19:09:01 +0100 Subject: [printergui, vmchooser] Bugfixes, net systemd service etc., printpwgui --- .../system/network.target.wants/printergui.service | 1 + .../data/etc/systemd/system/printergui.service | 8 ++++++++ .../openslx/scripts/systemd-printergui_preparation | 20 ++++++++++++++++++++ remote/modules/printergui/printergui.build | 10 ++++++---- remote/modules/printergui/printergui.conf | 4 +++- .../data/opt/openslx/scripts/vmchooser-run_virt | 2 +- 6 files changed, 39 insertions(+), 6 deletions(-) create mode 120000 remote/modules/printergui/data/etc/systemd/system/network.target.wants/printergui.service create mode 100644 remote/modules/printergui/data/etc/systemd/system/printergui.service create mode 100755 remote/modules/printergui/data/opt/openslx/scripts/systemd-printergui_preparation (limited to 'remote/modules/printergui') diff --git a/remote/modules/printergui/data/etc/systemd/system/network.target.wants/printergui.service b/remote/modules/printergui/data/etc/systemd/system/network.target.wants/printergui.service new file mode 120000 index 00000000..40453c80 --- /dev/null +++ b/remote/modules/printergui/data/etc/systemd/system/network.target.wants/printergui.service @@ -0,0 +1 @@ +../printergui.service \ No newline at end of file diff --git a/remote/modules/printergui/data/etc/systemd/system/printergui.service b/remote/modules/printergui/data/etc/systemd/system/printergui.service new file mode 100644 index 00000000..8b00514c --- /dev/null +++ b/remote/modules/printergui/data/etc/systemd/system/printergui.service @@ -0,0 +1,8 @@ +[Unit] +Description=Printergui - bwLehrpool printing system +Requires=network.target graphical.target +After=network.target +Before=cups.service + +[Service] +ExecStart=/opt/openslx/scripts/systemd-printergui_preparation diff --git a/remote/modules/printergui/data/opt/openslx/scripts/systemd-printergui_preparation b/remote/modules/printergui/data/opt/openslx/scripts/systemd-printergui_preparation new file mode 100755 index 00000000..33a861e6 --- /dev/null +++ b/remote/modules/printergui/data/opt/openslx/scripts/systemd-printergui_preparation @@ -0,0 +1,20 @@ +#!/bin/ash + +ERR=0 +SRCDIR=/usr/lib/cups/backend +DESTDIR=/opt/openslx/cups/backend +PRINTPWGUI=/opt/openslx/cups/printpwgui + +if [ ! -d "$DESTDIR" ]; then + mkdir -p "$DESTDIR" || exit 1 +fi + +mv "$SRCDIR"/* "$DESTDIR" + +cd "$SRCDIR" +for i in "$DESTDIR"/*; do + ln -sf "$PRINTPWGUI" $(basename "$i") +done + +exit 0 + diff --git a/remote/modules/printergui/printergui.build b/remote/modules/printergui/printergui.build index a11469d2..62b7c103 100644 --- a/remote/modules/printergui/printergui.build +++ b/remote/modules/printergui/printergui.build @@ -9,13 +9,15 @@ fetch_source() { build() { local SRCDIR="${MODULE_DIR}/src/" + local DESTDIR="$MODULE_BUILD_DIR/opt/openslx/cups" - mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin" - cd "${MODULE_BUILD_DIR}/opt/openslx/bin" || perror "Could not cd!" - pinfo "Running qmake" - qmake "$SRCDIR/src/printergui.pro" -r -spec linux-g++ || perror "'qmake' failed (e.g. not installed)." + mkdir -p "$DESTDIR" + cd "$DESTDIR" || perror "Could not cd to $DESTDIR!" + pinfo "Running cmake" + cmake "$SRCDIR/" || perror "'cmake' failed (e.g. not installed)." pinfo "Running make" make || perror "'make' failed." + chmod 0700 "$DESTDIR/printpwgui" # So picky cupsd won't drop privileges to lp } post_copy() { mkdir -p "${TARGET_BUILD_DIR}/var/spool/STANDARD" diff --git a/remote/modules/printergui/printergui.conf b/remote/modules/printergui/printergui.conf index c556444e..7abb1899 100644 --- a/remote/modules/printergui/printergui.conf +++ b/remote/modules/printergui/printergui.conf @@ -1,7 +1,9 @@ REQUIRED_GIT="git://git.openslx.org/openslx-ng/printergui.git" -REQUIRED_COMMIT="e36d365f291702528f8bd47d2f9" +#REQUIRED_COMMIT="e36d365f291702528f8bd47d2f9" +REQUIRED_COMMIT="HEAD" REQUIRED_BINARIES=" printergui + printpwgui " REQUIRED_SYSTEM_FILES=" " diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt index 49fd98d4..9442635a 100755 --- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt +++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt @@ -445,7 +445,7 @@ QUEUE="STANDARD" # FixMe: Solution for general printer redirection in other cases (iptables on outgoing port) tcpsvd -E 192.168.101.1 5515 \ lpd "$SPOOLDIR" \ - sh -c "printergui $USER $SPOOLDIR/$QUEUE/\$DATAFILE" & + sh -c "/opt/openslx/cups/printergui $USER $SPOOLDIR/$QUEUE/\$DATAFILE" & # PID to kill the process PID_LPD="$!" -- cgit v1.2.3-55-g7522 From 195206db3c318c20fe6e31c287fc3fa0bee6e98b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 11 Feb 2014 17:52:46 +0100 Subject: [printergui] config cleanup --- remote/modules/printergui/printergui.conf | 1 - 1 file changed, 1 deletion(-) (limited to 'remote/modules/printergui') diff --git a/remote/modules/printergui/printergui.conf b/remote/modules/printergui/printergui.conf index 7abb1899..17203d3e 100644 --- a/remote/modules/printergui/printergui.conf +++ b/remote/modules/printergui/printergui.conf @@ -1,5 +1,4 @@ REQUIRED_GIT="git://git.openslx.org/openslx-ng/printergui.git" -#REQUIRED_COMMIT="e36d365f291702528f8bd47d2f9" REQUIRED_COMMIT="HEAD" REQUIRED_BINARIES=" printergui -- cgit v1.2.3-55-g7522 From 2fed65fa7e94853079ecf0c8ad74a7963e26df84 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 11 Feb 2014 20:26:59 +0100 Subject: [printergui] Spool from VM to tmpfs home if possible, fall back to /tmp --- remote/modules/printergui/printergui.build | 4 ++-- .../data/opt/openslx/scripts/vmchooser-run_virt | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'remote/modules/printergui') diff --git a/remote/modules/printergui/printergui.build b/remote/modules/printergui/printergui.build index 62b7c103..2ee49154 100644 --- a/remote/modules/printergui/printergui.build +++ b/remote/modules/printergui/printergui.build @@ -20,6 +20,6 @@ build() { chmod 0700 "$DESTDIR/printpwgui" # So picky cupsd won't drop privileges to lp } post_copy() { - mkdir -p "${TARGET_BUILD_DIR}/var/spool/STANDARD" - chmod a+rwt "${TARGET_BUILD_DIR}/var/spool/STANDARD" + : } + diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt index 9442635a..2cd92776 100755 --- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt +++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt @@ -436,16 +436,26 @@ amixer -q sset 'Front Mic' "$VOL" unmute 2>/dev/null # to be checked if Mic is amixer -q sset 'Rear Mic' "$VOL" unmute 2>/dev/null # =""= amixer -q -c pcsp sset Master "0%" mute 2>/dev/null # fix random static noise when starting vmplayer TODO: find out why?! -# Start printer daemon +# Start printer daemon +QUEUE="STANDARD" # This has to match the queue you configured in your VM USER="$(whoami)" -SPOOLDIR="/var/spool" -QUEUE="STANDARD" +# Try using users tmpfs home first, as it gets wiped on logout +if [ -n "${HOME}" ] && [ -w "${HOME}" ]; then + SPOOLDIR="${HOME}/.spool" + mkdir -p "${SPOOLDIR}/${QUEUE}" +fi +# If failed, try to fall back to /tmp +if [ -z "${SPOOLDIR}" ] || [ ! -w "${SPOOLDIR}/${QUEUE}" ]; then + SPOOLDIR="/tmp/printergui/${USER}/" + rm -rf -- "${SPOOLDIR}" + mkdir -p "${SPOOLDIR}/${QUEUE}" +fi # Start the lpdaemon listening on the given port -# FixMe: Solution for general printer redirection in other cases (iptables on outgoing port) +# TODO: externalize with something like runtvirt.d (other parts might benefit from that too) tcpsvd -E 192.168.101.1 5515 \ lpd "$SPOOLDIR" \ - sh -c "/opt/openslx/cups/printergui $USER $SPOOLDIR/$QUEUE/\$DATAFILE" & + ash -c "/opt/openslx/cups/printergui '${USER}' \"${SPOOLDIR}/${QUEUE}/\$DATAFILE\"" & # PID to kill the process PID_LPD="$!" -- cgit v1.2.3-55-g7522