-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aquacomputer-d5next-hwmon.plg
152 lines (128 loc) · 5.01 KB
/
aquacomputer-d5next-hwmon.plg
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "aquacomputer-d5next-hwmon">
<!ENTITY author "ich777">
<!ENTITY version "2023.01.06">
<!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unraid-aquacomputer-d5next/master">
<!ENTITY pluginURL "&gitURL;/&name;.plg">
<!ENTITY plugin "/boot/config/plugins/&name;">
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
<!ENTITY packages "/boot/config/plugins/&name;/packages">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="6.11.5" support="https://forums.unraid.net/topic/92865-support-ich777-amd-vendor-reset-coraltpu-hpsahba/">
<CHANGES>
###2023.01.06
- Fixed bug in correction for broken sensor readings
###2022.07.26
- Initial release
</CHANGES>
<FILE Name="&emhttp;/README.md">
<INLINE>
**Aquacomputer D5 Next hwmon**
This package contains a hwmon Linux Kernel driver for exposing sensors from various Aquacomputer devices (D5 Next, Quadro, Aquastream XT,...).
You can get more details here: https://github.com/aleksamagicka/aquacomputer_d5next-hwmon
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
download() {
# Download acd5next package
if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}" "${DL_URL}/${LAT_PACKAGE}" ; then
wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5" "${DL_URL}/${LAT_PACKAGE}.md5"
if [ "$(md5sum &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE} | awk '{print $1}')" != "$(cat &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5 | awk '{print $1}')" ]; then
echo
echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR------"
echo "--------------------------------CHECKSUM ERROR!---------------------------------"
rm -rf &plugin; &emhttp;
exit 1
fi
echo
echo "-----Successfully downloaded Aquacomputer D5Next package, please wait...!------"
else
echo
echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR-----"
echo "------------------Can't download Aquacomputer D5Next package-------------------"
rm -rf &plugin; &emhttp;
exit 1
fi
}
check() {
if ! ls -1 &packages;/${KERNEL_V%%-*}/ | grep -q "${PACKAGE}" ; then
LAT_PACKAGE="$(wget -qO- https://api.github.com/repos/ich777/unraid-aquacomputer-d5next/releases/tags/${KERNEL_V} | jq -r '.assets[].name' | grep "${PACKAGE}" | grep -E -v '\.md5$' | sort -V | tail -1)"
echo
echo "-----------Downloading Aquacomputer D5Next package, please wait...!-----------"
echo "----------This could take some time, please don't close this window!----------"
download
else
echo
echo "------------------Aquacomputer D5Next package found locally!------------------"
fi
}
install() {
# Install acd5next package
/sbin/installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz"
depmod -a
}
activate() {
# Modprobe acd5next module
/sbin/modprobe aquacomputer_d5next
}
# Define Variables
KERNEL_V="$(uname -r)"
PACKAGE="aquacomputer_d5next"
DL_URL="https://github.com/ich777/unraid-aquacomputer-d5next/releases/download/$KERNEL_V"
if [ ! -d "&packages;/${KERNEL_V%%-*}" ]; then
mkdir -p "&packages;/${KERNEL_V%%-*}"
fi
#Check for old packages
rm -rf $(ls -d &packages;/* | grep -v "${KERNEL_V%%-*}")
if [ ! -f "&plugin;/&name;.png" ]; then
wget -q -nc --show-progress --progress=bar:force:noscroll -O "&plugin;/&name;.png" "https://raw.githubusercontent.com/ich777/docker-templates/master/ich777/images/aquacomputer.png"
fi
#Check if acd5next package is already downloaded
check
# Check if acd5next package module is already installed
if ! modinfo aquacomputer_d5next -0 >/dev/null 2>&1 ; then
echo
echo "-----------Installing Aquacomputer D5Next package, please wait...!------------"
install > /dev/null
activate
echo
echo "-----------Installation of Aquacomputer D5Next package successful-------------"
echo
else
activate
echo
echo "------------Installation of Aquacomputer D5Next package successful------------"
fi
#Install icon
if [ ! -f "&emhttp;/images/&name;.png" ]; then
if [ ! -d "&emhttp;/images" ]; then
mkdir -p &emhttp;/images
fi
cp &plugin;/&name;.png &emhttp;/images/
fi
# Fix for broken sensor readings
if [ -f /boot/config/plugins/dynamix.system.temp/sensors.conf ]; then
sed -i '/quadro-hid-3-/,+1d' /boot/config/plugins/dynamix.system.temp/sensors.conf
fi
if [ -f /etc/sensors.d/sensors.conf ]; then
sed -i '/quadro-hid-3-/,+1d' /etc/sensors.d/sensors.conf
fi
</INLINE>
</FILE>
<FILE Run="/bin/bash" Method="remove">
<INLINE>
echo "----------------------------------------------"
echo "---Uninstalling Aquacomputer D5Next package---"
echo "----------------------------------------------"
# Remove plugin related files
rm -rf &emhttp; &plugin;
echo
echo "-------------------------------------------------------------------------"
echo "---Aquacomputer D5Next package uninstalled, please reboot your server!---"
echo "-------------------------------------------------------------------------"
echo
</INLINE>
</FILE>
</PLUGIN>