mirror of
https://github.com/kasmtech/workspaces-core-images.git
synced 2024-11-07 08:04:06 +01:00
Merge branch 'feature/KASM-5766_printer_sequencing' into 'develop'
KASM-5766 Add the ability to wait on the printer service Closes KASM-5766 See merge request kasm-technologies/internal/workspaces-core-images!210
This commit is contained in:
commit
634c8429e2
@ -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
|
||||
@ -509,6 +519,7 @@ chmod 600 $PASSWD_PATH
|
||||
|
||||
|
||||
# start processes
|
||||
wait_on_printer
|
||||
start_kasmvnc
|
||||
start_window_manager
|
||||
start_audio_out_websocket
|
||||
|
@ -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 <<EOL
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
if [[ \${KASM_SVC_PRINTER:-1} == 1 ]]; then
|
||||
PRINTER_NAME=\${KASM_PRINTER_NAME:-Kasm-Printer}
|
||||
until [[ "\$(lpstat -r)" == "scheduler is running" ]]; do sleep 1; done
|
||||
echo "Scheduler is running"
|
||||
|
||||
until lpstat -p "\$PRINTER_NAME" | grep -q "is idle"; do
|
||||
sleep 1
|
||||
done
|
||||
echo "Printer \$PRINTER_NAME is idle."
|
||||
else
|
||||
echo "Printing service is not enabled"
|
||||
fi
|
||||
EOL
|
||||
chmod +x /usr/bin/printer_ready
|
||||
|
@ -7,7 +7,7 @@ set -ex
|
||||
# HACK: Some versions of cupsd cannot handle unlimited file descriptor limit
|
||||
# that docker sets..
|
||||
ulimit -n 1024 &&/usr/sbin/cupsd -f &
|
||||
until [[ "$(lpstat -r)" == "scheduler is running" ]]; do sleep 15; done
|
||||
until [[ "$(lpstat -r)" == "scheduler is running" ]]; do sleep ${KASM_CUPS_SLEEP:-15}; done
|
||||
|
||||
echo "Creating a virtual printer: $PRINTER_NAME"
|
||||
lpadmin -p $PRINTER_NAME -E -v cups-pdf:/ -P /etc/cups/ppd/kasm.ppd
|
||||
|
Loading…
Reference in New Issue
Block a user