commit e4e3096ceea1a9163cc00b237a10fef7c94b2b82 Author: jonas Date: Sun Oct 1 22:21:01 2023 +0200 first commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..818bca0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu:16.04 + +ARG DEBIAN_FRONTEND=noninteractive +RUN dpkg --add-architecture i386 && \ + apt-get update && \ + apt-get install sudo wget ca-certificates --no-install-recommends -y && \ + mkdir /opt/setup /usr/share/desktop-directories/ -p && \ + cd /opt/setup && \ + wget -O smart.tar.gz https://downloads.smarttech.com/software/nb/11linux/11_3sp4/debian/smart_software_deb_archive.tar.gz && \ + tar -xvf smart.tar.gz && \ + ( dpkg -i ./*.deb; true ) && \ + apt-get install -yf && \ + cd / && \ + rm -rf /opt/setup && \ + rm -rf /var/lib/apt/lists/* +COPY entrypoint.sh /entrypoint.sh +CMD bash /entrypoint.sh \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7b291c3 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +Has this ever happened to you? +You paid massive amounts for digital whiteboards years ago and cannot use them with the included software on Linux now since the manufacturer only built the software up until 2019 when Ubuntu 16.04 was still the most up-to-date version to them, leading you to dependancy hell when trying to install their software on your shiny new Ubuntu install? + +Well, worry not! I've got just the thing for you~ + +# SMART Notebook 11 in Docker # + +This repository contains a Dockerfile and some helper files, which when build and installed, run SMART Notebook 11 SP4 on pretty much any Linux machine by installing SMART Notebook 11 from scratch into a base Ubuntu 16.04 Docker container and fowards both the hosts' X11 server connection and your home directory all neatly tucked away behind a .desktop file so you can just double click on a SMART Notebook 11 document and have it automagically open in the Docker SMART Notebook 11 container, all on your modern Ubuntu or Debian or whatever else you may have, without touching any of your system libraries with outdated packages and broken dependancies! + +## How to install ## +Just clone the repo with `git clone https://git.diskcat.com/Resneptacle/smart-notebook-11-docker.git`, then `cd smart-notebook-11-docker` and run the `install.sh` as user, NOT AS ROOT, e.g. with `bash install.sh`. + +This assumes that your own user is able to build and start Docker containers, if you haven't installed Docker yet or haven't configured it for your user account, see here: +- [Install Docker Engine](https://docs.docker.com/engine/install/) +- [Manage Docke4r as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) \ No newline at end of file diff --git a/SMART_Notebook.png b/SMART_Notebook.png new file mode 100644 index 0000000..ef7a5d4 Binary files /dev/null and b/SMART_Notebook.png differ diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..1c1d6ab --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,23 @@ +#/bin/bash +set -e + +if [ "${UID}" = "" ] || [ "${GID}" = "" ]; then + echo "UID or GID environment variable not set, cannot start SMART Notebook!" + exit 1 +fi + +if [ "${USER}" = "" ] || [ "${USER}" = "root"]; then + echo "USER variable is not properly set, current value: ${USER}" + exit 1 +fi + +if [ "${HOME}" = "" ]; then + echo "HOME variable not set!" + exit 1 +fi + +# Create user and group +groupadd -g ${GID} user +useradd ${USER} -d ${HOME} -s /bin/bash -u ${UID} -g ${GID} + +sudo -Eu ${USER} "/opt/SMART Technologies/Notebook Software/bin/Notebook/notebook" ${SMART_ARGS} \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..c909e26 --- /dev/null +++ b/install.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +TARGET_DIR="${HOME}/.local/smart-docker" +APPS_DIR="${HOME}/.local/share/applications/" + +# Build current docker image from Dockerfile +docker build -t notebook-gui . + +# Create target directory in user home +if [ ! -d "${TARGET_DIR}" ]; then + mkdir -p "${TARGET_DIR}" +fi + +# Copy necessary files over +cp SMART_Notebook.png start.sh "${TARGET_DIR}/" +cp notebook-docker.desktop "${HOME}/.local/share/applications/" + +# Mark start.sh as executable +chmod +x "${TARGET_DIR}/start.sh" + +# Replace variable in desktop file +sed -i "s#{{TARGET_DIR}}#${TARGET_DIR}#g" "${APPS_DIR}/notebook-docker.desktop" \ No newline at end of file diff --git a/notebook-docker.desktop b/notebook-docker.desktop new file mode 100644 index 0000000..20d5ed3 --- /dev/null +++ b/notebook-docker.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=SMART Notebook (Docker) +Comment=Runs SMART Notebook in a Docker container +Path={{TARGET_DIR}} +Exec={{TARGET_DIR}}/start.sh %F +Icon={{TARGET_DIR}}/SMART_Notebook.png +MimeType=application/x-smarttech-notebook; +Categories=SMART-Technologies; \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..076931c --- /dev/null +++ b/start.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Allow local and docker connections to X11 on the host +xhost + local:docker >/dev/null + +# TODO: Add /media to mapped directories to allow removable media + +# Run docker container +docker run \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -v ${HOME}:${HOME} \ + -e DISPLAY=${DISPLAY} \ + -e HOME=${HOME} \ + -e USER=${USER} \ + -e UID=${UID} \ + -e GID=$(id -g ${USER}) \ + -e SMART_ARGS=${@} \ + -h ${HOSTNAME} \ + notebook-gui \ No newline at end of file