forked from ThomDietrich/openhab-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgradeOH2.sh
32 lines (26 loc) · 1.1 KB
/
upgradeOH2.sh
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
#!/usr/bin/env bash
INSTALL_DIR="/opt/openhab2"
echo "This will replace openHAB2 runtime files."
read -p "Are you sure openHAB2 is not running? [y/N] " input
if [ "$input" != "y" ]
then
exit 1
fi
rm openhab-offline-2.0.0-SNAPSHOT.zip
wget https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-offline/target/openhab-offline-2.0.0-SNAPSHOT.zip
DATE=`date +%Y%m%H%M`
cp -apv $INSTALL_DIR $INSTALL_DIR.$DATE
echo "for a clean start:"
read -p "Clean start? [y/N] " input
if [ "$input" == "y" ]
then
rm -rf $INSTALL_DIR/addons $INSTALL_DIR/runtime $INSTALL_DIR/userdata $INSTALL_DIR/LICENSE.TXT $INSTALL_DIR/start.* $INSTALL_DIR/start_debug.*
ls -laF $INSTALL_DIR
read -p "only conf folder should be left now? [Enter] "
fi
unzip -o openhab-offline-2.0.0-SNAPSHOT.zip -d $INSTALL_DIR/
rm openhab-offline-2.0.0-SNAPSHOT.zip
chown pi:openhab $INSTALL_DIR
sed -e "s/sshHost = 127.0.0.1/sshHost = 0.0.0.0/g" $INSTALL_DIR/runtime/karaf/etc/org.apache.karaf.shell.cfg
echo "newest openHAB2 build extracted."
echo "execute: 'screen -d -m /opt/openhab2/start.sh'"