You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

#!/bin/bash
# Allow local and docker connections to X11 on the host
xhost + local:docker >/dev/null
# Populate required variables if empty
[ "${USER}" = "" ] && USER=$(whoami)
[ "${HOME}" = "" ] && HOME="/home/${USER}"
[ "${HOSTNAME}" = "" ] && HOSTNAME=$(hostname)
[ "${UID}" = "" ] && UID=$(id -u)
[ "${GID}" = "" ] && GID=$(id -g "${USER}")
# Include /media/$USER folder if it exists for removable media
if [ -d "/media/${USER}" ]; then
echo "Finding mounted removable media:"
for i in $(find "/media/${USER}/" -mindepth 1 -maxdepth 1 -type d); do
echo " Found ${i}"
USER_MEDIA_DIR_ARG="${USER_MEDIA_DIR_ARG} -v ${i}:${i}"
done
fi
# Notebook writes some licensing data under /opt, so this
# dir gets mapped to the current users home directory too
LICENSE_DIR="${HOME}/.config/smart-notebook-license"
LICENSE_DIR_CONTAINER="/opt/SMART Technologies/common/data/"
[ ! -d "${LICENSE_DIR}" ] && mkdir -p "${LICENSE_DIR}"
# Run docker container
docker run \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v "${LICENSE_DIR}":"${LICENSE_DIR_CONTAINER}" \
-v "${HOME}":"${HOME}" \
${USER_MEDIA_DIR_ARG} \
-e DISPLAY="${DISPLAY}" \
-e HOME="${HOME}" \
-e USER="${USER}" \
-e UID="${UID}" \
-e GID="${GID}" \
-e SMART_ARGS="${@}" \
-h "${HOSTNAME}" \
notebook-gui