copilot-swe-agent[bot] d4e2bb5962 Update all sbin scripts to V2.0 and make installer path-independent
Co-authored-by: ShaYmez <76499782+ShaYmez@users.noreply.github.com>
2025-12-13 01:36:40 +00:00

70 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# HBLINK3 DOCKER CONTROL SCRIPTS V2.0
# Version 13122025
# This script written by Shane Daley M0VUB. The script gracefully shuts down services while services are cleaned and logs are truncated.
# We can also add items in this script for future use like updates or further log trims.
# Add to the cron tab for auto execution
# Copyright (C) 2020-2025 Shane P. Daley M0VUB <support@gb7nr.co.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Initial Setup MENU system.....
while : ; do
menuopt=$(whiptail --title "INITIAL SETUP - HBLINK3 DOCKER V2.0" --menu "Select option by using the up and down arrows on your keyboard. Once selected please press enter:" 23 56 13 \
1 " Re-Install " \
2 " Bash Shell (Type 'exit' to return to menu) " \
3 " Edit HBlink Config " \
4 " Edit HBlink Rules " \
5 " Edit Dashboard Config (Advanced) " \
6 " Edit Dashboard PHP Config (Advanced) " \
7 " System Update / apt update " \
8 " Finish Setup & Exit " 3>&1 1>&2 2>&3)
exitstatus=$?
# Back-end HBlink3 menu
if [ $exitstatus = 0 ]; then
echo "You have chosen option:" $menuopt
else
echo "Type 'hblink-menu' to enter HBlink3 Control Menu "; break;
fi
# Action
case $menuopt in
1)
# Read installer path from saved location, fallback to default if not found
INSTALLER_PATH=$(cat /etc/hblink3/.installer_path 2>/dev/null || echo "/opt/hblink3-docker-install")
if [ -f "$INSTALLER_PATH/hblink3-docker-install.sh" ]; then
sudo "$INSTALLER_PATH/hblink3-docker-install.sh"
else
echo "Error: Installer not found at $INSTALLER_PATH"
echo "Please ensure the installer directory still exists."
read -p "Press Enter to continue..."
fi ;;
2)
sudo /usr/bin/bash ;;
3)
sudo nano /etc/hblink3/hblink.cfg ;;
4)
sudo nano /etc/hblink3/rules.py ;;
5)
sudo nano /opt/HBMonv2/config.py ;;
6)
sudo nano /var/www/html/include/config.php ;;
7)
sudo apt update && apt upgrade ;;
8)
sudo hblink-flush && exit 0 ;;
esac
done
exit 0
# Wiptail INITIAL SETUP by ShaYmez https://github/ShaYmez