backup.py

Modular and lightweight backup utility to save, encrypt and verify your personal data.
## Overview `backup.py` supports two major options: `--backup`, to create a new backup and `--extract` to extract an existing backup archive. In order to create a backup file, you first need to create a *"sources file"* to specify the absolute paths to backup. For instance: ```ini # directories end with a slash... photos=/home/marco/Pictures/ documents=/home/marco/Documents/ # while individual files do not wireguard=/etc/wireguard/wg0.conf ``` Then, you can start the backup with the following command: ```sh $ sudo ./backup.py --checksum --backup sources.ini $PWD "very_bad_pw" Copying photos (1/3) Copying documents (2/3) Copying wireguard (3/3) File name: '/home/marco/Projects/backup.py/backup-wood-20260122.tar.gz.enc' Checksums file: '/home/marco/Projects/backup.py/backup-wood-20260122.sha256' File size: 5533818904 bytes (5.15 GiB) Elapsed time: 2 minutes, 12 seconds ``` The `--checsum` (optional) is used to generate a checksum file containing the hashes of each single of the backup. To extract an existing backup, you can instead issue the following command: ```sh $ ./backup.py -c --extract backup-wood-20260122.tar.gz.enc "very_bad_pw" backup-wood-20260122.sha256 Backup extracted to: '/home/marco/Projects/backup.py/backup.py.tmp' Elapsed time: 1 minute, 3 seconds ``` This will create a new directory named `backup.py.tmp` on your local path. Just like before, the `-c` option is optional. ## Usage As stated before, `python.py` is built from scratch in modern Python (3.10+) without using any external dependency except for `tar` and `gpg`. The *sources file* follows an INI-like syntax structured using associative records between labels and absolute paths. In order words: ```ini