# We add the official deposit of Syncthing
which curl &> /dev/null || sudo apt update && sudo apt install curl -y # Install curl if not already installed
sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
# Install Syncthing
sudo apt update
sudo apt install syncthing -y
echo -e "\nSyncthing installed!"
# Launch it at startup
sudo systemctl enable syncthing@$USER.service
sudo systemctl start syncthing@$USER.service
# We remove the Ubuntu desktop shortcut only if it already exists
if [ -f /usr/share/applications/syncthing-start.desktop ]
then
sudo mv /usr/share/applications/syncthing-start.desktop /usr/share/applications/syncthing-start.desktop.bak
echo -e "\nSyncthing Start-icon removed!"
fi
echo -e "\nSyncthing configured to start at startup! 🎉"