forked from kounch/argonone
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathargonone.install
55 lines (50 loc) · 1.75 KB
/
argonone.install
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
pre_install() {
echo "Checking Hardware Model..."
if grep "Raspberry Pi 4" /proc/device-tree/model ; then
echo "Building New Virtual Environment in /opt/argonone..."
python -m venv --clear /opt/argonone
env CFLAGS="-fcommon" /opt/argonone/bin/python3 -m pip install smbus RPi.GPIO
echo "Enabling i2C..."
BOOT_CFG="/boot/config.txt"
if [ -e "${BOOT_CFG}" ]; then
touch "${BOOT_CFG}"
fi
if ! grep "dtparam=i2c_arm=on" "${BOOT_CFG}" >/dev/null 2>&1 ; then
echo "dtparam=i2c_arm=on" >> "${BOOT_CFG}"
fi
if ! grep "dtparam=i2c-1=on" "${BOOT_CFG}" >/dev/null 2>&1 ; then
echo "dtparam=i2c-1=on" >> "${BOOT_CFG}"
fi
MODULE_CFG="/etc/modules-load.d/raspberrypi.conf"
if [ -e "${MODULE_CFG}" ]; then
touch "${MODULE_CFG}"
chmod 644 "${MODULE_CFG}"
fi
if ! grep "i2c-dev" "${MODULE_CFG}" >/dev/null 2>&1 ; then
echo "i2c-dev" >> "${MODULE_CFG}"
fi
if ! grep "i2c-bcm2708" "${MODULE_CFG}" >/dev/null 2>&1 ; then
echo "i2c-bcm2708" >> "${MODULE_CFG}"
fi
else
echo "Not a Raspberry Pi Model 4!"
/usr/bin/false
fi
}
post_install() {
echo "Please reboot before first use."
echo "Configuration file: /etc/argononed.conf"
echo "Enable power button and fan control service with: sudo systemctl enable argononed.service"
echo "If you want to: enable_uart=1"
echo "Put it in /boot/config.txt and remove kgdboc=ttyAMA0,115200 in /boot/cmdline"
echo "Thanks to thegeek1977 to help patching this"
}
pre_remove() {
systemctl stop argononed.service
systemctl deactivate argononed.service
}
post_remove() {
echo "Removing Virtual Environment in /opt/argonone..."
rm -rf /opt/argonone
echo "Software removed. Please remember to disable I2C if not needed any more"
}