updated version

This commit is contained in:
2023-07-06 09:21:07 +02:00
parent 927b2383e0
commit dd1ff27056
+4 -25
View File
@@ -36,7 +36,7 @@ fi
if [ "$CHECKPLATFORM" = "Raspbian" ]
then
sudo rpi-eeprom-update -a
pkglist=(raspi-gpio python3-rpi.gpio python3-smbus i2c-tools)
pkglist=(raspi-gpio python3-rpi.gpio python3-smbus i2c-tools)
else
# Todo handle lgpio
# Ubuntu has serial and i2c enabled
@@ -73,7 +73,7 @@ configscript=/usr/bin/argonone-config
removescript=/usr/bin/argonone-uninstall
daemonfanservice=/lib/systemd/system/$daemonname.service
if [ ! -f $daemonconfigfile ]; then
# Generate config file for fan speed
sudo touch $daemonconfigfile
@@ -138,23 +138,6 @@ echo ' bus = smbus.SMBus(1)' >> $powerbuttonscript
echo 'else:' >> $powerbuttonscript
echo ' bus = smbus.SMBus(0)' >> $powerbuttonscript
echo 'GPIO.setwarnings(False)' >> $powerbuttonscript
echo 'GPIO.setmode(GPIO.BCM)' >> $powerbuttonscript
echo 'shutdown_pin=4' >> $powerbuttonscript
echo 'GPIO.setup(shutdown_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)' >> $powerbuttonscript
echo 'def shutdown_check():' >> $powerbuttonscript
echo ' while True:' >> $powerbuttonscript
echo ' pulsetime = 1' >> $powerbuttonscript
echo ' GPIO.wait_for_edge(shutdown_pin, GPIO.RISING)' >> $powerbuttonscript
echo ' time.sleep(0.01)' >> $powerbuttonscript
echo ' while GPIO.input(shutdown_pin) == GPIO.HIGH:' >> $powerbuttonscript
echo ' time.sleep(0.01)' >> $powerbuttonscript
echo ' pulsetime += 1' >> $powerbuttonscript
echo ' if pulsetime >=2 and pulsetime <=3:' >> $powerbuttonscript
echo ' os.system("reboot")' >> $powerbuttonscript
echo ' elif pulsetime >=4 and pulsetime <=5:' >> $powerbuttonscript
echo ' os.system("shutdown now -h")' >> $powerbuttonscript
echo 'def get_fanspeed(tempval, configlist):' >> $powerbuttonscript
echo ' for curconfig in configlist:' >> $powerbuttonscript
@@ -236,14 +219,10 @@ echo ' temp=""' >> $powerbuttonscript
echo ' time.sleep(30)' >> $powerbuttonscript
echo 'try:' >> $powerbuttonscript
echo ' t1 = Thread(target = shutdown_check)' >> $powerbuttonscript
echo ' t2 = Thread(target = temp_check)' >> $powerbuttonscript
echo ' t1.start()' >> $powerbuttonscript
echo ' t2.start()' >> $powerbuttonscript
echo 'except:' >> $powerbuttonscript
echo ' t1.stop()' >> $powerbuttonscript
echo ' t2.stop()' >> $powerbuttonscript
echo ' GPIO.cleanup()' >> $powerbuttonscript
sudo chmod 755 $powerbuttonscript
@@ -506,7 +485,7 @@ then
echo "Terminal=false" >> $shortcutfile
echo "Categories=None;" >> $shortcutfile
chmod 755 $shortcutfile
shortcutfile="/home/pi/Desktop/argonone-uninstall.desktop"
echo "[Desktop Entry]" > $shortcutfile
echo "Name=Argon One Uninstall" >> $shortcutfile
@@ -529,7 +508,7 @@ if [ ! "$CHECKPLATFORM" = "Raspbian" ]
then
echo "You may need to reboot for changes to take effect"
echo
fi
fi
if [ -f $shortcutfile ]; then
echo Shortcuts created in your desktop.
else