Last active
January 28, 2021 21:08
-
-
Save realStandal/bf9a24dae27b2f83fd57934232dd1673 to your computer and use it in GitHub Desktop.
Kiosked Electron running on Ubuntu Core powered by a Raspberry Pi 3 Model B for
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from https://forum.snapcraft.io/t/greatly-simplified-electron-kiosk-snaps/21303 | |
# Modified to work with https://launchpad.net and to explicitly build for `arm64` architectures (Pi-3-B) | |
name: electron-hello-world-kiosk | |
version: '0.1' | |
summary: Hello World Electron app for a Kiosk | |
description: | | |
Simple Hello World Electron app as an example of a HTML5 Kiosk | |
base: core18 | |
confinement: strict | |
grade: devel | |
compression: lzo | |
architectures: | |
- build-on: arm64 | |
run-on: arm64 | |
apps: | |
electron-hello-world-kiosk: | |
daemon: simple | |
extensions: [ gnome-3-28 ] | |
restart-condition: always | |
command: snap/command-chain/desktop-launch xwayland-kiosk-launch $SNAP/electron-helloworld/electron-quick-start --no-sandbox | |
plugs: | |
- browser-support | |
- network | |
- network-bind | |
- opengl | |
- pulseaudio | |
- wayland | |
layout: | |
/usr/share/fonts: | |
bind: $SNAP/usr/share/fonts | |
environment: | |
XWAYLAND_FULLSCREEN_WINDOW_HINT: window_role="browser-window" | |
parts: | |
electron-helloworld: | |
plugin: nil | |
source: https://github.com/electron/electron-quick-start.git | |
override-build: | | |
# Configuration to let `snapcraft remote-build` process work using Launchpad.net | |
if [ -n "$http_proxy" ]; then | |
export ELECTRON_GET_USE_PROXY=1 | |
export GLOBAL_AGENT_HTTP_PROXY="${http_proxy}" | |
export GLOBAL_AGENT_HTTPS_PROXY="${http_proxy}" | |
fi && | |
# Configuration for non-elevated build permissions | |
npm config set scripts-prepend-node-path true | |
npm config set unsafe-perm true | |
npm install electron-packager | |
./node_modules/.bin/electron-packager . --overwrite \ | |
--platform=linux --output=release-build --prune=true | |
cp -v -R ./electron-quick-start-linux-* $SNAPCRAFT_PART_INSTALL/electron-helloworld | |
stage-packages: | |
- libnspr4 | |
- libnss3 | |
build-snaps: | |
- node/14/stable | |
xwayland-kiosk-helper: | |
plugin: cmake | |
source: https://github.com/MirServer/xwayland-kiosk-helper.git | |
build-packages: [ build-essential ] | |
stage-packages: [ xwayland, i3, libegl1-mesa, libgl1-mesa-glx ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To-Use:
Assuming you've installed Ubuntu Core on your Raspberry Pi. The Raspberry Pi Imager provides it for easy-setup.
Your device will be the Raspberry Pi running Ubuntu Core. Your machine will be what is used to build the Snap.
mir-kiosk
by runningsnap install mir-kiosk
.--destructive-mode
option, I have yet to try it using this method.scp ./path/to/electron-*.snap device-user@device-ip:~
.ssh
to access your device remotely.snap install --dangerous ./path/to/electron-*.snap
(Assuming you used the default
electron-quick-start
repository to build from) When connected to a display, you should see the "Hello World!" greeting of your Electron app. Quitting the application, by any means (forcefully, closing the window, restarting the device) will cause the device to reboot directly to this application.