Files
venus/mfd-custom-app/install.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

108 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
#
# Install Custom MFD App for Venus OS
#
# Deploys the custom HTML5 app to /data/www/app/ which overrides
# the default Victron app. The original remains at /default/app/.
#
# Usage:
# ./install.sh
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
APP_SOURCE="$SCRIPT_DIR/app"
INSTALL_DIR="/data/www/app"
BACKUP_DIR="/data/www/app.backup"
RC_LOCAL="/data/rc.local"
echo "=================================================="
echo "Custom MFD App - Installation"
echo "=================================================="
if [ ! -d "/data" ]; then
echo "ERROR: /data not found. Not a Venus OS device."
exit 1
fi
if [ ! -d "$APP_SOURCE" ]; then
echo "ERROR: App files not found in $APP_SOURCE"
echo " Run package.sh first to build the app."
exit 1
fi
echo "1. Backing up existing custom app (if any)..."
if [ -d "$INSTALL_DIR" ]; then
if [ -d "$BACKUP_DIR" ]; then
rm -rf "$BACKUP_DIR"
fi
cp -r "$INSTALL_DIR" "$BACKUP_DIR"
echo " Backed up to $BACKUP_DIR"
else
echo " No existing custom app found"
fi
echo "2. Installing custom MFD app..."
mkdir -p "$INSTALL_DIR"
rm -rf "${INSTALL_DIR:?}/"*
cp -r "$APP_SOURCE/"* "$INSTALL_DIR/"
echo " Installed to $INSTALL_DIR"
echo "3. Copying package to /data for persistence..."
if [ "$SCRIPT_DIR" != "/data/mfd-custom-app" ]; then
mkdir -p /data/mfd-custom-app
cp -r "$SCRIPT_DIR/"* /data/mfd-custom-app/
echo " Copied to /data/mfd-custom-app"
else
echo " Already in /data/mfd-custom-app"
fi
echo "4. Setting up rc.local for persistence..."
if [ ! -f "$RC_LOCAL" ]; then
echo '#!/bin/bash' > "$RC_LOCAL"
chmod +x "$RC_LOCAL"
fi
# Remove any existing mfd-custom-app entries (clean upgrade)
if grep -q "# BEGIN mfd-custom-app" "$RC_LOCAL"; then
sed -i '/# BEGIN mfd-custom-app/,/# END mfd-custom-app/d' "$RC_LOCAL"
elif grep -q "mfd-custom-app" "$RC_LOCAL"; then
TEMP_RC=$(mktemp)
grep -v "mfd-custom-app" "$RC_LOCAL" | grep -v "# Custom MFD App" > "$TEMP_RC" || true
mv "$TEMP_RC" "$RC_LOCAL"
chmod +x "$RC_LOCAL"
fi
cat >> "$RC_LOCAL" << 'RCLOCAL'
# BEGIN mfd-custom-app
if [ -d /data/mfd-custom-app/app ] && [ ! -d /data/www/app ]; then
mkdir -p /data/www/app
cp -r /data/mfd-custom-app/app/* /data/www/app/
fi
if [ -x /data/mfd-custom-app/apply-nginx-override.sh ]; then
/data/mfd-custom-app/apply-nginx-override.sh &
fi
# END mfd-custom-app
RCLOCAL
echo " Added to rc.local for persistence"
echo "5. Applying nginx override..."
if [ -x "$SCRIPT_DIR/apply-nginx-override.sh" ]; then
"$SCRIPT_DIR/apply-nginx-override.sh"
elif [ -x /data/mfd-custom-app/apply-nginx-override.sh ]; then
/data/mfd-custom-app/apply-nginx-override.sh
fi
echo " Custom app now serving at /app/"
echo ""
echo "=================================================="
echo "Installation complete!"
echo "=================================================="
echo ""
echo "Custom app: http://CERBO_IP/app/"
echo "Original app: http://CERBO_IP/default/app/"
echo ""
echo "To uninstall: ./uninstall.sh"
echo ""