forked from LHardwick-git/Victron-Service
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsetup
More file actions
executable file
·86 lines (63 loc) · 2.63 KB
/
setup
File metadata and controls
executable file
·86 lines (63 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
#### add the following lines to the package's setup script
#### following line incorporates helper resources into this script
source "/data/SetupHelper/HelperResources/IncludeHelpers"
#### end of lines to include helper resources
# install TemperatureService for Victron Venus OS on Raspberry Pi
overlayFile="/u-boot/overlays/w1-gpio.dtbo"
configFile="/u-boot/config.txt"
packageLogFile="/var/log/VenusOS-TemperatureService/current"
#### running manually and OK to proceed - prompt for input
if [ $scriptAction == 'NONE' ] ; then
# display innitial message
echo
echo "This package brings the RPI's processor internal temperature to the GUI and VRM"
standardActionPrompt
fi
#### install code goes here
if [ $scriptAction == 'INSTALL' ] ; then
logMessage "++ Installing VenusOS Temperature Service"
installService $packageName
# install DT overlay to for 1-Wire
updateActiveFile "$overlayFile"
if [ $(grep -c "w1-gpio" "$configFile") == 0 ]; then
logMessage "activating 1-Wire overlay"
echo "#### Change 1-Wire Temperatursensor GPIO" >> "$configFile"
echo "dtoverlay=w1-gpio,gpiopin=26" >> "$configFile"
echo "#### end change 1-Wire GPIO" >> "$configFile"
filesUpdated=true
fi
fi
#### uninstalling - check scriptAction again
# if an install step failed package needs to be removed
if [ $scriptAction == 'UNINSTALL' ] ; then
logMessage "++ Uninstalling VenusOS Temperature Service"
removeService $packageName
restoreActiveFile "$overlayFile"
# remove mods from configFile - do not use restore in case other mods were made manually
if [ -f "$configFile" ]; then
if [ $(grep -c "#### Change 1-Wire Temperatursensor GPIO" "$configFile") != 0 ]; then
sed -i -e '/#### Change 1-Wire Temperatursensor GPIO/,/#### end change 1-Wire GPIO/d' "$configFile"
filesUpdated=true
fi
fi
# remove for older Verison
if [ -f "$configFile" ]; then
if [ $(grep -c "#### Change 1-Wire Temperatursensor on Pin4" "$configFile") != 0 ]; then
sed -i -e '/#### Change 1-Wire Temperatursensor on Pin4/,/#### end change 1-Wire Pin4/d' "$configFile"
filesUpdated=true
fi
fi
# remove for older Verison
if [ -f "$configFile" ]; then
if [ $(grep -c "#### Change 1-Wire Temperatursensor on Pin26" "$configFile") != 0 ]; then
sed -i -e '/#### Change 1-Wire Temperatursensor on Pin26/,/#### end change 1-Wire Pin26/d' "$configFile"
filesUpdated=true
fi
fi
fi
if $filesUpdated ; then
rebootNeeded=true
fi
# thats all folks - SCRIPT EXITS INSIDE THE FUNCTION
endScript