Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 45 lines (36 sloc) 1.44 KB
#!/usr/bin/env bash -x
RELAY="<listenAddress>relay://141.14.27.100:443/?id=UN7YT4V-DDFTONS-24S4KDD-PNDATTE-K5CPSNO-E6WH23X-7WLHQTW-CWQA2QO</listenAddress>"
if [[ ! -d $HOME/bin ]]; then
mkdir $HOME/bin
fi
cp -v syncthing $HOME/bin/
if [[ -e $HOME/.bashrc ]]; then
if [[ ! `grep \${HOME}/bin $HOME/.bashrc` ]]; then
echo 'export PATH=${HOME}/bin:${PATH}' >> $HOME/.bashrc
fi
else
echo 'export PATH=${HOME}/bin:${PATH}' > $HOME/.bashrc \
&& chmod 600 $HOME/.bashrc
fi
if [[ -e $HOME/.bash_profile ]]; then
if [[ ! `grep "source \${HOME}/.bashrc" $HOME/.bash_profile` ]]; then
echo 'source ${HOME}/.bashrc' >> $HOME/.bash_profile
fi
else
echo 'source ${HOME}/.bashrc' >> $HOME/.bash_profile
fi
source $HOME/.bashrc
if [[ ! -d $HOME/Library/LaunchAgents ]]; then
mkdir $HOME/Library/LaunchAgents
fi
sed \
-e 's%<string>/Users/USERNAME/bin/syncthing</string>%<string>/Users/USERNAME/bin/syncthing</string><string>-no-browser</string>%'\
-e "s/USERNAME/$USER/g"\
syncthing.plist > $HOME/Library/LaunchAgents/syncthing.plist
syncthing -generate=$HOME/Library/Application\ Support/Syncthing/
mv -v $HOME/Library/Application\ Support/Syncthing/config.{xml,xml.org}
sed "s%<listenAddress>default</listenAddress>%$RELAY%" \
$HOME/Library/Application\ Support/Syncthing/config.xml.org \
> $HOME/Library/Application\ Support/Syncthing/config.xml
launchctl load ~/Library/LaunchAgents/syncthing.plist
launchctl start net.syncthing.syncthing