Skip to content

Commit

Permalink
V1.18.18
Browse files Browse the repository at this point in the history
  • Loading branch information
jgyates committed Oct 12, 2023
1 parent 734815e commit e3e61c4
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 42 deletions.
3 changes: 3 additions & 0 deletions OtherApps/serialconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ def GetErrorInfo():
HelpStr += "\n -r Restore modified files"
HelpStr += "\n -c Check status of serial port"
HelpStr += "\n -b Leave Bluetooth enabled (Pi 3 and 4 only)"
HelpStr += "\n -d Disable Bluetooth (may be needed on some pi models), default"
HelpStr += "\n \n"

try:
Expand All @@ -321,6 +322,8 @@ def GetErrorInfo():
Check = True
elif opt in ("-b", "--bluetooth"):
Bluetooth = True
elif opt in ("-d", "--disablebluetooth"):
Bluetooth = False

if Check and Enable or Check and Restore or Enable and Restore:
print("\nOnly one option can be selected.")
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ All notable changes to this project will be documented in this file.
- Added more bounds checking to gentemp.py
- Corrected issue with Settings page not allows Even parity to be set on custom controllers
- Corrected security issue related to ldap login with genserv.py
- Updates to install script and genloader for Debian bookworm. Install overrides managed system package flag.

## V1.18.17 -2023-04-06
- Added feature request to allow external temperature sensors to be displayed as gauges
Expand Down
13 changes: 13 additions & 0 deletions genloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,13 @@ def CheckBaseSoftware(self):
if not self.ExecuteCommandList(command_list):
self.InstallBaseSoftware()

