Skip to content

Instantly share code, notes, and snippets.

@WhyNotHugo
Forked from icaruseffect/gist:4c4fca1f1640f0d01693
Last active September 9, 2015 15:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save WhyNotHugo/00ac53fe85a15c1fa414 to your computer and use it in GitHub Desktop.
Save WhyNotHugo/00ac53fe85a15c1fa414 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Bail on errors!
set -e
set -u
# Change to a temporary directory:
cd /tmp
# Version of Syncthing we'll install:
export st_ver=0.11.6
# Download and install it to our user's bin dir:
curl -L "https://github.com/syncthing/syncthing/releases/download/v${st_ver}/syncthing-linux-arm-v${st_ver}.tar.gz" | \
tar xvz "syncthing-linux-arm-v${st_ver}/syncthing"
install -Dm 755 syncthing-linux-arm-v${st_ver}/syncthing /home/nemo/.bin/syncthing
rm -rf syncthing*
echo "Creating the dirs for systemd user mode when needed..."
mkdir -p ~/.config/systemd/user/user-session.target.wants/
echo "Installing systemd unit file..."
echo "[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
After=pre-user-session.target
[Service]
Environment=STNORESTART=yes
ExecStart=/home/nemo/.bin/syncthing
Restart=on-success
SuccessExitStatus=3
[Install]
WantedBy=user-session.target" > /home/nemo/.config/systemd/user/user-session.target.wants/syncthing.service
echo "Enabling the syncthing service..."
systemctl --user daemon-reload
systemctl --user start syncthing
echo "Done Opening configuration interface in browser..."
exec xdg-open "http://127.0.0.1:8080" > /dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment