blob: c72ab86730a3ac63bc50e39e70d38df5b4e9a9f6 (
plain)
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
|
#!/bin/sh
# $FreeBSD$
: ${OPENHAB_USERDATA:="/var/db/openhab2/userdata"}
: ${OPENHAB_RUNTIME:="%%PREFIX%%/libexec/openhab2/runtime"}
: ${OPENHAB_REPL:="%%PREFIX%%/share/openhab2/etc"}
: ${OPENHAB_ETC:="%%PREFIX%%/etc/openhab2"}
rm -r $OPENHAB_USERDATA/cache/* $OPENHAB_USERDATA/tmp/*
rm -r $OPENHAB_USERDATA/kar
for file in $(cat $OPENHAB_RUNTIME/bin/userdata_sysfiles.lst); do
cp -pv $OPENHAB_REPL/$file $OPENHAB_USERDATA/etc/$file
done
FILES="$(grep -R org.eclipse.smarthome ${OPENHAB_ETC} | cut -d : -f 1 | sort -u | grep -v .sample)"
BKP_SUFFIX=pre_2.5.0
for file in ${FILES}; do
mv -v ${file} ${file}.${BKP_SUFFIX}
echo updating content of ${file}, keeping backup in ${file}.${BKP_SUFFIX}
sed -e 's/org.eclipse.smarthome.*://g' <${file}.${BKP_SUFFIX} >${file}
done
for file in ${OPENHAB_USERDATA}/jsondb/automation_rules.json ${OPENHAB_USERDATA}/jsondb/automation_rules_disabled.json ${OPENHAB_USERDATA}/jsondb/backup/*; do
if [ -e ${file} ]; then
mv -v ${file} ${file}.${BKP_SUFFIX}
echo updating next generation rule engine data in ${file}
sed -e 's/org.eclipse.smarthome.automation.dto.RuleDTO/org.eclipse.smarthome.automation.dto.RuleDTO/g' <${file}.${BKP_SUFFIX} >${file} && rm ${file}.${BKP_SUFFIX}
fi
done
|