Syncthing for mesh install

This commit is contained in:
Bob Mottram 2016-07-13 07:57:38 +01:00
parent b251556ed9
commit 4ae4b6b91d
1 changed files with 17 additions and 17 deletions

View File

@ -264,23 +264,23 @@ function mesh_install_syncthing {
# This probably does need to run as root so that it can access the Sync directories # This probably does need to run as root so that it can access the Sync directories
# in each user's home directory # in each user's home directory
chroot "$rootdir" echo '[Unit]' > /etc/systemd/system/syncthing.service echo '[Unit]' > $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'Description=Syncthing - Open Source Continuous File Synchronization' >> /etc/systemd/system/syncthing.service echo 'Description=Syncthing - Open Source Continuous File Synchronization' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'Documentation=man:syncthing(1)' >> /etc/systemd/system/syncthing.service echo 'Documentation=man:syncthing(1)' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'After=network.target' >> /etc/systemd/system/syncthing.service echo 'After=network.target' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'Wants=syncthing-inotify@.service' >> /etc/systemd/system/syncthing.service echo 'Wants=syncthing-inotify@.service' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo '' >> /etc/systemd/system/syncthing.service echo '' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo '[Service]' >> /etc/systemd/system/syncthing.service echo '[Service]' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'User=root' >> /etc/systemd/system/syncthing.service echo 'User=root' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo "Environment='all_proxy=socks5://localhost:9050'" >> /etc/systemd/system/syncthing.service echo "Environment='all_proxy=socks5://localhost:9050'" >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0' >> /etc/systemd/system/syncthing.service echo 'ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'Restart=on-failure' >> /etc/systemd/system/syncthing.service echo 'Restart=on-failure' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'SuccessExitStatus=3 4' >> /etc/systemd/system/syncthing.service echo 'SuccessExitStatus=3 4' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'RestartForceExitStatus=3 4' >> /etc/systemd/system/syncthing.service echo 'RestartForceExitStatus=3 4' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo '' >> /etc/systemd/system/syncthing.service echo '' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo '[Install]' >> /etc/systemd/system/syncthing.service echo '[Install]' >> $rootdir/etc/systemd/system/syncthing.service
chroot "$rootdir" echo 'WantedBy=multi-user.target' >> /etc/systemd/system/syncthing.service echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/syncthing.service
# Note: don't enable the daemon chroot "$rootdir" systemctl enable syncthing
if ! grep -q "syncthing" $rootdir/etc/crontab; then if ! grep -q "syncthing" $rootdir/etc/crontab; then
echo "*/1 * * * * root /usr/local/bin/${PROJECT_NAME}-syncthing > /dev/null" >> $rootdir/etc/crontab echo "*/1 * * * * root /usr/local/bin/${PROJECT_NAME}-syncthing > /dev/null" >> $rootdir/etc/crontab