Automated Change by GitHub Action

This commit is contained in:
okunze 2025-01-17 21:06:30 +00:00 committed by github-actions[bot]
parent 7ff78230e2
commit 0e06c1d56e

View File

@ -25,7 +25,7 @@ argon_time_error() {
echo "**********************************************" echo "**********************************************"
echo "Possible Network Time Protocol Server issue" echo "Possible Network Time Protocol Server issue"
echo "Try running the following to correct:" echo "Try running the following to correct:"
echo " curl -k https://download.argon40.com/tools/setntpserver.sh | bash" echo " curl -k http://files.iamnet.com.ph/argon/setup/tools/setntpserver.sh | bash"
} }
if [ $NEEDSTIMESYNC -eq 1 ] if [ $NEEDSTIMESYNC -eq 1 ]
@ -35,7 +35,7 @@ fi
# Helper variables # Helper variables
ARGONDOWNLOADSERVER=https://download.argon40.com ARGONDOWNLOADSERVER=http://files.iamnet.com.ph/argon/setup
INSTALLATIONFOLDER=/etc/argon INSTALLATIONFOLDER=/etc/argon
@ -71,7 +71,6 @@ else
FIRMWARE= FIRMWARE=
fi fi
CONFIG=/boot${FIRMWARE}/config.txt CONFIG=/boot${FIRMWARE}/config.txt
TMPCONFIG=/dev/shm/argontmp.bak
set_config_var() { set_config_var() {
if ! grep -q -E "$1=$2" $3 ; then if ! grep -q -E "$1=$2" $3 ; then
@ -135,7 +134,8 @@ set_nvme_default() {
} }
set_maxusbcurrent() { set_maxusbcurrent() {
if is_pifive ; then if is_pifive ; then
set_config_var max_usb_current 1 $CONFIG #set_config_var max_usb_current 1 $CONFIG
set_config_var usb_max_current_enable 1 $CONFIG
fi fi
} }
@ -208,6 +208,9 @@ then
if [ "$CHECKDEVICE" = "eon" ] if [ "$CHECKDEVICE" = "eon" ]
then then
pkglist=($gpiopkg python3-smbus i2c-tools smartmontools) pkglist=($gpiopkg python3-smbus i2c-tools smartmontools)
elif [ "$CHECKDEVICE" = "oneoled" ]
then
pkglist=($gpiopkg python3-smbus i2c-tools python3-luma.oled python3-pil python3-pyqt5)
else else
pkglist=($gpiopkg python3-smbus i2c-tools) pkglist=($gpiopkg python3-smbus i2c-tools)
fi fi
@ -217,11 +220,19 @@ else
if [ "$CHECKDEVICE" = "eon" ] if [ "$CHECKDEVICE" = "eon" ]
then then
pkglist=($gpiopkg python3-smbus i2c-tools smartmontools) pkglist=($gpiopkg python3-smbus i2c-tools smartmontools)
elif [ "$CHECKDEVICE" = "oneoled" ]
then
pkglist=($gpiopkg python3-smbus i2c-tools python3-luma.oled python3-pil python3-pyqt5)
else else
pkglist=($gpiopkg python3-smbus i2c-tools) pkglist=($gpiopkg python3-smbus i2c-tools)
fi fi
fi fi
echo "********************************************************************"
echo "INSTALLER: Add/update packages"
echo "********************************************************************"
for curpkg in ${pkglist[@]}; do for curpkg in ${pkglist[@]}; do
sudo apt-get install -y $curpkg sudo apt-get install -y $curpkg
RESULT=$(argon_check_pkg "$curpkg") RESULT=$(argon_check_pkg "$curpkg")
@ -234,6 +245,11 @@ for curpkg in ${pkglist[@]}; do
fi fi
done done
echo "********************************************************************"
echo "INSTALLER: I2C and Serial config"
echo "********************************************************************"
# Ubuntu Mate for RPi has raspi-config too # Ubuntu Mate for RPi has raspi-config too
command -v raspi-config &> /dev/null command -v raspi-config &> /dev/null
if [ $? -eq 0 ] if [ $? -eq 0 ]
@ -255,6 +271,22 @@ then
fi fi
fi fi
echo "********************************************************************"
echo "INSTALLER: dtoverlay=dwc2,dr_mode"
echo "********************************************************************"
if [ "$CHECKDEVICE" = "oneoled" ]
then
set_config_var dtoverlay=dwc2,dr_mode host $CONFIG
fi
echo "********************************************************************"
echo "INSTALLER: NVMe for pi5"
echo "********************************************************************"
# Added to enabled NVMe for pi5 # Added to enabled NVMe for pi5
set_nvme_default set_nvme_default
@ -262,6 +294,7 @@ set_nvme_default
basename="argonone" basename="argonone"
daemonname=$basename"d" daemonname=$basename"d"
irconfigscript=$INSTALLATIONFOLDER/${basename}-ir irconfigscript=$INSTALLATIONFOLDER/${basename}-ir
upsconfigscript=$INSTALLATIONFOLDER/${basename}-upsconfig.sh
fanconfigscript=$INSTALLATIONFOLDER/${basename}-fanconfig.sh fanconfigscript=$INSTALLATIONFOLDER/${basename}-fanconfig.sh
eepromrpiscript="/usr/bin/rpi-eeprom-config" eepromrpiscript="/usr/bin/rpi-eeprom-config"
eepromconfigscript=$INSTALLATIONFOLDER/${basename}-eepromconfig.py eepromconfigscript=$INSTALLATIONFOLDER/${basename}-eepromconfig.py
@ -273,6 +306,11 @@ daemonfanservice=/lib/systemd/system/$daemonname.service
daemonhddconfigfile=/etc/${daemonname}-hdd.conf daemonhddconfigfile=/etc/${daemonname}-hdd.conf
echo "********************************************************************"
echo "INSTALLER: Downloading files for: $CHECKDEVICE"
echo "********************************************************************"
if [ -f "$eepromrpiscript" ] if [ -f "$eepromrpiscript" ]
then then
# EEPROM Config Script # EEPROM Config Script
@ -280,6 +318,13 @@ then
sudo chmod 755 $eepromconfigscript sudo chmod 755 $eepromconfigscript
fi fi
if is_pifive
then
# UPS Config Script
sudo wget $ARGONDOWNLOADSERVER/scripts/argonone-upsconfig.sh -O $upsconfigscript --quiet
sudo chmod 755 $upsconfigscript
fi
# Fan Config Script # Fan Config Script
sudo wget $ARGONDOWNLOADSERVER/scripts/argonone-fanconfig.sh -O $fanconfigscript --quiet sudo wget $ARGONDOWNLOADSERVER/scripts/argonone-fanconfig.sh -O $fanconfigscript --quiet
sudo chmod 755 $fanconfigscript sudo chmod 755 $fanconfigscript
@ -287,7 +332,12 @@ sudo chmod 755 $fanconfigscript
# Fan Daemon/Service Files # Fan Daemon/Service Files
sudo wget $ARGONDOWNLOADSERVER/scripts/argononed.py -O $powerbuttonscript --quiet sudo wget $ARGONDOWNLOADSERVER/scripts/argononed.py -O $powerbuttonscript --quiet
sudo wget $ARGONDOWNLOADSERVER/scripts/argononed.service -O $daemonfanservice --quiet if [ "$CHECKDEVICE" = "oneoled" ]
then
sudo wget $ARGONDOWNLOADSERVER/scripts/argononeoledd.service -O $daemonfanservice --quiet
else
sudo wget $ARGONDOWNLOADSERVER/scripts/argononed.service -O $daemonfanservice --quiet
fi
sudo chmod 644 $daemonfanservice sudo chmod 644 $daemonfanservice
if [ ! "$CHECKDEVICE" = "fanhat" ] if [ ! "$CHECKDEVICE" = "fanhat" ]
@ -329,6 +379,10 @@ sudo wget $ARGONDOWNLOADSERVER/scripts/argon-unitconfig.sh -O $unitconfigscript
sudo chmod 755 $unitconfigscript sudo chmod 755 $unitconfigscript
echo "********************************************************************"
echo "INSTALLER: Create default settings if none"
echo "********************************************************************"
# Generate default Fan config file if non-existent # Generate default Fan config file if non-existent
if [ ! -f $daemonconfigfile ]; then if [ ! -f $daemonconfigfile ]; then
sudo touch $daemonconfigfile sudo touch $daemonconfigfile
@ -377,10 +431,6 @@ then
daemonrtcservice=/lib/systemd/system/$daemonname.service daemonrtcservice=/lib/systemd/system/$daemonname.service
rtcdaemonscript=$INSTALLATIONFOLDER/$daemonname.py rtcdaemonscript=$INSTALLATIONFOLDER/$daemonname.py
oledconfigscript=$INSTALLATIONFOLDER/${basename}-oledconfig.sh
oledlibscript=$INSTALLATIONFOLDER/${basename}oled.py
oledconfigfile=/etc/argoneonoled.conf
# Generate default RTC config file if non-existent # Generate default RTC config file if non-existent
if [ ! -f $rtcconfigfile ]; then if [ ! -f $rtcconfigfile ]; then
sudo touch $rtcconfigfile sudo touch $rtcconfigfile
@ -390,6 +440,34 @@ then
echo '# Argon RTC Configuration' >> $rtcconfigfile echo '# Argon RTC Configuration' >> $rtcconfigfile
echo '#' >> $rtcconfigfile echo '#' >> $rtcconfigfile
fi fi
# RTC Config Script
sudo wget $ARGONDOWNLOADSERVER/scripts/argoneon-rtcconfig.sh -O $rtcconfigscript --quiet
sudo chmod 755 $rtcconfigscript
# RTC Daemon/Service Files
sudo wget $ARGONDOWNLOADSERVER/scripts/argonrtc.py -O $INSTALLATIONFOLDER/argonrtc.py --quiet
sudo wget $ARGONDOWNLOADSERVER/scripts/argoneond.py -O $rtcdaemonscript --quiet
sudo wget $ARGONDOWNLOADSERVER/scripts/argoneond.service -O $daemonrtcservice --quiet
sudo chmod 644 $daemonrtcservice
fi
if [ "$CHECKDEVICE" = "eon" ] || [ "$CHECKDEVICE" = "oneoled" ]
then
echo "********************************************************************"
echo "INSTALLER: OLED Files"
echo "********************************************************************"
# OLED Setup
basename="argoneon"
daemonname=$basename"d"
oledconfigscript=$INSTALLATIONFOLDER/${basename}-oledconfig.sh
oledlibscript=$INSTALLATIONFOLDER/${basename}oled.py
oledconfigfile=/etc/argoneonoled.conf
# Generate default OLED config file if non-existent # Generate default OLED config file if non-existent
if [ ! -f $oledconfigfile ]; then if [ ! -f $oledconfigfile ]; then
sudo touch $oledconfigfile sudo touch $oledconfigfile
@ -399,25 +477,25 @@ then
echo '# Argon OLED Configuration' >> $oledconfigfile echo '# Argon OLED Configuration' >> $oledconfigfile
echo '#' >> $oledconfigfile echo '#' >> $oledconfigfile
echo 'switchduration=30' >> $oledconfigfile echo 'switchduration=30' >> $oledconfigfile
if [ "$CHECKDEVICE" = "eon" ]
then
echo 'screenlist="clock cpu storage raid ram temp ip"' >> $oledconfigfile echo 'screenlist="clock cpu storage raid ram temp ip"' >> $oledconfigfile
else
echo 'screenlist="clock cpu storage ram temp ip"' >> $oledconfigfile
fi
fi fi
# RTC Config Script
sudo wget $ARGONDOWNLOADSERVER/scripts/argoneon-rtcconfig.sh -O $rtcconfigscript --quiet
sudo chmod 755 $rtcconfigscript
# RTC Daemon/Service Files
sudo wget $ARGONDOWNLOADSERVER/scripts/argoneond.py -O $rtcdaemonscript --quiet
sudo wget $ARGONDOWNLOADSERVER/scripts/argoneond.service -O $daemonrtcservice --quiet
sudo wget $ARGONDOWNLOADSERVER/scripts/argoneonoled.py -O $oledlibscript --quiet
sudo chmod 644 $daemonrtcservice
# OLED Config Script # OLED Config Script
if [ "$CHECKDEVICE" = "eon" ]
then
sudo wget $ARGONDOWNLOADSERVER/scripts/argoneonoled.py -O $oledlibscript --quiet
sudo wget $ARGONDOWNLOADSERVER/scripts/argoneon-oledconfig.sh -O $oledconfigscript --quiet sudo wget $ARGONDOWNLOADSERVER/scripts/argoneon-oledconfig.sh -O $oledconfigscript --quiet
else
sudo wget $ARGONDOWNLOADSERVER/scripts/argononeoled.py -O $oledlibscript --quiet
sudo wget $ARGONDOWNLOADSERVER/scripts/argonone-oledconfig.sh -O $oledconfigscript --quiet
fi
sudo chmod 755 $oledconfigscript sudo chmod 755 $oledconfigscript
if [ ! -d $INSTALLATIONFOLDER/oled ] if [ ! -d $INSTALLATIONFOLDER/oled ]
then then
sudo mkdir $INSTALLATIONFOLDER/oled sudo mkdir $INSTALLATIONFOLDER/oled
@ -447,6 +525,12 @@ sudo touch $configscript
# To ensure we can write the following lines # To ensure we can write the following lines
sudo chmod 666 $configscript sudo chmod 666 $configscript
echo "********************************************************************"
echo "INSTALLER: Creating argon-config script"
echo "********************************************************************"
echo '#!/bin/bash' >> $configscript echo '#!/bin/bash' >> $configscript
echo 'echo "--------------------------"' >> $configscript echo 'echo "--------------------------"' >> $configscript
@ -484,7 +568,10 @@ echo 'while [ $mainloopflag -eq 1 ]' >> $configscript
echo 'do' >> $configscript echo 'do' >> $configscript
echo ' echo' >> $configscript echo ' echo' >> $configscript
echo ' echo "Choose Option:"' >> $configscript echo ' echo "Choose Option:"' >> $configscript
echo ' echo " 1. Configure Fan"' >> $configscript if [ ! "$CHECKDEVICE" = "oneoled" ]
then
echo ' echo " 1. Configure Fan"' >> $configscript
fi
blstrdacoption=0 blstrdacoption=0
@ -492,13 +579,27 @@ if [ "$CHECKDEVICE" = "fanhat" ]
then then
uninstalloption="4" uninstalloption="4"
else else
if [ ! "$CHECKDEVICE" = "oneoled" ]
then
echo ' echo " 2. Configure IR"' >> $configscript echo ' echo " 2. Configure IR"' >> $configscript
fi
if [ "$CHECKDEVICE" = "eon" ] if [ "$CHECKDEVICE" = "eon" ]
then then
# ArgonEON Has RTC # ArgonEON Has RTC
echo ' echo " 3. Configure RTC and/or Schedule"' >> $configscript echo ' echo " 3. Configure RTC and/or Schedule"' >> $configscript
echo ' echo " 4. Configure OLED"' >> $configscript echo ' echo " 4. Configure OLED"' >> $configscript
uninstalloption="7" uninstalloption="7"
elif [ "$CHECKDEVICE" = "oneoled" ]
then
echo ' echo " 1. Configure OLED"' >> $configscript
echo ' echo " 2. Argon Industria UPS"' >> $configscript
uninstalloption="5"
elif is_pifive
then
echo ' echo " 3. Argon Industria UPS"' >> $configscript
uninstalloption="7"
blstrdacoption=$(($uninstalloption-3))
echo " echo \" $blstrdacoption. Configure BLSTR DAC (v3/v5 only)\"" >> $configscript
else else
uninstalloption="6" uninstalloption="6"
blstrdacoption=$(($uninstalloption-3)) blstrdacoption=$(($uninstalloption-3))
@ -525,6 +626,7 @@ echo ' mainloopflag=0' >> $configscript
echo ' elif [ $newmode -eq 1 ]' >> $configscript echo ' elif [ $newmode -eq 1 ]' >> $configscript
echo ' then' >> $configscript echo ' then' >> $configscript
# Option 1
if [ "$CHECKDEVICE" = "eon" ] if [ "$CHECKDEVICE" = "eon" ]
then then
echo ' echo "Choose Triggers:"' >> $configscript echo ' echo "Choose Triggers:"' >> $configscript
@ -544,14 +646,26 @@ then
echo " $fanconfigscript hdd" >> $configscript echo " $fanconfigscript hdd" >> $configscript
echo ' mainloopflag=0' >> $configscript echo ' mainloopflag=0' >> $configscript
echo ' fi' >> $configscript echo ' fi' >> $configscript
elif [ "$CHECKDEVICE" = "oneoled" ]
then
echo " $oledconfigscript" >> $configscript
echo ' mainloopflag=0' >> $configscript
else else
echo " $fanconfigscript" >> $configscript echo " $fanconfigscript" >> $configscript
echo ' mainloopflag=0' >> $configscript echo ' mainloopflag=0' >> $configscript
fi fi
# Options 2 onwards
if [ ! "$CHECKDEVICE" = "fanhat" ] if [ ! "$CHECKDEVICE" = "fanhat" ]
then then
if [ "$CHECKDEVICE" = "oneoled" ]
then
echo ' elif [ $newmode -eq 2 ]' >> $configscript
echo ' then' >> $configscript
echo " $upsconfigscript" >> $configscript
echo ' mainloopflag=0' >> $configscript
else
echo ' elif [ $newmode -eq 2 ]' >> $configscript echo ' elif [ $newmode -eq 2 ]' >> $configscript
echo ' then' >> $configscript echo ' then' >> $configscript
echo " $irconfigscript" >> $configscript echo " $irconfigscript" >> $configscript
@ -567,6 +681,12 @@ then
echo ' then' >> $configscript echo ' then' >> $configscript
echo " $oledconfigscript" >> $configscript echo " $oledconfigscript" >> $configscript
echo ' mainloopflag=0' >> $configscript echo ' mainloopflag=0' >> $configscript
elif is_pifive
then
echo ' elif [ $newmode -eq 3 ]' >> $configscript
echo ' then' >> $configscript
echo " $upsconfigscript" >> $configscript
echo ' mainloopflag=0' >> $configscript
fi fi
if [ $blstrdacoption -gt 0 ] if [ $blstrdacoption -gt 0 ]
@ -576,8 +696,10 @@ then
echo " $blstrdacconfigscript" >> $configscript echo " $blstrdacconfigscript" >> $configscript
echo ' mainloopflag=0' >> $configscript echo ' mainloopflag=0' >> $configscript
fi fi
fi
fi fi
# Standard options
echo " elif [ \$newmode -eq $unitsoption ]" >> $configscript echo " elif [ \$newmode -eq $unitsoption ]" >> $configscript
echo ' then' >> $configscript echo ' then' >> $configscript
echo " $unitconfigscript" >> $configscript echo " $unitconfigscript" >> $configscript
@ -596,14 +718,29 @@ echo 'done' >> $configscript
sudo chmod 755 $configscript sudo chmod 755 $configscript
echo "********************************************************************"
echo "INSTALLER: Desktop shortcut"
echo "********************************************************************"
# Desktop Icon # Desktop Icon
shortcutfile="/home/pi/Desktop/argonone-config.desktop" destfoldername=$USERNAME
if [ "$CHECKPLATFORM" = "Raspbian" ] && [ -d "/home/pi/Desktop" ] if [ -z "$destfoldername" ]
then then
terminalcmd="lxterminal --working-directory=/home/pi/ -t" destfoldername=$USER
if [ -f "/home/pi/.twisteros.twid" ] fi
if [ -z "$destfoldername" ]
then
destfoldername="pi"
fi
shortcutfile="/home/$destfoldername/Desktop/argonone-config.desktop"
if [ "$CHECKPLATFORM" = "Raspbian" ] && [ -d "/home/$destfoldername/Desktop" ]
then
terminalcmd="lxterminal --working-directory=/home/$destfoldername/ -t"
if [ -f "/home/$destfoldername/.twisteros.twid" ]
then then
terminalcmd="xfce4-terminal --default-working-directory=/home/pi/ -T" terminalcmd="xfce4-terminal --default-working-directory=/home/$destfoldername/ -T"
fi fi
imagefile=ar1config.png imagefile=ar1config.png
if [ "$CHECKDEVICE" = "eon" ] if [ "$CHECKDEVICE" = "eon" ]
@ -630,6 +767,11 @@ fi
configcmd="$(basename -- $configscript)" configcmd="$(basename -- $configscript)"
echo "********************************************************************"
echo "INSTALLER: Start/restart services/daemon"
echo "********************************************************************"
if [ "$setupmode" = "Setup" ] if [ "$setupmode" = "Setup" ]
then then
if [ -f "/usr/bin/$configcmd" ] if [ -f "/usr/bin/$configcmd" ]
@ -638,7 +780,7 @@ then
fi fi
sudo ln -s $configscript /usr/bin/$configcmd sudo ln -s $configscript /usr/bin/$configcmd
if [ "$CHECKDEVICE" = "one" ] if [ "$CHECKDEVICE" = "one" ] || [ "$CHECKDEVICE" = "oneoled" ]
then then
sudo ln -s $configscript /usr/bin/argonone-config sudo ln -s $configscript /usr/bin/argonone-config
sudo ln -s $uninstallscript /usr/bin/argonone-uninstall sudo ln -s $uninstallscript /usr/bin/argonone-uninstall
@ -667,6 +809,10 @@ else
fi fi
fi fi
echo "********************************************************************"
echo "INSTALLER: EEPROM Check/updates"
echo "********************************************************************"
if [ "$CHECKPLATFORM" = "Raspbian" ] if [ "$CHECKPLATFORM" = "Raspbian" ]
then then
if [ -f "$eepromrpiscript" ] if [ -f "$eepromrpiscript" ]