-
Notifications
You must be signed in to change notification settings - Fork 9
/
update_script
executable file
·57 lines (42 loc) · 1.28 KB
/
update_script
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
#!/bin/sh
ADDONNAME=hm-iobroker
CONFIGDIR=/usr/local/etc/config
ADDONDIR=/usr/local/addons/${ADDONNAME}
RCDDIR=${CONFIGDIR}/rc.d
WWWDIR=${CONFIGDIR}/addons/www/${ADDONNAME}
ADMINDIR=${ADDONDIR}/addon_admin
if [ "$1" == "HM-RASPBERRYMATIC" ] || [ "$1" == "CCU3" ] ; then
echo "HM-RASPBERRYMATIC"
# mount /usr/local if not already mounted
mount | grep /usr/local 2>&1 >/dev/null
if [ $? -eq 1 ]; then
mount /usr/local
fi
mkdir -p ${ADDONDIR}
chmod 777 ${ADDONDIR}
mkdir -p ${RCDDIR}
chmod 755 ${RCDDIR}
rm -rf ${ADDONDIR}/*
mkdir -p ${ADMINDIR}
chmod 777 ${ADMINDIR}
#cp -r iob/iodata/* ${ADDONDIR}/
tar xfvz iob/iodata.tar.gz -C ${ADDONDIR}/
#patch files. maybe needs to be changed if we have more files
cp -r modified_iodata_files/* ${ADDONDIR}/
cp -f iob/* ${ADMINDIR}
cp -af rc.d/* ${RCDDIR}
rm -rf /usr/local/etc/config/addons/www/${ADDONNAME}
cp -af www ${ADDONDIR}/
if [ ! -e ${WWWDIR} ]; then
ln -sf ${ADDONDIR}/www ${WWWDIR}
fi
chmod +rx ${RCDDIR}/iobroker
touch /usr/local/etc/config/hm_addons.cfg
${ADMINDIR}/update_addon hm-iobroker ${ADMINDIR}/hm-iobroker-addon.cfg
sync
else
echo "Unsupported CCU platform: '$1'"
fi
# exit with 0 to signal install succeeded and no reboot
# is required
exit 0