"--break-system-packages"
# /usr/lib/python3.11/EXTERNALLY-MANAGED
managedfile = f"/usr/lib/python{sys.version_info.major:d}.{sys.version_info.minor:d}/EXTERNALLY-MANAGED"
if os.path.isfile(managedfile):
self.OverrideManagedPackages = True
else:
self.OverrideManagedPackages = False
self.PipChecked = True
return True
except Exception as e1:
Expand Down Expand Up @@ -518,6 +525,12 @@ def InstallLibrary(self, libraryname, update=False, version=None, uninstall=Fals
else:
install_list = [self.pipProgram, "install", libraryname]

if self.OverrideManagedPackages:
# starting with bookworm the raspberry pi os has managed system
# packages enabled so we will override that to install genmon
# requirements
install_list.append("--break-system-packages")

process = Popen(install_list, stdout=PIPE, stderr=PIPE)
output, _error = process.communicate()

Expand Down
99 changes: 57 additions & 42 deletions genmonmaint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Continue? (y/n) "

usepython3=true
pipcommand="pip3"
pipoptions=""
pythoncommand="python3"
OPTIND=1 # Reset in case getopts has been used previously in the shell.
config_path="/etc/genmon/"
Expand All @@ -30,6 +31,20 @@ cleanpython_opt=false
copyfiles_opt=false
update_os=false

#-------------------------------------------------------------------------------
function removemanagedpip() {

# /usr/lib/python3.11/EXTERNALLY-MANAGED
pythonmajor=$($pythoncommand -c 'import sys; print(sys.version_info.major)')
pythonminor=$($pythoncommand -c 'import sys; print(sys.version_info.minor)')
managedfile="/usr/lib/python$pythonmajor.$pythonminor/EXTERNALLY-MANAGED"

if [ -f $managedfile ]; then
pipoptions="--break-system-packages"
echo "Overriding system managed package system.."
fi
}

#-------------------------------------------------------------------------------
function cleanpython() {

Expand Down Expand Up @@ -72,32 +87,32 @@ function copyconffiles() {
function updatelibraries() {

echo "Updating libraries...."
sudo $pipcommand install crcmod -U
sudo $pipcommand install configparser -U
sudo $pipcommand install pyserial -U
sudo $pipcommand install Flask -U
sudo $pipcommand install crcmod -U $pipoptions
sudo $pipcommand install configparser -U $pipoptions
sudo $pipcommand install pyserial -U $pipoptions
sudo $pipcommand install Flask -U $pipoptions
if [ "$usepython3" = true ] ; then
sudo $pipcommand install pyowm==2.10.0 -U
sudo $pipcommand install pyowm==2.10.0 -U $pipoptions
else
sudo $pipcommand install pyowm==2.9.0 -U
sudo $pipcommand install pyowm==2.9.0 -U $pipoptions
fi
sudo $pipcommand install pytz -U
sudo $pipcommand install pyopenssl -U
sudo $pipcommand install twilio -U
sudo $pipcommand install chump -U
sudo $pipcommand install paho-mqtt -U
sudo $pipcommand install pysnmp -U
sudo $pipcommand install ldap3 -U
sudo $pipcommand install pyasn1==0.4.8 -U
sudo $pipcommand install smbus -U
sudo $pipcommand install psutil -U
sudo $pipcommand install pytz -U $pipoptions
sudo $pipcommand install pyopenssl -U $pipoptions
sudo $pipcommand install twilio -U $pipoptions
sudo $pipcommand install chump -U $pipoptions
sudo $pipcommand install paho-mqtt -U $pipoptions
sudo $pipcommand install pysnmp -U $pipoptions
sudo $pipcommand install ldap3 -U $pipoptions
sudo $pipcommand install pyasn1==0.4.8 -U $pipoptions
sudo $pipcommand install smbus -U $pipoptions
sudo $pipcommand install psutil -U $pipoptions
if [ "$usepython3" = true ] ; then
sudo $pipcommand install pyotp -U
sudo $pipcommand install pyotp -U $pipoptions
else
sudo $pipcommand install pyotp==2.3.0 -U
sudo $pipcommand install pyotp==2.3.0 -U $pipoptions
fi
sudo $pipcommand install mopeka_pro_check -U
sudo $pipcommand install fluids -U
sudo $pipcommand install mopeka_pro_check -U $pipoptions
sudo $pipcommand install fluids -U $pipoptions
echo "Done."
}

Expand Down Expand Up @@ -136,40 +151,40 @@ function installgenmon() {
else
sudo apt-get -yqq install python-pip
fi
sudo $pipcommand install crcmod
sudo $pipcommand install configparser
sudo $pipcommand install pyserial
sudo $pipcommand install Flask
sudo $pipcommand install crcmod $pipoptions
sudo $pipcommand install configparser $pipoptions
sudo $pipcommand install pyserial $pipoptions
sudo $pipcommand install Flask $pipoptions
if [ "$usepython3" = true ] ; then
sudo $pipcommand install pyowm==2.10.0
sudo $pipcommand install pyowm==2.10.0 $pipoptions
else
sudo $pipcommand install pyowm==2.9.0
sudo $pipcommand install pyowm==2.9.0 $pipoptions
fi
sudo $pipcommand install pytz
sudo $pipcommand install pytz $pipoptions
if [ "$usepython3" = true ] ; then
sudo apt-get -yqq install build-essential libssl-dev libffi-dev python3-dev cargo
else
sudo apt-get -yqq install build-essential libssl-dev libffi-dev python-dev cargo
fi
sudo apt-get -yqq install cmake
sudo $pipcommand install pyopenssl
sudo $pipcommand install twilio
sudo $pipcommand install chump
sudo $pipcommand install paho-mqtt
sudo $pipcommand install pysnmp
sudo $pipcommand install ldap3
sudo $pipcommand install smbus
sudo $pipcommand install psutil
sudo $pipcommand install pyopenssl $pipoptions
sudo $pipcommand install twilio $pipoptions
sudo $pipcommand install chump $pipoptions
sudo $pipcommand install paho-mqtt $pipoptions
sudo $pipcommand install pysnmp $pipoptions
sudo $pipcommand install ldap3 $pipoptions
sudo $pipcommand install smbus $pipoptions
sudo $pipcommand install psutil $pipoptions
if [ "$usepython3" = true ] ; then
sudo $pipcommand install pyotp
sudo $pipcommand install pyotp $pipoptions
else
sudo $pipcommand install pyotp==2.3.0
sudo $pipcommand install pyotp==2.3.0 $pipoptions
fi
# correct problem with LDAP3 module install
sudo $pipcommand install pyasn1==0.4.8 -U
sudo $pipcommand install mopeka_pro_check
sudo $pipcommand install fluids
sudo $pipcommand install voipms
sudo $pipcommand install pyasn1==0.4.8 -U $pipoptions
sudo $pipcommand install mopeka_pro_check $pipoptions
sudo $pipcommand install fluids $pipoptions
sudo $pipcommand install voipms $pipoptions

sudo chmod 775 "$genmondir/startgenmon.sh"
sudo chmod 775 "$genmondir/genmonmaint.sh"
Expand Down Expand Up @@ -430,7 +445,7 @@ shift $((OPTIND -1))
if [ "$update_os" = true ] ; then
sudo apt-get --allow-releaseinfo-change update && sudo apt-get upgrade
fi

removemanagedpip
if [ "$install_opt" = true ] ; then
if [ "$noprompt_opt" = true ] ; then
installgenmon "noprompt"
Expand Down

0 comments on commit e3e61c4

Please sign in to comment.