diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-08 16:37:26 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-08 16:37:26 +0100 |
commit | b2e9c4a40bb11bfb7e5eceb7cb3aa387c2d57a59 (patch) | |
tree | 32466cf1fa5192a7d7ff060eb5a4ebd0632b755d | |
parent | 3c93ac6a0ff8adc964c2994f4d8c1817d8aa45d0 (diff) | |
download | nixos-b2e9c4a40bb11bfb7e5eceb7cb3aa387c2d57a59.tar nixos-b2e9c4a40bb11bfb7e5eceb7cb3aa387c2d57a59.tar.gz nixos-b2e9c4a40bb11bfb7e5eceb7cb3aa387c2d57a59.tar.bz2 nixos-b2e9c4a40bb11bfb7e5eceb7cb3aa387c2d57a59.tar.xz nixos-b2e9c4a40bb11bfb7e5eceb7cb3aa387c2d57a59.zip |
ymir: ...
-rwxr-xr-x | snap.py | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -13,6 +13,7 @@ from tempfile import TemporaryDirectory | |||
13 | import pathlib | 13 | import pathlib |
14 | 14 | ||
15 | import unshare | 15 | import unshare |
16 | import signal | ||
16 | 17 | ||
17 | 18 | ||
18 | def borg_lv(lv, size_percent, target, archive_prefix, dry_run, **args): | 19 | def borg_lv(lv, size_percent, target, archive_prefix, dry_run, **args): |
@@ -66,7 +67,7 @@ def borg_lv(lv, size_percent, target, archive_prefix, dry_run, **args): | |||
66 | '--chunker-params=10,23,16,4095', | 67 | '--chunker-params=10,23,16,4095', |
67 | f'--timestamp={creation_time.strftime("%Y-%m-%dT%H:%M:%S")}', | 68 | f'--timestamp={creation_time.strftime("%Y-%m-%dT%H:%M:%S")}', |
68 | '--show-rc', | 69 | '--show-rc', |
69 | '--progress', | 70 | # '--progress', |
70 | '--list', | 71 | '--list', |
71 | '--filter=AMEi-x?', | 72 | '--filter=AMEi-x?', |
72 | '--stats', | 73 | '--stats', |
@@ -91,7 +92,12 @@ def borg_lv(lv, size_percent, target, archive_prefix, dry_run, **args): | |||
91 | finally: | 92 | finally: |
92 | subprocess.run(['lvremove', '--force', sn], stdin=subprocess.DEVNULL, check=True) | 93 | subprocess.run(['lvremove', '--force', sn], stdin=subprocess.DEVNULL, check=True) |
93 | 94 | ||
95 | def sigterm(signum, frame): | ||
96 | raise SystemExit(128 + signum) | ||
97 | |||
94 | def main(): | 98 | def main(): |
99 | signal.signal(signal.SIGTERM, sigterm) | ||
100 | |||
95 | parser = argparse.ArgumentParser() | 101 | parser = argparse.ArgumentParser() |
96 | parser.add_argument('lv', metavar='LV') | 102 | parser.add_argument('lv', metavar='LV') |
97 | parser.add_argument('--size-percent', metavar='PERCENT', type = float, default=10) | 103 | parser.add_argument('--size-percent', metavar='PERCENT', type = float, default=10) |