Commit 6a2567dd authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Change Syntching to packaged version...

Change Syntching to packaged version https://github.com/armbian/config/issues/46 and add OpenHAB suite (need some additional testing)
parent beb17fb0
......@@ -30,6 +30,7 @@
# install_MySQLDovecot
# install_Virus
# install_hhvm
# install_openhab
# install_phpmyadmin
# install_apache
# install_nginx
......@@ -91,7 +92,7 @@ function check_status
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading install info ... " 5 28
LIST=()
LIST_CONST=24
LIST_CONST=25
# Samba
SAMBA_STATUS="$(check_if_installed samba && echo "on" || echo "off" )"
......@@ -113,6 +114,11 @@ function check_status
alive_port "Personal cloud @syncthing.net" "8384" "boolean"
LIST+=( "Syncthing" "$DESCRIPTION" "$SYNCTHING_STATUS" )
# OpenHab
OPENHAB_STATUS="$([[ -f /usr/bin/openhab-cli ]] && echo "on" || echo "off" )"
alive_port "Smarthome suite" "8080"
LIST+=( "OpenHAB" "$DESCRIPTION" "$OPENHAB_STATUS" )
# VPN
if [[ "$(dpkg --print-architecture)" == "armhf" || "$(dpkg --print-architecture)" == "amd64" ]]; then
# vpn server
......@@ -812,46 +818,41 @@ chmod +x /etc/cron.daily/seed-armbian-torrent
install_openhab ()
{
wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | apt-key add -
echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | tee /etc/apt/sources.list.d/openhab2.list
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y openhab2 openhab2-addons default-jre
service openhab2 start
}
install_syncthing ()
{
#
# Install Personal cloud https://syncthing.net/
#
if [ "$(dpkg --print-architecture | grep armhf)" == "armhf" ]; then
local filename="linux-arm"
elif [ "$(dpkg --print-architecture | grep arm64)" == "arm64" ]; then
local filename="linux-arm64"
else
local filename="linux-amd64"
fi
wgeturl=$(curl -s "https://api.github.com/repos/syncthing/syncthing/releases" | grep $filename | grep 'browser_download_url' | head -1 | cut -d \" -f 4)
fancy_wget "$wgeturl" "-O ${TEMP_DIR}/syncthing.tgz"
wgeturl=$(curl -s "https://api.github.com/repos/syncthing/syncthing-inotify/releases" | grep $filename | grep 'browser_download_url' | head -1 | cut -d \" -f 4)
fancy_wget "$wgeturl" "-O ${TEMP_DIR}/syncthing-inotify.tgz"
tar xf ${TEMP_DIR}/syncthing.tgz -C ${TEMP_DIR}
tar xf ${TEMP_DIR}/syncthing-inotify.tgz -C /usr/bin
cp -R ${TEMP_DIR}/syncthing-linux*/syncthing* /usr/bin/
cp ${TEMP_DIR}/syncthing-linux*/etc/linux-systemd/system/syncthing* /etc/systemd/system/
cp /etc/systemd/system/syncthing@.service /etc/systemd/system/syncthing-inotify@.service
# adjust service for inotify
sed -i "s/^Description=.*/Description=Syncthing Inotify File Watcher/" /etc/systemd/system/syncthing-inotify@.service
sed -i "s/^After=.*/After=network.target syncthing.service/" /etc/systemd/system/syncthing-inotify@.service
sed -i "s/^ExecStart=.*/ExecStart=\/usr\/bin\/syncthing-inotify -logfile=\/var\/log\/syncthing-inotify.log -logflags=3/" /etc/systemd/system/syncthing-inotify@.service
sed -i "/^\[Install\]/a Requires=syncthing.service" /etc/systemd/system/syncthing-inotify@.service
curl -s https://syncthing.net/release-key.txt | apt-key add -
echo "deb https://apt.syncthing.net/ syncthing stable" | tee /etc/apt/sources.list.d/syncthing.list
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y install syncthing
# increase open file limit
if !(grep -qs "fs.inotify.max_user_watches=204800" "/etc/sysctl.conf");then
echo -e "fs.inotify.max_user_watches=204800" | tee -a /etc/sysctl.conf
fi
add_choose_user
mv /etc/systemd/system/syncthing@.service /etc/systemd/system/syncthing@${CHOSEN_USER}.service
mv /etc/systemd/system/syncthing-inotify@.service /etc/systemd/system/syncthing-inotify@${CHOSEN_USER}.service
# change to server IP
sed -i "s/127.0.0.1/${serverIP}/" /home/${CHOSEN_USER}/.config/config.xml
# create startup files
mv /lib/systemd/system/syncthing@.service /lib/systemd/system/syncthing@${CHOSEN_USER}.service
systemctl enable syncthing@${CHOSEN_USER}.service >/dev/null 2>&1
systemctl start syncthing@${CHOSEN_USER}.service >/dev/null 2>&1
systemctl enable syncthing-inotify@${CHOSEN_USER}.service >/dev/null 2>&1
systemctl start syncthing-inotify@${CHOSEN_USER}.service >/dev/null 2>&1
}
......@@ -1636,6 +1637,11 @@ if ! is_package_manager_running; then
selection=${selection//Syncthing/}
fi
if [[ "$selection" == *OpenHAB* && "$OPENHAB_STATUS" != "on" ]]; then
install_openhab
selection=${selection//OpenHAB/}
fi
if [[ "$selection" == *server* && "$VPN_SERVER_STATUS" != "on" ]]; then
install_vpn_server
selection=${selection//\"VPN server\"/}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment