2024-09-07 01:18:31 +02:00
|
|
|
with import <nixpkgs> {};
|
|
|
|
|
|
|
|
pkgs.writeShellScriptBin "startsync" ''
|
|
|
|
#!/bin/sh
|
2024-10-28 22:02:45 +01:00
|
|
|
script="$0"
|
2024-09-07 01:18:31 +02:00
|
|
|
killall sshfs sftp
|
|
|
|
sleep 0.5
|
|
|
|
killall -9 sshfs sftp
|
2024-11-04 16:35:36 +01:00
|
|
|
sudo umount -l ~/sync
|
2024-09-07 01:18:31 +02:00
|
|
|
sleep 0.5
|
2024-11-04 16:35:36 +01:00
|
|
|
mkdir ~/broken
|
|
|
|
mv ~/sync/* ~/broken/
|
2024-10-28 22:02:45 +01:00
|
|
|
if [ "$1" = "stop" ] ; then exit ; fi
|
2024-09-07 01:18:31 +02:00
|
|
|
sshfs -p 23 root@tudbut.de:sync ~/sync
|
|
|
|
while ! ls ~/sync/Passwords.kdbx ; do sleep 0.2 ; done
|
2024-10-28 22:02:45 +01:00
|
|
|
while true ; do
|
2024-10-28 22:06:27 +01:00
|
|
|
(cat ~/sync/test > /dev/null ; touch ~/.syncfs_ok) &
|
2024-10-28 22:15:17 +01:00
|
|
|
sleep 7
|
2024-10-28 22:02:45 +01:00
|
|
|
if ! [ -e ~/.syncfs_ok ] ; then
|
|
|
|
"$script" stop
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
rm ~/.syncfs_ok
|
|
|
|
done & disown
|
2024-09-07 01:18:31 +02:00
|
|
|
exec keepassxc
|
|
|
|
''
|
|
|
|
|