Files
venus/dbus-no-foreign-land/install_gui.sh
dev 9756538f16 Initial commit: Venus OS boat addons monorepo
Organizes 11 projects for Cerbo GX/Venus OS into a single repository:
- axiom-nmea: Raymarine LightHouse protocol decoder
- dbus-generator-ramp: Generator current ramp controller
- dbus-lightning: Blitzortung lightning monitor
- dbus-meteoblue-forecast: Meteoblue weather forecast
- dbus-no-foreign-land: noforeignland.com tracking
- dbus-tides: Tide prediction from depth + harmonics
- dbus-vrm-history: VRM cloud history proxy
- dbus-windy-station: Windy.com weather upload
- mfd-custom-app: MFD app deployment package
- venus-html5-app: Custom Victron HTML5 app fork
- watermaker: Watermaker PLC control UI

Adds root README, .gitignore, project template, and per-project
.gitignore files. Sensitive config files excluded via .gitignore
with .example templates provided.

Made-with: Cursor
2026-03-16 17:04:16 +00:00

164 lines
4.8 KiB
Bash

#!/bin/bash
#
# Install GUI modifications for NFL (No Foreign Land) Tracking
#
# This script:
# 1. Copies PageSettingsNflTracking.qml to the GUI directory
# 2. Patches PageSettingsGps.qml to add NFL Tracking (inserts between Format and Speed Unit)
# 3. Restarts the GUI
#
# Note: These changes will be lost on firmware update. Run again after updating.
#
# Usage:
# ./install_gui.sh # Install GUI modifications
# ./install_gui.sh --remove # Remove GUI modifications and restore originals
#
set -e
QML_DIR="/opt/victronenergy/gui/qml"
INSTALL_DIR="/data/dbus-no-foreign-land"
BACKUP_DIR="/data/dbus-no-foreign-land/backup"
install_gui() {
echo "=================================================="
echo "Installing NFL Tracking GUI modifications..."
echo "=================================================="
# Check if our service is installed
if [ ! -f "$INSTALL_DIR/nfl_tracking.py" ]; then
echo "ERROR: Main service not installed. Run install.sh first."
exit 1
fi
# Check if QML directory exists
if [ ! -d "$QML_DIR" ]; then
echo "ERROR: GUI directory not found: $QML_DIR"
exit 1
fi
# Create backup directory
mkdir -p "$BACKUP_DIR"
# Step 1: Copy our QML file
echo "1. Installing PageSettingsNflTracking.qml..."
if [ -f "$INSTALL_DIR/qml/PageSettingsNflTracking.qml" ]; then
cp "$INSTALL_DIR/qml/PageSettingsNflTracking.qml" "$QML_DIR/"
echo " Copied to $QML_DIR/"
else
echo "ERROR: PageSettingsNflTracking.qml not found"
exit 1
fi
# Step 2: Patch PageSettingsGps.qml (insert between Format and Speed Unit)
echo "2. Patching PageSettingsGps.qml..."
GPS_QML="$QML_DIR/PageSettingsGps.qml"
if [ ! -f "$GPS_QML" ]; then
echo " PageSettingsGps.qml not found - configure via Settings > GPS > NFL Tracking"
elif grep -q "PageSettingsNflTracking" "$GPS_QML"; then
echo " Already patched, skipping..."
else
if [ ! -f "$BACKUP_DIR/PageSettingsGps.qml.orig" ]; then
cp "$GPS_QML" "$BACKUP_DIR/PageSettingsGps.qml.orig"
echo " Backup saved to $BACKUP_DIR/"
fi
python3 << 'PYTHON_SCRIPT'
import re
qml_file = "/opt/victronenergy/gui/qml/PageSettingsGps.qml"
with open(qml_file, 'r') as f:
content = f.read()
if 'PageSettingsNflTracking' in content:
print("Already patched")
exit(0)
# Insert before Speed Unit block - exact structure from original file
menu_entry = '''
MbSubMenu {
description: qsTr("NFL Tracking")
subpage:
Component {
PageSettingsNflTracking {
title: qsTr("NFL Tracking")
}
}
}
'''
pattern = r"(\n\t\tMbItemOptions \{\n\t\t\tid: speedUnit)"
new_content = re.sub(pattern, menu_entry + r'\1', content, count=1)
if new_content == content:
pattern2 = r"(\n\t\tMbItemOptions \{\n\t\t\tid: format)"
new_content = re.sub(pattern2, menu_entry + r'\1', content, count=1)
if new_content == content:
print("ERROR: Could not find insertion point")
exit(1)
with open(qml_file, 'w') as f:
f.write(new_content)
print("Patched successfully")
PYTHON_SCRIPT
if [ $? -ne 0 ]; then exit 1; fi
echo " Patch applied"
fi
# Step 3: Restart GUI
echo "3. Restarting GUI..."
if [ -d /service/start-gui ]; then
svc -t /service/start-gui
sleep 2
elif [ -d /service/gui ]; then
svc -t /service/gui
sleep 2
else
echo " Note: GUI service not found. Restart manually or reboot."
fi
echo ""
echo "=================================================="
echo "GUI installation complete!"
echo "=================================================="
echo ""
echo "NFL Tracking should appear in: Settings -> GPS -> NFL Tracking"
echo "If GUI goes blank, run: install_gui.sh --remove"
echo ""
echo "Note: Run this script again after firmware updates."
echo ""
}
remove_gui() {
echo "=================================================="
echo "Removing NFL Tracking GUI modifications..."
echo "=================================================="
if [ -f "$QML_DIR/PageSettingsNflTracking.qml" ]; then
rm "$QML_DIR/PageSettingsNflTracking.qml"
echo "1. Removed PageSettingsNflTracking.qml"
fi
if [ -f "$BACKUP_DIR/PageSettingsGps.qml.orig" ]; then
cp "$BACKUP_DIR/PageSettingsGps.qml.orig" "$QML_DIR/PageSettingsGps.qml"
echo "2. Restored original PageSettingsGps.qml"
fi
echo "3. Restarting GUI..."
if [ -d /service/start-gui ]; then
svc -t /service/start-gui
sleep 2
elif [ -d /service/gui ]; then
svc -t /service/gui
sleep 2
fi
echo ""
echo "GUI modifications removed."
echo ""
}
# Main
case "$1" in
--remove)
remove_gui
;;
*)
install_gui
;;
esac