From 2870104a39cd44031dadcc659827b3c111229d23 Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Fri, 15 Mar 2024 15:50:05 -0400 Subject: [PATCH] KASM-5766 Add the ability to wait on the printer service Some use-cases require the printer to be ready before an app can be loaded. These updates allow the admin to be more agressive in the cups startup and to use /usr/bin/printer_ready to block on the printer in both the vnc_startup and custom_startup scripts --- src/common/startup_scripts/vnc_startup.sh | 11 +++++++++++ src/ubuntu/install/printer/install_printer.sh | 19 +++++++++++++++++++ src/ubuntu/install/printer/start_cups.sh | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/common/startup_scripts/vnc_startup.sh b/src/common/startup_scripts/vnc_startup.sh index a376630..64ebd1b 100755 --- a/src/common/startup_scripts/vnc_startup.sh +++ b/src/common/startup_scripts/vnc_startup.sh @@ -344,6 +344,16 @@ function start_printer (){ fi } +function wait_on_printer (){ + # Wait for cups and the printer device to be created + if [[ ${KASM_SVC_PRINTER:-1} == 1 && ${KASM_PRINTER_WAIT:-0} == 1 ]]; then + log 'Waiting on printer service to be ready' + /usr/bin/printer_ready + log 'Printer is ready' + fi +} + + function custom_startup (){ custom_startup_script=/dockerstartup/custom_startup.sh if [ -f "$custom_startup_script" ]; then @@ -504,6 +514,7 @@ chmod 600 $PASSWD_PATH # start processes +wait_on_printer start_kasmvnc start_window_manager start_audio_out_websocket diff --git a/src/ubuntu/install/printer/install_printer.sh b/src/ubuntu/install/printer/install_printer.sh index ceb9b2f..c89ab6c 100755 --- a/src/ubuntu/install/printer/install_printer.sh +++ b/src/ubuntu/install/printer/install_printer.sh @@ -32,3 +32,22 @@ ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g') mkdir -p $STARTUPDIR/printer wget -qO- https://kasmweb-build-artifacts.s3.amazonaws.com/kasm_printer_service/${COMMIT_ID}/kasm_printer_service_${ARCH}_${BRANCH}.${COMMIT_ID_SHORT}.tar.gz | tar -xvz -C $STARTUPDIR/printer/ echo "${BRANCH}:${COMMIT_ID}" > $STARTUPDIR/printer/kasm_printer.version + + +cat >/usr/bin/printer_ready <