Address code review feedback: fix typo, menu height, and refactor pip helper

Co-authored-by: ShaYmez <76499782+ShaYmez@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-13 01:16:43 +00:00
parent 89ade8cf14
commit fcc314a46d
3 changed files with 23 additions and 15 deletions

View File

@ -95,8 +95,11 @@ install_docker_and_dependencies() {
# Install docker-compose based on Debian version # Install docker-compose based on Debian version
if [ $version -ge 12 ]; then if [ $version -ge 12 ]; then
# For Debian 12+ use docker-compose-plugin or install from GitHub # For Debian 12+ use docker-compose-plugin or install from GitHub
# Note: We prefer docker-compose-plugin from apt repos when available for security
apt-get install -y docker-compose-plugin 2>/dev/null || { apt-get install -y docker-compose-plugin 2>/dev/null || {
echo "Installing docker-compose from GitHub releases..." echo "Installing docker-compose from GitHub releases..."
# Fallback to GitHub releases for official Docker Compose binary
# Downloaded from official Docker GitHub repository over HTTPS
curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-$(uname -m) -o /usr/local/bin/docker-compose curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose
ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose 2>/dev/null || true ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose 2>/dev/null || true
@ -194,19 +197,24 @@ echo "--------------------------------------------------------------------------
echo "Installing HBMonv2 configuration....." echo "Installing HBMonv2 configuration....."
echo "------------------------------------------------------------------------------" echo "------------------------------------------------------------------------------"
sleep 2 sleep 2
# Handle pip installation for different Debian versions
if [ $VERSION -ge 12 ]; then # Helper function to install pip packages with Debian 12+ compatibility
# For Debian 12+, use --break-system-packages flag or virtual environment pip_install() {
echo "Detected Debian 12+, using appropriate pip installation method..." local args="$@"
pip3 install --break-system-packages setuptools wheel 2>/dev/null || pip3 install setuptools wheel if [ $VERSION -ge 12 ]; then
pip3 install --break-system-packages -r requirements.txt 2>/dev/null || pip3 install -r requirements.txt # For Debian 12+, try with --break-system-packages flag first
pip3 install --break-system-packages attrs --force 2>/dev/null || pip3 install attrs --force pip3 install --break-system-packages $args 2>/dev/null || pip3 install $args
else else
# For Debian 10-11, use standard pip installation # For Debian 10-11, use standard pip installation
pip3 install setuptools wheel pip3 install $args
pip3 install -r requirements.txt fi
pip3 install attrs --force }
fi
echo "Installing Python dependencies..."
pip_install setuptools wheel
pip_install -r requirements.txt
pip_install attrs --force
echo Install /opt/HBMonv2/config.py ... echo Install /opt/HBMonv2/config.py ...
cat << EOF > /opt/HBMonv2/config.py cat << EOF > /opt/HBMonv2/config.py
CONFIG_INC = True # Include HBlink stats CONFIG_INC = True # Include HBlink stats

View File

@ -19,7 +19,7 @@
# Main MENU system..... # Main MENU system.....
while : ; do while : ; do
menuopt=$(whiptail --title "HBlink3 Control Version 1.9PL" --menu "Select option by using the up and down arrows on your keyboard. Once selected please press enter:" 23 56 14 \ menuopt=$(whiptail --title "HBlink3 Control Version 1.9PL" --menu "Select option by using the up and down arrows on your keyboard. Once selected please press enter:" 24 56 14 \
1 " Stop HBlink " \ 1 " Stop HBlink " \
2 " Start HBlink " \ 2 " Start HBlink " \
3 " Restart HBlink " \ 3 " Restart HBlink " \

View File

@ -4,7 +4,7 @@
# This script written by Shane Daley M0VUB. # This script written by Shane Daley M0VUB.
# This script gracefully removes HBlink3 installation and all related components. # This script gracefully removes HBlink3 installation and all related components.
# Copyright (C) 2024 Shane P, Daley M0VUB <support@gb7nr.co.uk> # Copyright (C) 2024 Shane P. Daley M0VUB <support@gb7nr.co.uk>
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by