forked from ich777/unraid-qnapec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qnap-ec.plg
143 lines (117 loc) · 4.4 KB
/
qnap-ec.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
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "qnap-ec">
<!ENTITY author "ich777">
<!ENTITY version "2023.10.06">
<!ENTITY gitURL "https://github.com/&author;/unraid-qnapec/raw/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.10.2" support="https://forums.unraid.net/topic/92865-support-ich777-amd-vendor-reset-coraltpu-hpsahba/">
<CHANGES>
###2023.06.10
- Update README.md - thank you GitHub user MPritsch
###2023.09.11
- Add TS-464 to supported list and TS464.md to repository - thank you GitHub user 0xFoxx
###2023.07.25
- Fixed typo, thanks to user -C- from the unRAID Forums
- Added TS-453A to known supported units list, thanks to user Lavoslav from the unRAID Forums
###2022.07.21
- Version detection from package via GitHub API
- Save md5 in packages directory
###2022.07.19
- Necessary changes for unRAID 6.11+
- Cleanup
###2022.05.30
- Initial release
</CHANGES>
<FILE Name="&emhttp;/README.md">
<INLINE>
**QNAP-EC**
This package contains and installs the QNAP Embedded Controller chip Kernel module, this allows you to read fan speeds and temperatures as well as reading and writing the fan PWM values from the ITE Tech Inc. IT8528 embedded controller chip.
Currently known supported units are: TS-473A, TS-673A, TS-873A, TS-h886, TS-453Be, TS-877, TS-1677x, TS-253B, TS-453A, TS-464 (Instructions in Repo as: [TS464.md](https://github.com/ich777/unraid-qnapec/blob/master/TS464.md))
Source: https://github.com/Stonyx/QNAP-EC
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
download() {
# Download QNAP-EC 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 "---CHECKSUM ERROR!---"
rm -rf &plugin; &emhttp;
exit 1
fi
echo
echo "-------------------Sucessfully downloaded QNAP-EC package-------------------"
else
echo
echo "-----------------------Can't download QNAP-EC 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-qnapec/releases/tags/${KERNEL_V} | jq -r '.assets[].name' | grep "${PACKAGE}" | grep -E -v '\.md5$' | sort -V | tail -1)"
echo
echo "-----------------------Downloading QNAP-EC package!-------------------------"
echo "--------This could take some time, please don't close this window!----------"
download
else
echo
echo "-----------------------QNAP-EC package found locally------------------------"
fi
}
install() {
# Install QNAP-EC package
/sbin/installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz" 2>/dev/null
depmod -a 2>/dev/null
}
activate() {
# Modprobe module
/sbin/modprobe qnap-ec || echo "-Error loading module, please post your Diagnostics on the support thread!-"
}
# Define Variables
KERNEL_V="$(uname -r)"
PACKAGE="qnapec"
DL_URL="https://github.com/ich777/unraid-qnapec/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%%-*}")
# Check if QNAP-EC package is already downloaded and installed
check
if ! modinfo qnap-ec -0 >/dev/null 2>&1 ; then
install
activate
else
activate
fi
echo
echo "---------------Installation of QNAP-EC package successful-------------------"
echo
</INLINE>
</FILE>
<FILE Run="/bin/bash" Method="remove">
<INLINE>
echo "--------------------------"
echo "---Uninstalling QNAP-EC---"
echo "--------------------------"
# Remove plugin related files
rm -rf &emhttp;
rm -rf &plugin;
echo
echo "-----------------------------------------------------"
echo "---QNAP-EC uninstalled, please reboot your server!---"
echo "-----------------------------------------------------"
echo
</INLINE>
</FILE>
</PLUGIN>