-
Notifications
You must be signed in to change notification settings - Fork 2
/
update_script
executable file
·61 lines (49 loc) · 1.51 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
58
59
60
61
#!/bin/sh
ADDONNAME=hm-watchdog
CONFIG_DIR=/usr/local/etc/config
ADDON_DIR=/usr/local/addons/${ADDONNAME}
RCD_DIR=${CONFIG_DIR}/rc.d
WWW_DIR=${CONFIG_DIR}/addons/www/${ADDONNAME}
# mount /usr/local if not already mounted
mount | grep /usr/local 2>&1 >/dev/null
if [ $? -eq 1 ]; then
mount /usr/local
fi
# create necessary directories
mkdir -p ${ADDON_DIR}
chmod 755 ${ADDON_DIR}
mkdir -p ${RCD_DIR}
chmod 755 ${RCD_DIR}
# copy addon (common stuff)
cp -af common/* ${ADDON_DIR}/
# copy addon (CCU dependent stuff)
if [ "$1" = "" ]; then
cp -af ccu1/* ${ADDON_DIR}/
elif [ "$1" = "CCU2" ]; then
cp -af ccu2/* ${ADDON_DIR}/
elif [ "$1" == "HM-RASPBERRYMATIC" ]; then
cp -af ccurm/* ${ADDON_DIR}/
fi
# copy startup script
cp -af rc.d/* ${RCD_DIR}
# copy www stuff
cp -af www ${ADDON_DIR}/
if [ ! -e ${WWW_DIR} ]; then
ln -sf ${ADDON_DIR}/www ${WWW_DIR}
fi
# add menu entry
touch /usr/local/etc/config/hm_addons.cfg
${ADDON_DIR}/bin/update_addon hm-watchdog ${ADDON_DIR}/etc/hm-watchdog-addon.cfg
# copy over the default hm-watchdog.conf_default config file
# in case the user hasn't already an own one
if [ ! -e ${ADDON_DIR}/etc/hm-watchdog.conf ]; then
cp -af ${ADDON_DIR}/etc/hm-watchdog.conf_default ${ADDON_DIR}/etc/hm-watchdog.conf
fi
# copy over the default notify.rega_default script
# in case the user hasn't already an own one
if [ ! -e ${ADDON_DIR}/etc/notify.rega ]; then
cp -af ${ADDON_DIR}/etc/notify.rega_default ${ADDON_DIR}/etc/notify.rega
fi
# synchronize filesystem before performing a reboot
# afterwards
sync