Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OctoSplash! The OctoScreen Boot Screen Department of Redundency Depa… #258

Draft
wants to merge 4 commits into
base: 2.7.0-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Depends: ${shlibs:Depends},
libcairo2 (>= 1.14.0),
libgtk-3-0 (>= 3.14),
xserver-xorg,
xinit
xinit,
fbi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for the splash service.

Provides: x-display-manager
Description: A OctoPrint touch interface for TFT touch modules based on GTK+3
OOctoScreen OOctoScreen, a touch interface for TFT touch modules
Expand Down
48 changes: 48 additions & 0 deletions debian/local/octoscreen/boot_splash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

OCTOSCREEN_DEFAULT_BOOT_SPLASH="/opt/octoscreen/styles/z-bolt/images/boot-splash/"
FRAME_BUFFER=$1

if [[ -z "$FRAME_BUFFER" ]]; then
echo "Unable to detect valid Frame Buffer for OctoScreen Boot Splash"
else
# PARSE THE USER INPUT
if [[ -z "$OCTOSCREEN_BOOT_SPLASH" ]]; then
OCTOSCREEN_BOOT_SPLASH="$OCTOSCREEN_DEFAULT_BOOT_SPLASH"
echo "OCTOSCREEN_BOOT_SPLASH not set, using default ( $OCTOSCREEN_BOOT_SPLASH )"
elif [[ -f "$OCTOSCREEN_BOOT_SPLASH" ]]; then
if [[ ! $OCTOSCREEN_BOOT_SPLASH =~ .*\.png$ ]]; then
OCTOSCREEN_BOOT_SPLASH="$OCTOSCREEN_DEFAULT_BOOT_SPLASH"
echo "OCTOSCREEN_BOOT_SPLASH is not a valid PNG file, using default ( $OCTOSCREEN_BOOT_SPLASH )"
fi
elif [[ -d "$OCTOSCREEN_BOOT_SPLASH" ]]; then
if [[ "$( ls -A ${OCTOSCREEN_BOOT_SPLASH}/*.png )" ]]; then
OCTOSCREEN_BOOT_SPLASH="${OCTOSCREEN_BOOT_SPLASH}/*.png"
else
OCTOSCREEN_BOOT_SPLASH="$OCTOSCREEN_DEFAULT_BOOT_SPLASH"
echo "OCTOSCREEN_BOOT_SPLASH is a directory, but doesn't contain any PNG files, using default ( $OCTOSCREEN_BOOT_SPLASH )"
fi
else
OCTOSCREEN_BOOT_SPLASH="$OCTOSCREEN_DEFAULT_BOOT_SPLASH"
echo "OCTOSCREEN_BOOT_SPLASH neither a file or directory, using default ( $OCTOSCREEN_BOOT_SPLASH )"
fi

# FINAL VALIDATION OF PATH
if [[ ! $OCTOSCREEN_BOOT_SPLASH =~ .*\.png$ ]]; then
if [[ -d "$OCTOSCREEN_BOOT_SPLASH" ]] && [[ "$( ls -A ${OCTOSCREEN_BOOT_SPLASH}/*.png )" ]]; then
OCTOSCREEN_BOOT_SPLASH="${OCTOSCREEN_BOOT_SPLASH}/*.png"
echo "OCTOSCREEN_BOOT_SPLASH is a directory with PNGs, globbing ( $OCTOSCREEN_BOOT_SPLASH )"
else
echo "OCTOSCREEN_BOOT_SPLASH is neither a PNG file, or directory with PNG files. Exiting"
exit 1
fi
fi

if [[ ! "$( ls -A $OCTOSCREEN_BOOT_SPLASH )" ]]; then
echo "Can not resolve any files from supplied path ( $OCTOSCREEN_BOOT_SPLASH ), exiting."
exit 1;
fi

