diff --git a/config b/config index 6ff7053..1de7414 100644 --- a/config +++ b/config @@ -13,3 +13,10 @@ FIRST_USER_PASS="letmein" DISABLE_FIRST_BOOT_USER_RENAME=1 WPA_COUNTRY=US ENABLE_SSH=0 +STAGE_LIST="" +for d in stage*; do + if [ -d "$d" ] && [ ! -f "$d/SKIP" ]; then + STAGE_LIST+="$d " + fi +done +STAGE_LIST="$(echo "$STAGE_LIST" | xargs)" diff --git a/runtime-patches.sh b/runtime-patches.sh new file mode 100755 index 0000000..d4a3b34 --- /dev/null +++ b/runtime-patches.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Patches to run before building showpieceos +# Allows for non-destructive deletion of files + +rm stage2/EXPORT_IMAGE diff --git a/stage3/01-showpiece-browser/01-run.sh b/stage3/01-showpiece-browser/01-run.sh new file mode 100755 index 0000000..b0024dc --- /dev/null +++ b/stage3/01-showpiece-browser/01-run.sh @@ -0,0 +1,6 @@ +#!/bin/bash -e + +install -d -o 1000 -g 1000 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config/autostart" +install -m 644 files/kiosk.desktop "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config/autostart/" +chown -R 1000:1000 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.config +mkdir -p "${ROOTFS_DIR}/tmp" diff --git a/stage3/01-showpiece-browser/files/kiosk.desktop b/stage3/01-showpiece-browser/files/kiosk.desktop new file mode 100644 index 0000000..5367024 --- /dev/null +++ b/stage3/01-showpiece-browser/files/kiosk.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=Chromium +Exec=chromium-browser --profile-directory="showpiece-browser" --kiosk https://showpiece.sanin.dev/ +StartupNotify=false +Terminal=false diff --git a/stage4/99-force-hdmi-1/00-run.sh b/stage4/99-force-hdmi-1/00-run.sh new file mode 100755 index 0000000..253f0fb --- /dev/null +++ b/stage4/99-force-hdmi-1/00-run.sh @@ -0,0 +1,4 @@ +#!/bin/bash -e + +echo "Setting custom cmdline" +sed -i 's/$/ video=HDMI-A-1:1920x1080M@60/' "${ROOTFS_DIR}/boot/firmware/cmdline.txt" diff --git a/stage4/EXPORT_IMAGE b/stage4/EXPORT_IMAGE index 79ec11a..6e6dda7 100644 --- a/stage4/EXPORT_IMAGE +++ b/stage4/EXPORT_IMAGE @@ -1,4 +1,4 @@ -IMG_SUFFIX="" +IMG_SUFFIX="-client" if [ "${USE_QEMU}" = "1" ]; then export IMG_SUFFIX="${IMG_SUFFIX}-qemu" fi diff --git a/stage4/SKIP b/stage4/SKIP deleted file mode 100644 index e69de29..0000000 diff --git a/stage3/02-docker/00-packages b/stage9/01-docker/00-packages similarity index 50% rename from stage3/02-docker/00-packages rename to stage9/01-docker/00-packages index 4923edd..7e9d3ff 100644 --- a/stage3/02-docker/00-packages +++ b/stage9/01-docker/00-packages @@ -1,3 +1,3 @@ apt-transport-https gnupg2 -software-properties-common \ No newline at end of file +software-properties-common diff --git a/stage3/02-docker/01-run-chroot.sh b/stage9/01-docker/01-run-chroot.sh similarity index 96% rename from stage3/02-docker/01-run-chroot.sh rename to stage9/01-docker/01-run-chroot.sh index e9df43f..1e3bf9a 100755 --- a/stage3/02-docker/01-run-chroot.sh +++ b/stage9/01-docker/01-run-chroot.sh @@ -4,4 +4,4 @@ curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gp echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \ $(lsb_release -cs) stable" | \ tee /etc/apt/sources.list.d/docker.list -apt update \ No newline at end of file +apt update diff --git a/stage3/02-docker/02-packages b/stage9/01-docker/02-packages similarity index 100% rename from stage3/02-docker/02-packages rename to stage9/01-docker/02-packages diff --git a/stage3/02-docker/03-run-chroot.sh b/stage9/01-docker/03-run-chroot.sh similarity index 100% rename from stage3/02-docker/03-run-chroot.sh rename to stage9/01-docker/03-run-chroot.sh diff --git a/stage9/02-showpiece/01-run.sh b/stage9/02-showpiece/01-run.sh new file mode 100755 index 0000000..a8ff493 --- /dev/null +++ b/stage9/02-showpiece/01-run.sh @@ -0,0 +1,11 @@ +#!/bin/bash -e + +install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config/showpiece" +install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config/showpiece/config" +install -m 644 files/docker-compose.yml "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config/showpiece/" +install -m 644 files/config.json5 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config/showpiece/config/" +install -d -o 1000 -g 1000 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config/autostart" +install -m 644 files/kiosk.desktop "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config/autostart/" +chown -R 1000:1000 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.config +mkdir -p "${ROOTFS_DIR}/tmp" +echo "$FIRST_USER_NAME" > "${ROOTFS_DIR}/tmp/first_username" diff --git a/stage9/02-showpiece/02-run-chroot.sh b/stage9/02-showpiece/02-run-chroot.sh new file mode 100755 index 0000000..6e0210f --- /dev/null +++ b/stage9/02-showpiece/02-run-chroot.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +USERNAME=$(cat /tmp/first_username) +COMPOSEFILE="/home/$USERNAME/.config/showpiece/docker-compose.yml" + +echo "@reboot docker compose --file '$COMPOSEFILE' up -d && chromium --kiosk 'http://localhost:8080/?w=1080'" >> /tmp/user.crontab +echo "40 3 * * * docker compose --file '$COMPOSEFILE' pull && docker compose --file '$COMPOSEFILE' up -d" >> /tmp/user.crontab + +crontab -u "$USERNAME" /tmp/user.crontab + +rm /tmp/first_username +rm /tmp/user.crontab diff --git a/stage9/02-showpiece/files/config.json5 b/stage9/02-showpiece/files/config.json5 new file mode 100644 index 0000000..f140f59 --- /dev/null +++ b/stage9/02-showpiece/files/config.json5 @@ -0,0 +1,14 @@ +{ + // Port for the viewer + "port": 8080, + // Port for the control panel + // (use a different port to restrict access to this interface) + "controlport": 8080, + // (optional) provide weather data to modules that support it + "weather": { + // Provide an OpenWeatherMap API key + // https://openweathermap.org/price + // "key": "not0a0real0key00281f631aef6ad3a1", + // "city": "chicago" + } +} \ No newline at end of file diff --git a/stage9/02-showpiece/files/docker-compose.yml b/stage9/02-showpiece/files/docker-compose.yml new file mode 100644 index 0000000..3967c7a --- /dev/null +++ b/stage9/02-showpiece/files/docker-compose.yml @@ -0,0 +1,10 @@ +services: + showpiece: + container_name: showpiece + image: corysanin/showpiece:latest + restart: always + ports: + - 8080:8080 + volumes: + - /etc/localtime:/etc/localtime:ro + - ./config:/usr/src/showpiece/config diff --git a/stage9/02-showpiece/files/kiosk.desktop b/stage9/02-showpiece/files/kiosk.desktop new file mode 100644 index 0000000..6567b48 --- /dev/null +++ b/stage9/02-showpiece/files/kiosk.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=Chromium +Exec=chromium-browser --profile-directory="showpiece-browser" --kiosk http://localhost:8080/?w=1080 +StartupNotify=false +Terminal=false diff --git a/stage9/EXPORT_IMAGE b/stage9/EXPORT_IMAGE new file mode 100644 index 0000000..3849d94 --- /dev/null +++ b/stage9/EXPORT_IMAGE @@ -0,0 +1,4 @@ +IMG_SUFFIX="-standalone" +if [ "${USE_QEMU}" = "1" ]; then + export IMG_SUFFIX="${IMG_SUFFIX}-qemu" +fi diff --git a/stage9/prerun.sh b/stage9/prerun.sh new file mode 100755 index 0000000..9acd13c --- /dev/null +++ b/stage9/prerun.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +if [ ! -d "${ROOTFS_DIR}" ]; then + copy_previous +fi