summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-01-31 23:12:52 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-01-31 23:12:52 +0100
commit7a932d340da5ee49241503ce7b90c704d4ae22ff (patch)
tree3c507bd6663933e62329354352db9ed508049453
parentfa29d792ad63319a92c46af1e36955a73c4dbcd0 (diff)
downloadnixos-7a932d340da5ee49241503ce7b90c704d4ae22ff.tar
nixos-7a932d340da5ee49241503ce7b90c704d4ae22ff.tar.gz
nixos-7a932d340da5ee49241503ce7b90c704d4ae22ff.tar.bz2
nixos-7a932d340da5ee49241503ce7b90c704d4ae22ff.tar.xz
nixos-7a932d340da5ee49241503ce7b90c704d4ae22ff.zip
...
-rw-r--r--accounts/gkleen@sif/systemd.nix8
1 files changed, 4 insertions, 4 deletions
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix
index bd506590..ff3d11af 100644
--- a/accounts/gkleen@sif/systemd.nix
+++ b/accounts/gkleen@sif/systemd.nix
@@ -60,7 +60,7 @@ in {
60 60
61 61
62 remote_fs = 'surtr' 62 remote_fs = 'surtr'
63 remote_file = f'{remote_fs}:store.kdbx' 63 remote_file = 'store.kdbx'
64 target_file = expanduser('~/store.kdbx') 64 target_file = expanduser('~/store.kdbx')
65 meta_file = expanduser('~/.store.kdbx.json') 65 meta_file = expanduser('~/.store.kdbx.json')
66 66
@@ -71,7 +71,7 @@ in {
71 71
72 def get_upload_time(): 72 def get_upload_time():
73 upload_time = None 73 upload_time = None
74 with subprocess.Popen(['rclone', 'lsjson', remote_file], stdout=subprocess.PIPE) as proc: # noqa: E501 74 with subprocess.Popen(['rclone', 'lsjson', f'{remote_fs}:{dirname(remote_file)}'], stdout=subprocess.PIPE) as proc: # noqa: E501
75 for file in json.load(proc.stdout): 75 for file in json.load(proc.stdout):
76 if file['Path'] != 'store.kdbx': 76 if file['Path'] != 'store.kdbx':
77 continue 77 continue
@@ -81,7 +81,7 @@ in {
81 81
82 def do_upload(): 82 def do_upload():
83 print('Uploading', file=stderr) 83 print('Uploading', file=stderr)
84 subprocess.run(['rclone', 'copy', '-I', target_file, f'{remote_fs}:'], check=True) # noqa: E501 84 subprocess.run(['rclone', 'copy', '-I', target_file, f'{remote_fs}:{dirname(remote_file)}'], check=True) # noqa: E501
85 upload_time = get_upload_time() 85 upload_time = get_upload_time()
86 with open(meta_file, 'w') as file: 86 with open(meta_file, 'w') as file:
87 json.dump({'our_last_upload_time': upload_time.isoformat()}, file) 87 json.dump({'our_last_upload_time': upload_time.isoformat()}, file)
@@ -89,7 +89,7 @@ in {
89 89
90 def do_download(): 90 def do_download():
91 print('Downloading', file=stderr) 91 print('Downloading', file=stderr)
92 subprocess.run(['rclone', 'copy', '-I', remote_file, dirname(target_file)], check=True) # noqa: E501 92 subprocess.run(['rclone', 'copy', '-I', f'{remote_fs}:{remote_file}', dirname(target_file)], check=True) # noqa: E501
93 93
94 94
95 upload_time = get_upload_time() 95 upload_time = get_upload_time()