updated version
This commit is contained in:
1 parent
afc23cdcac
commit
b6cc8e8030
1 file changed
+15
-3
+15
-3
@@ -8,6 +8,7 @@ argon_create_file() {
|
||||
sudo touch $1
|
||||
sudo chmod 666 $1
|
||||
}
|
||||
|
||||
argon_check_pkg() {
|
||||
RESULT=$(dpkg-query -W -f='${Status}\n' "$1" 2> /dev/null | grep "installed")
|
||||
|
||||
@@ -26,6 +27,10 @@ then
|
||||
if [ "$ID" = "raspbian" ]
|
||||
then
|
||||
CHECKPLATFORM="Raspbian"
|
||||
elif [ "$ID" = "debian" ]
|
||||
then
|
||||
# For backwards compatibility, continue using raspbian
|
||||
CHECKPLATFORM="Raspbian"
|
||||
elif [ "$ID" = "ubuntu" ]
|
||||
then
|
||||
CHECKPLATFORM="Ubuntu"
|
||||
@@ -61,7 +66,6 @@ if [ $? -eq 0 ]
|
||||
then
|
||||
# Enable i2c and serial
|
||||
sudo raspi-config nonint do_i2c 0
|
||||
sudo raspi-config nonint do_serial 2
|
||||
fi
|
||||
|
||||
# Helper variables
|
||||
@@ -72,6 +76,8 @@ daemonconfigfile=/etc/$daemonname.conf
|
||||
configscript=/usr/bin/argonone-config
|
||||
removescript=/usr/bin/argonone-uninstall
|
||||
|
||||
|
||||
|
||||
daemonfanservice=/lib/systemd/system/$daemonname.service
|
||||
|
||||
if [ ! -f $daemonconfigfile ]; then
|
||||
@@ -108,6 +114,7 @@ argon_create_file $shutdownscript
|
||||
|
||||
echo "#!/usr/bin/python3" >> $shutdownscript
|
||||
echo 'import sys' >> $shutdownscript
|
||||
echo 'import time' >> $shutdownscript
|
||||
echo 'import smbus' >> $shutdownscript
|
||||
echo 'import RPi.GPIO as GPIO' >> $shutdownscript
|
||||
echo 'rev = GPIO.RPI_REVISION' >> $shutdownscript
|
||||
@@ -117,7 +124,10 @@ echo 'else:' >> $shutdownscript
|
||||
echo ' bus = smbus.SMBus(0)' >> $shutdownscript
|
||||
|
||||
echo 'if len(sys.argv)>1:' >> $shutdownscript
|
||||
echo " bus.write_byte(0x1a,0)" >> $shutdownscript
|
||||
echo ' address=0x1a' >> $shutdownscript
|
||||
|
||||
# Fan off
|
||||
echo " bus.write_byte(address,0)" >> $shutdownscript
|
||||
|
||||
|
||||
sudo chmod 755 $shutdownscript
|
||||
@@ -139,6 +149,7 @@ echo 'else:' >> $powerbuttonscript
|
||||
echo ' bus = smbus.SMBus(0)' >> $powerbuttonscript
|
||||
|
||||
|
||||
|
||||
echo 'def get_fanspeed(tempval, configlist):' >> $powerbuttonscript
|
||||
echo ' for curconfig in configlist:' >> $powerbuttonscript
|
||||
echo ' curpair = curconfig.split("=")' >> $powerbuttonscript
|
||||
@@ -189,11 +200,12 @@ echo ' return []' >> $powerbuttonscript
|
||||
echo ' return newconfig' >> $powerbuttonscript
|
||||
|
||||
echo 'def temp_check():' >> $powerbuttonscript
|
||||
echo ' address=0x1a' >> $powerbuttonscript
|
||||
|
||||
echo ' fanconfig = ["65=100", "60=55", "55=10"]' >> $powerbuttonscript
|
||||
echo ' tmpconfig = load_config("'$daemonconfigfile'")' >> $powerbuttonscript
|
||||
echo ' if len(tmpconfig) > 0:' >> $powerbuttonscript
|
||||
echo ' fanconfig = tmpconfig' >> $powerbuttonscript
|
||||
echo ' address=0x1a' >> $powerbuttonscript
|
||||
echo ' prevblock=0' >> $powerbuttonscript
|
||||
echo ' while True:' >> $powerbuttonscript
|
||||
|
||||
|
||||
Reference in new issue
Block a user