Updated Syncthing Script

This commit is contained in:
Phil 2022-05-29 13:06:29 +01:00
parent 15e98dc461
commit 83ec53a721

View File

@ -11,17 +11,7 @@ ip=$(sudo ifconfig eth0 | perl -ne 'print $1 if /inet\s.*?(\d{1,3}\.\d{1,3}\.\d{
syncthingversion=$(curl --silent "https://api.github.com/repos/syncthing/syncthing/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') syncthingversion=$(curl --silent "https://api.github.com/repos/syncthing/syncthing/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# Setup Syncthing User #Setup Syncthing User
adduser \
--system \
--shell /bin/bash \
--gecos 'Syncthing Client' \
--group \
--disabled-password \
--home /opt/syncthing/config \
git
# Setup Folders
sudo mkdir /opt/syncthing sudo mkdir /opt/syncthing
sudo chown syncthing -R /opt/syncthing sudo chown syncthing -R /opt/syncthing
@ -31,6 +21,16 @@ mkdir /opt/syncthing/config
mkdir /opt/syncthing/bin mkdir /opt/syncthing/bin
mkdir /opt/syncthing/bin/current mkdir /opt/syncthing/bin/current
sudo adduser \
--system \
--shell /bin/bash \
--gecos 'Syncthing Client' \
--group \
--disabled-password \
--home /opt/syncthing/config \
syncthing
# Get Syncthing and setup # Get Syncthing and setup
cd /opt/syncthing/bin cd /opt/syncthing/bin
wget https://github.com/syncthing/syncthing/releases/download/$(echo $syncthingversion)/syncthing-linux-amd64-$(echo $syncthingversion).tar.gz wget https://github.com/syncthing/syncthing/releases/download/$(echo $syncthingversion)/syncthing-linux-amd64-$(echo $syncthingversion).tar.gz
@ -55,9 +55,9 @@ command = /usr/local/bin/syncthing -no-browser -logflags=0 -gui-address=$ip:8384
environment = STNORESTART="1", HOME="/opt/syncthing/config/" environment = STNORESTART="1", HOME="/opt/syncthing/config/"
EOF' EOF'
sudo service supervisor restart
sudo supervisorctl reread sudo supervisorctl reread
sudo supervisorctl update sudo supervisorctl update
sudo supervisorctl reload
echo "If everything installed with no errors" echo "If everything installed with no errors"
echo "Please go to http://$ip:8384" echo "Please go to http://$ip:8384"