- menus/display.sh: second menu migrated onto lib/menu.sh + lib/config.sh, covering touch gesture mode, link navigation security, and the pause/keyboard/navigation button toggles (previously three separate Core Settings entries). Deliberately a different shape from Sites (toggle list vs. list CRUD) to exercise the framework more broadly. Wired into install.sh's top-level menu alongside Sites. - Renamed ubuntu-based-kiosk-v1.0.3.sh -> ubuntu-based-kiosk.sh so the installer can be updated in place instead of growing a new version-numbered filename every release; released versions are now tracked via git history and the in-script changelog. Updated all Readme download/re-run commands accordingly. Older versioned files (ubuntu-based-kiosk-v*.sh, install_kiosk_*.sh) are left in place as archived releases. - Bumped SCRIPT_VERSION to 2.0.0 (new script-level changelog entry) and the Readme version/changelog to match, given the new modular management path, the rename, and the two real bugs fixed along the way (settings clobbered on save, off-by-one in reorder). Verified before moving on to the web admin work: - Regression: re-ran the full Sites scratch-config test suite (add, edit, delete, reorder, home) - still clean, no invalid-input paths hit. - New: scratch-config test for every display.sh action (touch mode, navigation security, all three toggles), confirming values persist through save/reload and that a previously-added site survives untouched across Display-menu saves. - End-to-end: ran the real install.sh (not just sourced functions) as a genuine non-root, non-"kiosk" user with real sudo, driving actual menu input through Sites -> add a page -> Display -> toggle a setting -> exit. Confirmed final config.json on disk matches every action taken, and both guard clauses (run as root; no installed kiosk found) fire correctly.
80 lines
2.7 KiB
Bash
Executable File
80 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
|
################################################################################
|
|
# install.sh - Modular management entry point for Ubuntu Based Kiosk.
|
|
#
|
|
# This is NOT yet the full system installer - that is still the big
|
|
# single-file script (ubuntu-based-kiosk-v1.0.3.sh etc) documented in
|
|
# Readme.md, and first-time provisioning of a new kiosk still goes through
|
|
# it. This entry point is the start of pulling the *menu system* out of
|
|
# that 12k-line file into small, independently editable modules under
|
|
# lib/ and menus/, so a change to (say) the Sites menu can't accidentally
|
|
# break WiFi setup or the uninstaller three thousand lines away.
|
|
#
|
|
# Today this wires up Sites & Page Timing (menus/sites.sh) and Display &
|
|
# Interaction (menus/display.sh). The rest of Core Settings/Addons/Advanced
|
|
# will move over the same way, one menus/*.sh file at a time.
|
|
#
|
|
# Usage (once the kiosk has already been installed):
|
|
# git clone <repo>
|
|
# cd ubuntu-based-kiosk
|
|
# ./install.sh
|
|
################################################################################
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# shellcheck source=lib/menu.sh
|
|
source "$SCRIPT_DIR/lib/menu.sh"
|
|
# shellcheck source=lib/config.sh
|
|
source "$SCRIPT_DIR/lib/config.sh"
|
|
# shellcheck source=menus/sites.sh
|
|
source "$SCRIPT_DIR/menus/sites.sh"
|
|
# shellcheck source=menus/display.sh
|
|
source "$SCRIPT_DIR/menus/display.sh"
|
|
|
|
################################################################################
|
|
# Preflight
|
|
################################################################################
|
|
|
|
if [[ "$(whoami)" == "kiosk" ]]; then
|
|
log_error "Cannot run as user 'kiosk'"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ $EUID -eq 0 ]]; then
|
|
log_error "Run as a regular user with sudo privileges, not as root"
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v jq &>/dev/null; then
|
|
log_error "jq is required but not installed. Run: sudo apt-get install -y jq"
|
|
exit 1
|
|
fi
|
|
|
|
if ! is_kiosk_installed; then
|
|
echo
|
|
log_error "No installed kiosk found at ${KIOSK_DIR}."
|
|
echo
|
|
echo "This tool manages an already-installed kiosk. To provision a new"
|
|
echo "one for the first time, use the full installer instead - see"
|
|
echo "Readme.md ('Quick Install') for the current download command."
|
|
echo
|
|
exit 1
|
|
fi
|
|
|
|
################################################################################
|
|
# Top-level menu
|
|
################################################################################
|
|
|
|
main_menu_builder() {
|
|
MENU_LABELS=("Sites & Page Timing" "Display & Interaction")
|
|
MENU_HANDLERS=(sites_menu display_menu)
|
|
}
|
|
|
|
main_menu_status() {
|
|
echo "Managing kiosk at: ${KIOSK_DIR}"
|
|
}
|
|
|
|
run_menu "UBUNTU BASED KIOSK - MANAGEMENT" main_menu_builder main_menu_status "Exit"
|