echo "Using Frame Buffer ( $FRAME_BUFFER ) and image/directory ( $OCTOSCREEN_BOOT_SPLASH )"
/usr/bin/fbi --noverbose --autodown -t 1 -d $FRAME_BUFFER $OCTOSCREEN_BOOT_SPLASH
fi
4 changes: 4 additions & 0 deletions debian/local/octoscreen/config
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ OCTOSCREEN_LOG_LEVEL=Error
OCTOSCREEN_RESOLUTION=800x480
# OCTOSCREEN_RESOLUTION is optional and defaults to 800x480 if missing
# (defined in globalVars.go)

# Path to the OctoScreen Splash Image.
# Must be a *.png file
OCTOSCREEN_BOOT_SPLASH=/etc/octosplash/splash.png
23 changes: 23 additions & 0 deletions debian/octoscreen.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,29 @@ if [ "$1" = configure ] && [ -d /etc/systemd/system/ ]; then
fi
fi

# Install the octoscreen Splash
if [ "$1" = configure ] && [ -f /lib/systemd/system/octosplash.service ]; then
echo "Configuring OctoSplash Service"
_fb=$(ls -1at /dev/fb* | grep -E "^/dev/fb[0-9]\$" | head -1)
__fb=$(grep -oP "(?<=[[:space:]])(/dev/fb[0-9])(?=[[:space:]]*)\$" /lib/systemd/system/octosplash.service )
if [ -z "$_fb" ] || [ -z "$__fb" ]; then
echo "Unable to determine Frame Buffer, skipping"
else
if ! grep -qE "^\w*disable_splash=1\w*\$" /boot/config.txt; then
echo "Dissabling default Raspberry Pi boot splash"
echo "disable_splash=1" >> /boot/config.txt
fi
if [ "$_fb" != "$__fb" ]; then
echo "Setting Frame Buffer to '$_fb'"
sed -i "s~$__fb~$_fb~g" /lib/systemd/system/octosplash.service
fi
if grep -q 'tty1' /boot/cmdline.txt ; then
echo "Redirecting boot messages and disabling cursor"
sed -i 's/console=tty1/console=tty3 logo.nologo consoleblank=0 loglevel=1 quiet vt.global_cursor_default=0/g' /boot/cmdline.txt
fi
fi
fi

db_stop || true

#DEBHELPER#
Expand Down
1 change: 1 addition & 0 deletions debian/octoscreen.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Type=notify
NotifyAccess=all
EnvironmentFile=/etc/octoscreen/config
ExecStart=/usr/bin/xinit /usr/bin/OctoScreen -- :0 -nolisten tcp -nocursor
ExecStartPost=/bin/bash -xc '/usr/bin/systemctl stop --quiet octosplash && exit 0 || exit 0'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stops the octosplash service so, if it is animated, it does not run in the background and on top of OctoScreen. Will always exit successfully, even if the service isn't running.

ExecStartPost=/bin/bash /etc/octoscreen/disablescreenblank.sh 0
StandardOutput=journal
Restart=always
Expand Down
14 changes: 14 additions & 0 deletions debian/octosplash.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=OctoScreen Boot Splash Screen
DefaultDependencies=no
After=local-fs.target

[Service]
EnvironmentFile=/etc/octoscreen/config
ExecStart=/bin/bash /etc/octoscreen/boot_splash.sh /dev/fb0
StandardOutput=journal+console
StandardInput=tty

[Install]
WantedBy=sysinit.target
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ override_dh_auto_build:
-X $(DH_GOPKG)/ui.Build=$(BUILD_DATE)\
"

override_dh_installinit:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required to install multiple services. Doesn't change any other behaviour.

dh_installinit --name=octosplash
dh_installinit --name=octoscreen

override_dh_golang:
# The dh_golang is used to add the Built-using field to the deb. This is only for reference.
# https://github.com/git-lfs/git-lfs/pull/2203/files
Expand Down
Binary file added styles/z-bolt/images/boot-splash/loading0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/z-bolt/images/boot-splash/loading1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/z-bolt/images/boot-splash/loading2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/z-bolt/images/boot-splash/loading3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/z-bolt/images/boot-splash/loading4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/z-bolt/images/boot-splash/loading5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.