dar-backup 0.6.20.1__py3-none-any.whl → 0.7.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dar-backup
3
- Version: 0.6.20.1
3
+ Version: 0.7.1
4
4
  Summary: A script to do full, differential and incremental backups using dar. Some files are restored from the backups during verification, after which par2 redundancy files are created. The script also has a cleanup feature to remove old backups and par2 files.
5
5
  Project-URL: GPG Public Key, https://keys.openpgp.org/search?q=dar-backup@pm.me
6
6
  Project-URL: Homepage, https://github.com/per2jensen/dar-backup/tree/main/v2
@@ -691,41 +691,51 @@ Classifier: Topic :: System :: Archiving :: Backup
691
691
  Requires-Python: >=3.9
692
692
  Requires-Dist: argcomplete>=3.6.2
693
693
  Requires-Dist: inputimeout>=1.0.4
694
+ Requires-Dist: jinja2>=3.1.6
694
695
  Requires-Dist: rich>=13.0.0
695
696
  Description-Content-Type: text/markdown
696
697
 
697
698
  <!-- markdownlint-disable MD024 -->
698
- # Full, differential or incremental backups using 'dar'
699
+ # `dar-backup`
700
+
701
+ **Reliable DAR backups, automated in clean Python**
699
702
 
700
703
  [![codecov](https://codecov.io/gh/per2jensen/dar-backup/branch/main/graph/badge.svg)](https://codecov.io/gh/per2jensen/dar-backup)
701
- [![PyPI monthly downloads](https://img.shields.io/pypi/dm/dar-backup)](https://pypi.org/project/dar-backup/)
702
- [![Total Downloads](https://img.shields.io/badge/dynamic/json?color=blue&label=Total%20Downloads&query=total&url=https%3A%2F%2Fraw.githubusercontent.com%2Fper2jensen%2Fdar-backup%2Fmain%2Fdownloads.json)](https://pypi.org/project/dar-backup/)
704
+ ![CI](https://github.com/per2jensen/dar-backup/actions/workflows/py-tests.yml/badge.svg)
705
+ [![PyPI version](https://img.shields.io/pypi/v/dar-backup.svg)](https://pypi.org/project/dar-backup/)
706
+ [![PyPI total Downloads](https://img.shields.io/badge/dynamic/json?color=blue&label=Total%20Downloads&query=total&url=https%3A%2F%2Fraw.githubusercontent.com%2Fper2jensen%2Fdar-backup%2Fmain%2Fdownloads.json)](https://pypi.org/project/dar-backup/)
707
+ [![# clones](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/per2jensen/dar-backup/main/v2/doc/badges/badge_clones.json)](https://github.com/per2jensen/dar-backup/blob/main/v2/doc/weekly_clones.png)
708
+ [![Milestone](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/per2jensen/dar-backup/main/v2/doc/badges/milestone_badge.json)](https://github.com/per2jensen/dar-backup/blob/main/v2/doc/weekly_clones.png)
703
709
 
704
710
  The wonderful 'dar' [Disk Archiver](https://github.com/Edrusb/DAR) is used for
705
- the heavy lifting, together with the par2 suite in these scripts.
711
+ the heavy lifting, together with [parchive](https://github.com/Parchive/par2cmdline) suite in these scripts.
706
712
 
707
- This is the `Python` based **version 2** of `dar-backup`.
713
+ This is the `Python` based [**version 2**](https://github.com/per2jensen/dar-backup/tree/main/v2) of `dar-backup`.
708
714
 
709
715
  ## TL;DR
710
716
 
711
- `dar-backup` is a Python-powered CLI for creating and validating full, differential, and incremental backups using dar and par2. Designed for long-term restore integrity, even on user-space filesystems like FUSE.
717
+ `dar-backup` is a Python-powered CLI for creating and validating full, differential, and incremental backups using `dar` and `par2`. Designed for long-term restore integrity, even on user-space filesystems like FUSE.
712
718
 
713
719
  ## Table of Contents
714
720
 
715
- - [Full, differential or incremental backups using 'dar'](#full-differential-or-incremental-backups-using-dar)
721
+ - [Reliable `dar` backups wrapped in Python](#dar-backup)
716
722
  - [My use case](#my-use-case)
723
+ - [Features](#features)
717
724
  - [License](#license)
725
+ - [Changelog version 2](https://github.com/per2jensen/dar-backup/blob/main/v2/Changelog.md)
726
+ - [Quick Guide](#quick-guide)
718
727
  - [Status](#status)
719
728
  - [GPG Signing key](#gpg-signing-key)
720
729
  - [Breaking change in version 0.6.0](#breaking-change-in-version-060)
721
730
  - [Homepage - Github](#homepage---github)
731
+ - [Community](#community)
722
732
  - [Requirements](#requirements)
723
733
  - [Principles](#dar-backup-principles)
724
734
  - [How to run](#how-to-run)
725
735
  - [1 - installation](#1---installation)
726
736
  - [2 - configuration](#2---configuration)
727
737
  - [3 - generate catalog databases](#3---generate-catalog-databases)
728
- - [4 - do FULL backups](#4---do-full-backups)
738
+ - [4 - give `dar-backup` a spin](#4---give-dar-backup-a-spin)
729
739
  - [5 - deactivate venv](#5---deactivate-venv)
730
740
  - [Config](#config)
731
741
  - [Config file](#config-file)
@@ -739,8 +749,7 @@ This is the `Python` based **version 2** of `dar-backup`.
739
749
  - [List contents of an archive](#list-contents-of-an-archive)
740
750
  - [dar file selection examples](#dar-file-selection-examples)
741
751
  - [Select a directory](#select-a-directory)
742
- - [Select file dates in the directory](#select-file-dates-in-the-directory)
743
- - [Exclude .xmp files from that date](#exclude-xmp-files-from-that-date)
752
+ - [Include and exclude some file](#select-files-with-z50-in-the-file-name-and-exclude-xmp-files)
744
753
  - [Restoring](#restoring)
745
754
  - [Default location for restores](#default-location-for-restores)
746
755
  - [--restore-dir option](#--restore-dir-option)
@@ -760,6 +769,7 @@ This is the `Python` based **version 2** of `dar-backup`.
760
769
  - [Separate log file for command output](#separate-log-file-for-command-output)
761
770
  - [Skipping cache directories](#skipping-cache-directories)
762
771
  - [Progress bar + current directory](#progress-bar-and-current-directory)
772
+ - [Shell Autocompletion](#shell-autocompletion)
763
773
  - [Todo](#todo)
764
774
  - [Known Limitations / Edge Cases](#known-limitations--edge-cases)
765
775
  - [Reference](#reference)
@@ -769,31 +779,274 @@ This is the `Python` based **version 2** of `dar-backup`.
769
779
  - [manager](#manager-options)
770
780
  - [cleanup](#cleanup-options)
771
781
  - [clean-log](#clean-log-options)
772
- - [installer](#installer-options)
773
- - [dar-backup-systemd](#dar-backup-systemd)
782
+ - [dar-backup-systemd](#dar-backup-systemd-options)
783
+ - [Installer](#installer-options)
784
+ - [demo](#demo-options)
774
785
 
775
786
  ## My use case
776
787
 
777
- I have cloud storage mounted on a directory within my home dir. The filesystem is [FUSE based](https://www.kernel.org/doc/html/latest/filesystems/fuse.html), which gives it a few special features
788
+ I needed the following:
778
789
 
779
- - a non-privileged user can perform a mount
780
- - a privileged user cannot look into the filesystem --> a backup script running as root is not suitable
790
+ - Backup my workstation to a remote server
791
+ - Backup primarily photos, home made video and different types of documents
792
+ - I have cloud storage mounted on a directory within my home dir. The filesystem is [FUSE based](https://www.kernel.org/doc/html/latest/filesystems/fuse.html), which gives it a few special features
781
793
 
782
- I needed the following:
794
+ - Backup cloud storage (cloud is convenient, but I want control over my backups)
795
+ - A non-privileged user can perform a mount
796
+ - A privileged user cannot look into the filesystem --> a backup script running as root is not suitable
783
797
 
784
- - Backup my cloud storage to something local (cloud is convenient, but I want control over my backups)
785
- - Backup primarily photos, video and different types of documents
786
- - Have a simple non-complicated way of restoring, possibly years into the future. 'dar' fits that scenario with a single statically linked binary (kept with the archives). There is no need install/configure anything - restoring is simple and works well.
798
+ - Have a simple way of restoring, possibly years into the future. 'dar' fits that scenario with a single statically linked binary (kept with the archives). There is no need install/configure anything - restoring is simple and works well.
787
799
  - During backup archives must be tested and a restore test (however small) performed
788
800
  - Archives stored on a server with a reliable file system (easy to mount a directory over sshfs)
789
801
  - Easy to verify archive's integrity, after being moved around.
790
802
 
791
803
  I do not need the encryption features of dar, as all storage is already encrypted.
792
804
 
805
+ ## Features
806
+
807
+ - The battle tested [dar](https://github.com/Edrusb/DAR) Disk Archiver is used for the actual backups - it comes highly recommended.
808
+ - Backup with test of backup and (configurable) restore tests of files with comparison to source
809
+ - [Redundancy files](#par2) created for patching bitrot of the archives (size configurable)
810
+ - Simple [backup definitions](#backup-definition-example) defining what to backup (as many as you need)
811
+ - [Backup catalogs](#dar-manager-databases) in databases, optionally on a disk different from the backups
812
+ - Flexible and precise logging
813
+ - Bash and zsh shell autocompletion for a nice CLI experience, [available completions](#shell-autocompletion):
814
+
815
+ - Options for `dar-backup`, `cleanup`, `manager`
816
+ - Backup definitions
817
+ - Archives - filtered to backup definition if given
818
+ - Catalogs - filtered to backup definition if given
819
+
820
+ - `dar-backup` is easy to install and configure.
821
+
822
+ - ✅ The author has used dar-backup since > 4 years, and has been saved multiple times.
823
+
793
824
  ## License
794
825
 
795
826
  These scripts are licensed under the GPLv3 license.
796
- Read more here: [GNU CPL 3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), or have a look at the ["LICENSE"](https://github.com/per2jensen/dar-backup/blob/main/LICENSE) file in this repository.
827
+ Read more here: [GNU GPL3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), or have a look at the ["LICENSE"](https://github.com/per2jensen/dar-backup/blob/main/LICENSE) file in this repository.
828
+
829
+ ## Quick Guide
830
+
831
+ This purpose of this quick guide is to show how `dar-backup` works in a few simple steps.
832
+
833
+ The package include a `demo`application, that can help you set up `dar-backup` quickly.
834
+
835
+ > ⚠️ **Assumption**
836
+ >
837
+ > The demo program uses these directories in your home directory:
838
+ >
839
+ > - $HOME/dar-backup
840
+ > - $HOME/.config/dar-backup
841
+ >
842
+ > It is assumed they **do not exist** before running the demo.
843
+ >
844
+ > Python **>= 3.9** is required
845
+
846
+ <br>
847
+
848
+ **Let's roll** with installation, backup, list backup content, restore & restore check
849
+
850
+ The demo is known to work on an Ubuntu 24.04 clean VM as delivered from `Multipass`
851
+
852
+ ```bash
853
+ sudo apt -y install dar par2 python3 python3-venv
854
+ INSTALL_DIR=/tmp/dar-backup
855
+ mkdir "$INSTALL_DIR"
856
+ cd "$INSTALL_DIR"
857
+ python3 -m venv venv # create the virtual environment
858
+ . venv/bin/activate # activate the virtual environment
859
+ pip install dar-backup # run pip to install `dar-backup` into the virtual environment
860
+ ```
861
+
862
+ <details>
863
+
864
+ <summary>🎯 Install details</summary>
865
+
866
+ ```bash
867
+ (venv) $ INSTALL_DIR=/tmp/dar-backup
868
+ mkdir "$INSTALL_DIR"
869
+ cd "$INSTALL_DIR"
870
+ python3 -m venv venv # create the virtual environment
871
+ . venv/bin/activate # activate the virtual environment
872
+ pip install dar-backup # run pip to install `dar-backup`
873
+ Collecting dar-backup
874
+ Downloading dar_backup-0.6.21-py3-none-any.whl.metadata (88 kB)
875
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.5/88.5 kB 3.7 MB/s eta 0:00:00
876
+ Collecting argcomplete>=3.6.2 (from dar-backup)
877
+ Using cached argcomplete-3.6.2-py3-none-any.whl.metadata (16 kB)
878
+ Collecting inputimeout>=1.0.4 (from dar-backup)
879
+ Using cached inputimeout-1.0.4-py3-none-any.whl.metadata (2.2 kB)
880
+ Collecting rich>=13.0.0 (from dar-backup)
881
+ Using cached rich-14.0.0-py3-none-any.whl.metadata (18 kB)
882
+ Collecting markdown-it-py>=2.2.0 (from rich>=13.0.0->dar-backup)
883
+ Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
884
+ Collecting pygments<3.0.0,>=2.13.0 (from rich>=13.0.0->dar-backup)
885
+ Using cached pygments-2.19.1-py3-none-any.whl.metadata (2.5 kB)
886
+ Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich>=13.0.0->dar-backup)
887
+ Using cached mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)
888
+ Downloading dar_backup-0.6.21-py3-none-any.whl (101 kB)
889
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 101.9/101.9 kB 16.2 MB/s eta 0:00:00
890
+ Using cached argcomplete-3.6.2-py3-none-any.whl (43 kB)
891
+ Using cached inputimeout-1.0.4-py3-none-any.whl (4.6 kB)
892
+ Using cached rich-14.0.0-py3-none-any.whl (243 kB)
893
+ Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
894
+ Using cached pygments-2.19.1-py3-none-any.whl (1.2 MB)
895
+ Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
896
+ Installing collected packages: pygments, mdurl, inputimeout, argcomplete, markdown-it-py, rich, dar-backup
897
+ Successfully installed argcomplete-3.6.2 dar-backup-0.6.21 inputimeout-1.0.4 markdown-it-py-3.0.0 mdurl-0.1.2 pygments-2.19.1 rich-14.0.0
898
+ ```
899
+
900
+ </details>
901
+
902
+ Setup the demo configurations and show a few operations
903
+
904
+ <br>
905
+
906
+ ```bash
907
+ # see reference section for options tweaking the install
908
+ demo --install
909
+
910
+ # create catalog database
911
+ manager --create-db
912
+
913
+ # do a FULL backup of the installed backup definition called `demo`
914
+ dar-backup --full-backup
915
+
916
+ # list the contents of the backup
917
+ dar-backup --list-contents $(dar-backup --list |tail -n 1 | cut -d " " -f1)
918
+ ```
919
+
920
+ <details>
921
+
922
+ <summary>🎯 --list details</summary>
923
+
924
+ ```bash
925
+ (venv) $ demo --install
926
+ Directories created.
927
+ File generated at '/home/user/.config/dar-backup/backup.d/demo'
928
+ File generated at '/home/user/.config/dar-backup/dar-backup.conf'
929
+ 1. Now run `manager --create-db` to create the catalog database.
930
+ 2. Then you can run `dar-backup --full-backup` to create a backup.
931
+ 3. List backups with `dar-backup --list`
932
+ 4. List contents of a backup with `dar-backup --list-contents <backup-name>`
933
+
934
+
935
+
936
+ (venv) $ manager --create-db
937
+ ========== Startup Settings ==========
938
+ manager.py: 0.7.1
939
+ Config file: /home/user/.config/dar-backup/dar-backup.conf
940
+ Logfile: /home/user/dar-backup/dar-backup.log
941
+ dar_manager: /home/user/.local/dar/bin/dar_manager
942
+ dar_manager v.: 1.9.0
943
+ ======================================
944
+
945
+
946
+
947
+ (venv) $ dar-backup --full-backup
948
+ ========== Startup Settings ==========
949
+ dar-backup.py: 0.7.1
950
+ dar path: /home/user/.local/dar/bin/dar
951
+ dar version: 2.7.17
952
+ Script directory: /home/user/git/dar-backup/v2/src/dar_backup
953
+ Config file: /home/user/.config/dar-backup/dar-backup.conf
954
+ .darrc location: /home/user/git/dar-backup/v2/src/dar_backup/.darrc
955
+ ======================================
956
+
957
+
958
+
959
+ (venv) $ dar-backup --list-contents $(dar-backup --list |tail -n 1 | cut -d " " -f1)
960
+ ========== Startup Settings ==========
961
+ dar-backup.py: 0.7.1
962
+ dar path: /home/user/.local/dar/bin/dar
963
+ dar version: 2.7.17
964
+ Script directory: /home/user/git/dar-backup/v2/src/dar_backup
965
+ Config file: /home/user/.config/dar-backup/dar-backup.conf
966
+ .darrc location: /home/user/git/dar-backup/v2/src/dar_backup/.darrc
967
+ ======================================
968
+ [Saved][-] [-L-][ 49%][ ] drwx------ user user 8 kio Sat May 17 13:13:59 2025 .config
969
+ [Saved][-] [-L-][ 49%][ ] drwxrwxr-x user user 8 kio Tue May 6 20:55:40 2025 .config/dar-backup
970
+ [Saved][-] [-L-][ 48%][ ] drwxrwxr-x user user 6 kio Sat May 17 13:26:21 2025 .config/dar-backup/backup.d
971
+ [Saved][ ] [-L-][ 40%][ ] -rw-rw-r-- user user 764 o Sun Feb 23 21:23:01 2025 .config/dar-backup/backup.d/media-files
972
+ [Saved][ ] [-L-][ 41%][ ] -rw-rw-r-- user user 933 o Sun Feb 23 21:23:15 2025 .config/dar-backup/backup.d/pCloudDrive
973
+ [Saved][ ] [-L-][ 48%][ ] -rw-rw-r-- user user 1 kio Sun Mar 16 10:40:29 2025 .config/dar-backup/backup.d/test
974
+ [Saved][ ] [-L-][ 48%][ ] -rw-rw-r-- user user 824 o Tue May 13 17:00:52 2025 .config/dar-backup/backup.d/default
975
+ [Saved][ ] [-L-][ 48%][ ] -rw-rw-r-- user user 1 kio Sat May 3 10:40:33 2025 .config/dar-backup/backup.d/user-homedir
976
+ [Saved][ ] [-L-][ 54%][ ] -rw-rw-r-- user user 1 kio Sat May 17 18:17:40 2025 .config/dar-backup/backup.d/demo
977
+ [Saved][ ] [-L-][ 55%][ ] -rw-rw-r-- user user 1 kio Sat May 17 18:17:40 2025 .config/dar-backup/dar-backup.conf
978
+ ```
979
+
980
+ </details>
981
+
982
+ <br>
983
+
984
+ Perform a restore and show the restored files
985
+
986
+ ```bash
987
+ # restore all files in the backup
988
+ dar-backup --restore $(dar-backup --list |tail -n 1 | cut -d " " -f1) --verbose
989
+
990
+ # prove the files have been restored to directory as configured
991
+ find $HOME/dar-backup/restore
992
+ ```
993
+
994
+ <details>
995
+
996
+ <summary>🎯 --restore details</summary>
997
+
998
+ ```bash
999
+ (venv) $ dar-backup --verbose --restore $(dar-backup --list |tail -n 1 | cut -d " " -f1)
1000
+ ========== Startup Settings ==========
1001
+ dar-backup.py: 0.7.1
1002
+ dar path: /home/user/.local/dar/bin/dar
1003
+ dar version: 2.7.17
1004
+ Script directory: /home/user/git/dar-backup/v2/src/dar_backup
1005
+ Config file: /home/user/.config/dar-backup/dar-backup.conf
1006
+ .darrc location: /home/user/git/dar-backup/v2/src/dar_backup/.darrc
1007
+ Backup.d dir: /home/user/.config/dar-backup/backup.d
1008
+ Backup dir: /home/user/dar-backup/backups
1009
+ Restore dir: /home/user/dar-backup/restore
1010
+ Logfile location: /home/user/dar-backup/dar-backup.log
1011
+ PAR2 enabled: True
1012
+ --do-not-compare: False
1013
+ ======================================
1014
+
1015
+
1016
+
1017
+ (venv) $ find ~/dar-backup/restore/
1018
+ /home/user/dar-backup/restore/
1019
+ /home/user/dar-backup/restore/.config
1020
+ /home/user/dar-backup/restore/.config/dar-backup
1021
+ /home/user/dar-backup/restore/.config/dar-backup/backup.d
1022
+ /home/user/dar-backup/restore/.config/dar-backup/backup.d/media-files
1023
+ /home/user/dar-backup/restore/.config/dar-backup/backup.d/pCloudDrive
1024
+ /home/user/dar-backup/restore/.config/dar-backup/backup.d/test
1025
+ /home/user/dar-backup/restore/.config/dar-backup/backup.d/default
1026
+ /home/user/dar-backup/restore/.config/dar-backup/backup.d/user-homedir
1027
+ /home/user/dar-backup/restore/.config/dar-backup/backup.d/demo
1028
+ /home/user/dar-backup/restore/.config/dar-backup/dar-backup.conf
1029
+ ```
1030
+
1031
+ </details>
1032
+
1033
+ <br>
1034
+
1035
+ > ✅ **Next steps**
1036
+ >
1037
+ > Tinker with `demo's` options:
1038
+ >
1039
+ > - --root-dir (perhaps $HOME)
1040
+ > - --dir-to-backup (perhaps Pictures)
1041
+ > - --backup-dir (perhaps /media/user/big-disk)
1042
+ >
1043
+ > See log file: `cat "$HOME/dar-backup/dar-backup.log"`
1044
+ >
1045
+ > Checkout [systemd timers and services](#generate-systemd-files)
1046
+ >
1047
+ > Checkout [shell autocompletion (very nice !)](#shell-autocompletion)
1048
+ >
1049
+ > Checkout the [reference section](#reference)
797
1050
 
798
1051
  ## Status
799
1052
 
@@ -805,9 +1058,13 @@ As of February 13, 2025, I have changed the status from alpha --> beta, as the f
805
1058
 
806
1059
  To increase the security and authenticity of dar-backup packages, all releases from v2-beta-0.6.18 onwards will be digitally signed using the GPG key below.
807
1060
 
808
- 🔐 GPG Signing Key Details
1061
+ <br>
809
1062
 
810
- ```` text
1063
+ <details>
1064
+
1065
+ <summary>🎯 GPG Signing Key Details</summary>
1066
+
1067
+ ```text
811
1068
  Name: Per Jensen (author of dar-backup)
812
1069
  Email: dar-backup@pm.me
813
1070
  Primary key: 4592 D739 6DBA EFFD 0845 02B8 5CCE C7E1 6814 A36E
@@ -816,9 +1073,13 @@ Created: 2025-03-29
816
1073
  Expires: 2030-03-28
817
1074
  Key type: ed25519 (primary, SC)
818
1075
  Subkeys: ed25519 (S), ed25519 (A), cv25519 (E)
819
- ````
1076
+ ```
820
1077
 
821
- 🔏 Where to Find Release Signatures
1078
+ <br>
1079
+
1080
+ <details>
1081
+
1082
+ <summary>🎯 Where to Find Release Signatures</summary>
822
1083
 
823
1084
  PyPI does *Not* host .asc Signature Files
824
1085
 
@@ -826,7 +1087,7 @@ Although the `dar-backup` packages on PyPI are GPG-signed, PyPI itself does **no
826
1087
 
827
1088
  Therefore, you will not find `.asc` files on PyPI.
828
1089
 
829
- Where to Get `.asc` Signature Files
1090
+ **Where to Get `.asc` Signature Files**
830
1091
 
831
1092
  You can always download the signed release artifacts and their `.asc` files from the official GitHub Releases page:
832
1093
 
@@ -842,43 +1103,55 @@ Each release includes:
842
1103
 
843
1104
  - `dar_backup-x.y.z-py3-none-any.whl.asc`
844
1105
 
845
- 🔐 How to Verify a Release from GitHub
1106
+ </details>
1107
+
1108
+ <br>
1109
+
1110
+ <details>
1111
+
1112
+ <summary>🎯 How to Verify a Release from GitHub</summary>
846
1113
 
847
1114
  1. Import the GPG public key:
848
1115
 
849
- ```` bash
1116
+ ```bash
850
1117
  curl https://keys.openpgp.org/vks/v1/by-fingerprint/4592D7396DBAEFFD084502B85CCEC7E16814A36E | gpg --import
851
- ````
1118
+ ```
852
1119
 
853
1120
  2. Download the wheel or tarball and its .asc signature from the GitHub.
854
1121
 
855
1122
  3. Run GPG to verify it:
856
1123
 
857
- ```` bash
1124
+ ```bash
858
1125
  gpg --verify dar_backup-x.y.z.tar.gz.asc dar_backup-x.y.z.tar.gz
859
1126
  # or
860
1127
  gpg --verify dar_backup-x.y.z-py3-none-any.whl.asc dar_backup-x.y.z-py3-none-any.whl
861
- ````
1128
+ ```
862
1129
 
863
1130
  4. If the signature is valid, you'll see:
864
1131
 
865
- ```` text
1132
+ ```text
866
1133
  gpg: Good signature from "Per Jensen (author of dar-backup) <dar-backup@pm.me>"
867
- ````
1134
+ ```
868
1135
 
869
1136
  🛡️ Reminder: Verify the signing subkey
870
1137
 
871
1138
  Only this subkey is used to sign PyPI packages:
872
1139
 
873
- ```` text
1140
+ ```text
874
1141
  B54F 5682 F28D BA36 22D7 8E04 58DB FADB BBAC 1BB1
875
- ````
1142
+ ```
876
1143
 
877
1144
  You can view it with:
878
1145
 
879
- ```` bash
1146
+ ```bash
880
1147
  gpg --list-keys --with-subkey-fingerprints dar-backup@pm.me
881
- ````
1148
+ ```
1149
+
1150
+ </details>
1151
+
1152
+ </details>
1153
+
1154
+ <br>
882
1155
 
883
1156
  ### Breaking change in version 0.6.0
884
1157
 
@@ -890,17 +1163,22 @@ Version 0.6.0 and forwards requires the config variable *COMMAND_TIMEOUT_SECS* i
890
1163
 
891
1164
  This python version is v2 of dar-backup, v1 is made in bash.
892
1165
 
1166
+ ## Community
1167
+
1168
+ Please review the [Code of Conduct](https://github.com/per2jensen/dar-backup/blob/main/CODE_OF_CONDUCT.md) to help keep this project welcoming and focused.
1169
+
893
1170
  ## Requirements
894
1171
 
895
1172
  - dar
896
1173
  - par2
897
1174
  - python3
1175
+ - python3-venv
898
1176
 
899
1177
  On Ubuntu, install the requirements this way:
900
1178
 
901
- ```` bash
902
- sudo apt install dar par2 python3
903
- ````
1179
+ ```bash
1180
+ sudo apt install dar par2 python3 python3-venv
1181
+ ```
904
1182
 
905
1183
  ## dar-backup principles
906
1184
 
@@ -945,58 +1223,72 @@ See more [here](#gpg-signing-key).
945
1223
 
946
1224
  ### 1 - installation
947
1225
 
948
- Installation is currently in a venv. These commands are installed in the venv:
1226
+ Installation is currently in a [virtual environment](https://csguide.cs.princeton.edu/software/virtualenv) (commonly called a `venv`). These commands are installed in the venv:
949
1227
 
950
1228
  - dar-back
951
1229
  - cleanup
952
1230
  - manager
953
1231
  - clean-log
1232
+ - dar-backup-systemd
954
1233
  - installer
1234
+ - demo
955
1235
 
956
1236
  Note:
957
1237
 
958
- The module `inputimeout` is installed into the venv and used for the confirmation input (with a 30 second timeout)
1238
+ The modules `inputimeout`, `rich`and `argcomplete` are installed into the venv and used by `dar-backup`
959
1239
 
960
- To install, create a venv and run pip:
1240
+ To install `dar-backup`, create a venv and run pip:
961
1241
 
962
- ```` bash
1242
+ ```bash
963
1243
  mkdir $HOME/tmp
964
1244
  cd $HOME/tmp
965
1245
  python3 -m venv venv # create the virtual environment
966
- . venv/bin/activate # activate the virtual env
1246
+ . venv/bin/activate # activate the virtual environment
967
1247
  pip install dar-backup # run pip to install `dar-backup`
968
- ````
1248
+ ```
969
1249
 
970
1250
  I have an alias in ~/.bashrc pointing to my venv:
971
1251
 
972
- ```` bash
1252
+ ```bash
973
1253
  alias db=". ~/tmp/venv/bin/activate; dar-backup -v"
974
- ````
1254
+ ```
975
1255
 
976
- Typing `db` at the command line gives this
1256
+ drop the alias into ~/.bashrc like this:
977
1257
 
978
- ```` bash
1258
+ ```bash
1259
+ grep -qxF 'alias db="' ~/.bashrc \
1260
+ || echo 'alias db=". ~/tmp/venv/bin/activate; dar-backup -v"' >> ~/.bashrc
1261
+
1262
+ source ~/.bashrc
1263
+ ```
1264
+
1265
+ Typing `db` at the command line gives something like this:
1266
+
1267
+ ```bash
979
1268
  (venv) user@machine:~$ db
980
1269
  dar-backup 0.6.12
981
1270
  dar-backup.py source code is here: https://github.com/per2jensen/dar-backup
982
1271
  Licensed under GNU GENERAL PUBLIC LICENSE v3, see the supplied file "LICENSE" for details.
983
1272
  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
984
1273
  See section 15 and section 16 in the supplied "LICENSE" file.
985
- ````
1274
+ ```
986
1275
 
987
1276
  ### 2 - configuration
988
1277
 
989
- The dar-backup installer is non-destructive and stops if some of the default directories exist.
1278
+ The dar-backup [demo](#demo-options) application can be used to demo how `dar-backup` works.
1279
+ It creates some directories, installs a demo configuration file and puts a demo backup definition in place.
990
1280
 
991
- Run the installer
1281
+ `demo` is non-destructive and stops if some of the default directories exist.
992
1282
 
993
- ```` bash
994
- installer --install
995
- ````
1283
+ Run `demo`
1284
+
1285
+ ```bash
1286
+ demo --install
1287
+ ```
996
1288
 
997
1289
  The output is
998
1290
 
999
- ```` text
1291
+ ```text
1000
1292
  Directories created: `/home/user/dar-backup/` and `/home/user/.config/dar-backup`
1001
1293
  Config file deployed to /home/user/.config/dar-backup/dar-backup.conf
1002
1294
  Default backup definition deployed to /home/user/.config/dar-backup/backup.d/default
@@ -1004,7 +1296,7 @@ Default backup definition deployed to /home/user/.config/dar-backup/backup.d/def
1004
1296
  2. Then you can run `dar-backup --full-backup` to create a backup.
1005
1297
  3. List backups with `dar-backup --list`
1006
1298
  4. List contents of a backup with `dar-backup --list-contents <backup-name>`
1007
- ````
1299
+ ```
1008
1300
 
1009
1301
  ### 3 - generate catalog databases
1010
1302
 
@@ -1012,38 +1304,48 @@ Generate the archive catalog database(s).
1012
1304
 
1013
1305
  `dar-backup` expects the catalog databases to be in place, it does not automatically create them (by design)
1014
1306
 
1015
- ```` bash
1307
+ ```bash
1016
1308
  manager --create-db
1017
- ````
1309
+ ```
1018
1310
 
1019
- ### 4 - do FULL backups
1311
+ ### 4 - give dar-backup a spin
1020
1312
 
1021
- Prereq:
1022
- [Backup definitions](#backup-definition-example) are in place in BACKUP.D_DIR (see [config file](#config-file)).
1313
+ The `demo` application has put a demo [backup definition](#backup-definition-example) in place in BACKUP.D_DIR (see [config file](#config-file)).
1023
1314
 
1024
- You are ready to do backups of all your backup definitions.
1315
+ You are now ready to do backups as configured in the backup definition.
1025
1316
 
1026
- ```` bash
1027
- dar-backup --full-backup
1028
- ````
1317
+ Give `dar-backup`a spin:
1318
+
1319
+ ```bash
1320
+ dar-backup --full-backup --verbose
1321
+
1322
+ # list backups
1323
+ dar-backup --list
1324
+
1325
+ # see some examples on usage
1326
+ dar-backup --examples
1327
+
1328
+ # see the log file
1329
+ cat "$HOME/dar-backup/dar-backup.log"
1330
+ ```
1029
1331
 
1030
- If you want to see dar-backup's log entries in the terminal, use the `--log-stdout` option. This can be useful if dar-backup is started by systemd.
1332
+ If you want to see dar-backup's log entries in the terminal, use the `--log-stdout` option.
1031
1333
 
1032
1334
  If you want more log messages, use the `--verbose` or `--log-level debug` for even more.
1033
1335
 
1034
- If you want a backup of a single definition, use the `-d <backup definition>` option. The definition's name is the filename of the definition in the `backup.d` config directory.
1336
+ If you want to take a backup using a single backup definition, use the `-d <backup definition>` option. The backup definition's name is the filename of the definition in the BACKUP.D_DIR (see [config file](#config-file)).
1035
1337
 
1036
- ```` bash
1338
+ ```bash
1037
1339
  dar-backup --full-backup -d <your backup definition>
1038
- ````
1340
+ ```
1039
1341
 
1040
1342
  ### 5 - deactivate venv
1041
1343
 
1042
- Deactivate the virtual environment (venv)
1344
+ Deactivate the virtual environment (venv).
1043
1345
 
1044
- ```` bash
1346
+ ```bash
1045
1347
  deactivate
1046
- ````
1348
+ ```
1047
1349
 
1048
1350
  ## Config
1049
1351
 
@@ -1055,7 +1357,7 @@ If you have your config file somewhere else, use the `--config` option to point
1055
1357
 
1056
1358
  Tilde `~` and environment variables can be used in the paths for various file locations.
1057
1359
 
1058
- ```` code
1360
+ ```text
1059
1361
  [MISC]
1060
1362
  LOGFILE_LOCATION=~/.dar-backup.log
1061
1363
  MAX_SIZE_VERIFICATION_MB = 20
@@ -1070,6 +1372,9 @@ COMMAND_TIMEOUT_SECS = 86400
1070
1372
  BACKUP_DIR = /some/where/dar-backup/backups/
1071
1373
  BACKUP.D_DIR = /some/where/dar-backup/backup.d
1072
1374
  TEST_RESTORE_DIR = /tmp/dar-backup/restore/
1375
+ # Optional parameter
1376
+ # If you want to store the catalog databases away from the BACKUP_DIR, use the MANAGER_DB_DIR variable.
1377
+ #MANAGER_DB_DIR = /some/where/else/
1073
1378
 
1074
1379
  [AGE]
1075
1380
  # age settings are in days
@@ -1088,7 +1393,7 @@ SCRIPT_1 = ls -l /tmp
1088
1393
  [POSTREQ]
1089
1394
  SCRIPT_1 = df -h
1090
1395
  #SCRIPT_2 = another_script.sh
1091
- ````
1396
+ ```
1092
1397
 
1093
1398
  ### .darrc
1094
1399
 
@@ -1098,7 +1403,7 @@ You can override the default `.darrc` using the `--darrc` option.
1098
1403
 
1099
1404
  The default `.darrc` contents are as follows:
1100
1405
 
1101
- ```` code
1406
+ ```text
1102
1407
  # .darrc configuration file for `dar` as used by the `dar-backup` script.
1103
1408
  # `dar-backup` lives here: https://github.com/per2jensen/dar-backup
1104
1409
 
@@ -1219,7 +1524,7 @@ compress-exclusion:
1219
1524
  # Now we swap back to case sensitive mode for masks which is the default
1220
1525
  #mode:
1221
1526
  -acase
1222
- ````
1527
+ ```
1223
1528
 
1224
1529
  ### Backup definition example
1225
1530
 
@@ -1228,7 +1533,7 @@ The name of the file is the name of the backup definition.
1228
1533
 
1229
1534
  You can use as many backup definitions as you need.
1230
1535
 
1231
- ```` code
1536
+ ```text
1232
1537
  # Switch to ordered selection mode, which means that the following
1233
1538
  # options will be considered top to bottom
1234
1539
  -am
@@ -1262,7 +1567,7 @@ You can use as many backup definitions as you need.
1262
1567
  # http://dar.linux.free.fr/doc/Features.html
1263
1568
  # https://bford.info/cachedir/
1264
1569
  --cache-directory-tagging
1265
- ````
1570
+ ```
1266
1571
 
1267
1572
  ## Generate systemd files
1268
1573
 
@@ -1272,7 +1577,7 @@ The timers are set as the author uses them, modify to your taste and needs.
1272
1577
 
1273
1578
  Example run:
1274
1579
 
1275
- ```` bash
1580
+ ```bash
1276
1581
  dar-backup-systemd --venv /home/user/tmp/venv --dar-path /home/user/.local/dar/bin
1277
1582
  Generated dar-full-backup.service and dar-full-backup.timer
1278
1583
  → Fires on: *-12-30 10:03:00
@@ -1282,7 +1587,7 @@ Generated dar-incr-backup.service and dar-incr-backup.timer
1282
1587
  → Fires on: *-*-04/3 19:03:00
1283
1588
  Generated dar-clean.service and dar-clean.timer
1284
1589
  → Fires on: *-*-* 21:07:00
1285
- ````
1590
+ ```
1286
1591
 
1287
1592
  ## Systemctl examples
1288
1593
 
@@ -1300,17 +1605,17 @@ systemctl --user daemon-reload
1300
1605
 
1301
1606
  Verify your timers are set up as you want:
1302
1607
 
1303
- ```` bash
1608
+ ```bash
1304
1609
  systemctl --user list-timers
1305
- ````
1610
+ ```
1306
1611
 
1307
1612
  ## Service: dar-backup --incremental-backup
1308
1613
 
1309
- This is an exmaple of a systemd user service unit.
1614
+ This is an example of a systemd user service unit.
1310
1615
 
1311
1616
  File: dar-incr-backup.service
1312
1617
 
1313
- ```` bash
1618
+ ```bash
1314
1619
  /tmp/test$ dar-backup-systemd --venv '$HOME/programmer/dar-backup.py/venv' --dar-path '$HOME/.local/dar/bin'
1315
1620
 
1316
1621
  Generated dar-full-backup.service and dar-full-backup.timer
@@ -1336,7 +1641,7 @@ RemainAfterExit=no
1336
1641
 
1337
1642
 
1338
1643
  ExecStart=/bin/bash -c 'PATH=$HOME/.local/dar/bin:$PATH && . $HOME/programmer/dar-backup.py/venv/bin/activate && dar-backup -I --verbose --log-stdout'
1339
- ````
1644
+ ```
1340
1645
 
1341
1646
  ## Timer: dar-backup --incremental-backup
1342
1647
 
@@ -1344,7 +1649,7 @@ This is an example of a systemd user timer
1344
1649
 
1345
1650
  File: dar-incr-backup.timer
1346
1651
 
1347
- ```` code
1652
+ ```text
1348
1653
  [Unit]
1349
1654
  Description=dar-backup INCR timer
1350
1655
 
@@ -1354,7 +1659,7 @@ Persistent=true
1354
1659
 
1355
1660
  [Install]
1356
1661
  WantedBy=timers.target
1357
- ````
1662
+ ```
1358
1663
 
1359
1664
  ## systemd timer note
1360
1665
 
@@ -1362,118 +1667,94 @@ WantedBy=timers.target
1362
1667
 
1363
1668
  ## list contents of an archive
1364
1669
 
1365
- ```` bash
1366
- . <the virtual evn>/bin/activate
1367
- dar-backup --list-contents example_FULL_2024-06-23 --selection "-X '*.xmp' -I '*2024-06-16*' -g home/pj/tmp/LUT-play"
1670
+ ```bash
1671
+ # Activate your virtual environment
1672
+ source <the virtual evn>/bin/activate
1673
+ dar-backup --list-contents media-files_INCR_2025-05-10
1674
+ # Deactivate when done
1368
1675
  deactivate
1369
- ````
1370
-
1371
- gives
1676
+ ```
1372
1677
 
1373
- ``` code
1374
- [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
1375
- --------------------------------+------------+-------+-------+---------+-------------------------------+------------
1376
- [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
1377
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 home/pj
1378
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 home/pj/tmp
1379
- [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Wed Jun 19 20:52:13 2024 home/pj/tmp/LUT-play
1380
- [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
1678
+ gives something like
1679
+
1680
+ ```text
1681
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Sat May 10 14:15:07 2025 home/user
1682
+ [Saved][ ] [-L-][ 93%][ ] -rw-rw-r-- user user 29 kio Fri May 9 16:45:38 2025 home/user/data/2023/2023-02-11-Udstilling-Fredericia/DSC_0568.NEF.xmp
1683
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Fri May 9 12:49:04 2025 home/user/data/2025
1684
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x user user 193 Mio Thu May 8 15:59:17 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR
1685
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 15 Mio Thu May 8 15:52:27 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0563.NEF
1686
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 10 Mio Thu May 8 15:52:27 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0563.JPG
1687
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 9 Mio Thu May 8 15:51:53 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0559.JPG
1688
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 16 Mio Thu May 8 15:51:45 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0558.NEF
1689
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 12 Mio Thu May 8 15:51:45 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0558.JPG
1690
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 16 Mio Thu May 8 15:51:24 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.NEF
1691
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 12 Mio Thu May 8 15:51:23 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.JPG
1692
+ [Saved][ ] [-L-][ 91%][ ] -rw-rw-r-- user user 22 kio Thu May 8 15:59:58 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.JPG.xmp
1693
+ [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- user user 30 kio Thu May 8 16:00:36 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0557.NEF.xmp
1694
+ [Saved][ ] [-L-][ 91%][ ] -rw-rw-r-- user user 22 kio Thu May 8 16:00:29 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR/DSC_0558.JPG.xmp
1381
1695
  ```
1382
1696
 
1383
1697
  ## dar file selection examples
1384
1698
 
1385
- ### select a directory
1699
+ > ⚠️ **Quoting matters**
1700
+ >
1701
+ > Always pass `--selection` as `--selection="-I '*.NEF'"` to ensure it’s treated as a single argument.
1702
+ >
1703
+ > Avoid splitting `--selection` and the string into separate tokens.
1386
1704
 
1387
- ``` bash
1388
- dar -l /tmp/example_FULL_2024-06-23 -g home/pj/tmp/LUT-play
1389
- ```
1705
+ **Why does --selection give “expected one argument” error?**
1390
1706
 
1391
- gives
1707
+ This happens when the shell splits the quoted string or interprets globs before `dar-backup` sees them.
1708
+ ✅ Use: `--selection="-I '*.NEF'"`
1709
+ ❌ Avoid: `--selection "-I '*.NEF'"`
1392
1710
 
1393
- ```` code
1394
- [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
1395
- --------------------------------+------------+-------+-------+---------+-------------------------------+------------
1396
- [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
1397
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 home/pj
1398
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 home/pj/tmp
1399
- [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Wed Jun 19 20:52:13 2024 home/pj/tmp/LUT-play
1400
- [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
1401
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 48 kio Sat Jun 22 21:51:24 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF.xmp
1402
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 50 kio Sat Jun 22 21:51:25 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_01.NEF.xmp
1403
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:26 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_02.NEF.xmp
1404
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_03.NEF.xmp
1405
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_04.NEF.xmp
1406
- [Saved][ ] [-L-][ 97%][ ] -rw-rw-r-- pj pj 77 kio Sat Jun 22 21:50:16 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_05.NEF.xmp
1407
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 52 kio Sat Jun 22 21:49:37 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_06.NEF.xmp
1408
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:47 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_07.NEF.xmp
1409
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_08.NEF.xmp
1410
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_09.NEF.xmp
1411
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:39 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_10.NEF.xmp
1412
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:36 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_11.NEF.xmp
1413
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:35 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_12.NEF.xmp
1414
- [Saved][ ] [-L-][ 88%][ ] -rw-rw-r-- pj pj 15 kio Sat Jun 22 21:51:11 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_13.NEF.xmp
1415
- [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 84 kio Sat Jun 22 21:51:09 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_14.NEF.xmp
1416
- [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 90 kio Sat Jun 22 21:51:04 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_15.NEF.xmp
1417
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:15 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_16.NEF.xmp
1418
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:48 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_17.NEF.xmp
1419
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:19 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_18.NEF.xmp
1420
- ````
1711
+ > 💡 **Tip:** See [dar's documentation](http://dar.linux.free.fr/doc/man/dar.html#COMMANDS%20AND%20OPTIONS)
1712
+
1713
+ ### select a directory
1421
1714
 
1422
- ### select file dates in the directory
1715
+ Select files and sub directories in `home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling`
1423
1716
 
1424
- ``` bash
1425
- dar -l /tmp/example_FULL_2024-06-23 -I '*2024-06-16*' -g home/pj/tmp/LUT-play
1717
+ ```bash
1718
+ dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-g 'home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling'"
1426
1719
  ```
1427
1720
 
1428
1721
  gives
1429
1722
 
1430
- ``` code
1431
- [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
1432
- --------------------------------+------------+-------+-------+---------+-------------------------------+------------
1433
- [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
1434
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 home/pj
1435
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 home/pj/tmp
1436
- [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Sed Jun 19 20:52:13 2024 home/pj/tmp/LUT-play
1437
- [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
1438
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 48 kio Sat Jun 22 21:51:24 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF.xmp
1439
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 50 kio Sat Jun 22 21:51:25 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_01.NEF.xmp
1440
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:26 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_02.NEF.xmp
1441
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_03.NEF.xmp
1442
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 51 kio Sat Jun 22 21:51:27 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_04.NEF.xmp
1443
- [Saved][ ] [-L-][ 97%][ ] -rw-rw-r-- pj pj 77 kio Sat Jun 22 21:50:16 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_05.NEF.xmp
1444
- [Saved][ ] [-L-][ 95%][ ] -rw-rw-r-- pj pj 52 kio Sat Jun 22 21:49:37 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_06.NEF.xmp
1445
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:47 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_07.NEF.xmp
1446
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_08.NEF.xmp
1447
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:12 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_09.NEF.xmp
1448
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:39 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_10.NEF.xmp
1449
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:36 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_11.NEF.xmp
1450
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:35 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_12.NEF.xmp
1451
- [Saved][ ] [-L-][ 88%][ ] -rw-rw-r-- pj pj 15 kio Sat Jun 22 21:51:11 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_13.NEF.xmp
1452
- [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 84 kio Sat Jun 22 21:51:09 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_14.NEF.xmp
1453
- [Saved][ ] [-L-][ 96%][ ] -rw-rw-r-- pj pj 90 kio Sat Jun 22 21:51:04 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_15.NEF.xmp
1454
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:51:15 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_16.NEF.xmp
1455
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:48 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_17.NEF.xmp
1456
- [Saved][ ] [-L-][ 92%][ ] -rw-rw-r-- pj pj 24 kio Sat Jun 22 21:50:19 2024 home/pj/tmp/LUT-play/2024-06-16_12:52:22,15_18.NEF.xmp
1723
+ ```text
1724
+ ...
1725
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 29 Mio Fri May 9 10:33:42 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0572.NEF
1726
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 28 Mio Fri May 9 10:33:12 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0571.NEF
1727
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 25 Mio Fri May 9 10:33:08 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0570.NEF
1728
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 27 Mio Fri May 9 10:32:46 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0569.NEF
1729
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 27 Mio Fri May 9 10:32:46 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0568.NEF
1730
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x user user 833 Mio Fri May 9 12:49:57 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg
1731
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 11 Mio Fri May 9 10:32:45 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0568.JPG
1732
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 11 Mio Fri May 9 10:32:46 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0569.JPG
1733
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 9 Mio Fri May 9 10:33:08 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0570.JPG
1734
+ [Saved][ ] [-L-][ 1%][X] -rw-rw-r-- user user 13 Mio Fri May 9 10:33:12 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/jpeg/Z50_0571.JPG
1735
+ ...
1457
1736
  ```
1458
1737
 
1459
- ### exclude .xmp files from that date
1460
-
1461
- ``` bash
1462
- dar -l /tmp/example_FULL_2024-06-23 -X '*.xmp' -I '*2024-06-16*' -g home/pj/tmp/LUT-play
1738
+ ### select files with "Z50" in the file name and exclude .xmp files
1463
1739
 
1740
+ ```bash
1741
+ dar-backup --list-contents media-files_INCR_2025-05-10 --selection="-I '*Z50*' -X '*.xmp'"
1464
1742
  ```
1465
1743
 
1466
- gives
1467
-
1468
- ```` code
1469
- [Data ][D][ EA ][FSA][Compr][S]| Permission | User | Group | Size | Date | filename
1470
- --------------------------------+------------+-------+-------+---------+-------------------------------+------------
1471
- [Saved][-] [-L-][ 0%][ ] drwxr-xr-x root root 113 Mio Sat May 11 16:16:48 2024 home
1472
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 10:46:30 2024 ome/pj
1473
- [Saved][-] [-L-][ 0%][ ] drwxrwxr-x pj pj 113 Mio Sun Jun 23 09:17:42 2024 ome/pj/tmp
1474
- [Saved][-] [-L-][ 1%][ ] drwxrwxr-x pj pj 50 Mio Wed Jun 19 20:52:13 2024 ` ome/pj/tmp/LUT-play
1475
- [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- pj pj 49 Mio Sun Jun 16 12:52:22 2024 ` home/pj/tmp/LUT-play/2024-06-16_12:52:22,15.NEF
1476
- ````
1744
+ gives something like
1745
+
1746
+ ```text
1747
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Sat May 10 14:15:07 2025 home/user
1748
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Fri May 9 12:49:04 2025 home/user/data/2025
1749
+ [Saved][-] [-L-][ 1%][ ] drwxrwxr-x user user 193 Mio Thu May 8 15:59:17 2025 home/user/data/2025/2025-05-09-Viltrox-25mm-AIR
1750
+ [Saved][-] [-L-][ 0%][ ] drwxrwxr-x user user 2 Gio Fri May 9 16:47:37 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling
1751
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 26 Mio Fri May 9 11:26:16 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0633.NEF
1752
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 26 Mio Fri May 9 11:26:16 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0632.NEF
1753
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 28 Mio Fri May 9 11:09:04 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0631.NEF
1754
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 29 Mio Fri May 9 11:09:03 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0630.NEF
1755
+ [Saved][ ] [-L-][ 0%][X] -rw-rw-r-- user user 29 Mio Fri May 9 11:09:03 2025 home/user/data/2025/2025-05-09-Roskilde-Nordisk-udstilling/Z50_0629.NEF
1756
+ ...
1757
+ ```
1477
1758
 
1478
1759
  ## Restoring
1479
1760
 
@@ -1493,7 +1774,7 @@ The directory supplied functions as the Root of the restore operation.
1493
1774
 
1494
1775
  A backup has been taken using this backup definition:
1495
1776
 
1496
- ``` code
1777
+ ```text
1497
1778
  -R /
1498
1779
  -g home/user/Documents
1499
1780
  ```
@@ -1502,34 +1783,41 @@ When restoring and using `/tmp` for --restore-dir, the restored files can be fou
1502
1783
 
1503
1784
  ### a single file
1504
1785
 
1505
- ``` code
1786
+ ```bash
1506
1787
  . <the virtual env>/bin/activate
1507
- dar-backup --restore <archive_name> --selection "-g path/to/file"
1788
+ dar-backup --restore <archive_name> --selection="-g path/to/file"
1508
1789
  deactivate
1509
-
1510
1790
  ```
1511
1791
 
1512
1792
  ### a directory
1513
1793
 
1514
- ``` bash
1794
+ ```bash
1515
1795
  . <the virtual env>/bin/activate
1516
- dar-backup --restore <archive_name> --selection "-g path/to/directory"
1796
+ dar-backup --restore <archive_name> --selection="-g path/to/directory"
1517
1797
  deactivate
1518
1798
  ```
1519
1799
 
1520
1800
  ### .NEF from a specific date
1521
1801
 
1522
- ``` bash
1802
+ The backed up directory contains \*.NEF and \*.xmp files.
1803
+
1804
+ Filtering:
1805
+
1806
+ - Include files with "2024-06-16" in file name
1807
+ - Exclude files with file names ending in ".xmp"
1808
+ - Files must be in directory "home/user/tmp/LUT-play", compared to the file root (`-R`option) in the backup.
1809
+
1810
+ ```bash
1523
1811
  . <the virtual env>/bin/activate
1524
- dar-backup --restore <archive_name> --selection "-X '*.xmp' -I '*2024-06-16*' -g home/pj/tmp/LUT-play"
1812
+ dar-backup --restore <archive_name> --selection="-I '*2024-06-16*' -X '*.xmp' -g home/user/tmp/LUT-play"
1525
1813
  deactivate
1526
1814
  ```
1527
1815
 
1528
1816
  ### restore test fails with exit code 4
1529
1817
 
1530
- "dar" in newer versions emits a question about file ownership, which is "answered" with a "no" via the "-Q" option. That in turn leads to an error code 4.
1818
+ `dar` in newer versions emits a question about file ownership, which is "answered" with a "no" via the "-Q" option. That in turn leads to an error code 4.
1531
1819
 
1532
- Thus the dar option "--comparison-field=ignore-owner" has been placed in the supplied [.darrc](#darrc) file (located in the virtual environment where dar-backup is installed).
1820
+ Thus the dar option `--comparison-field=ignore-owner` has been placed in the supplied [.darrc](#darrc) file (located in the virtual environment where dar-backup is installed).
1533
1821
 
1534
1822
  This causes dar to restore without an error.
1535
1823
 
@@ -1542,7 +1830,7 @@ If exit code 5 is emitted on the restore test, FSA (File System specific Attribu
1542
1830
  That (might) occur if you backup a file stored on one type of filesystem, and restore it on another type.
1543
1831
  My home directory is on a btrfs filesystem, while /tmp (for the restore test) is on zfs.
1544
1832
 
1545
- The restore test can result in an exit code 5, due to the different filesystems used. In order to avoid the errors, the "option "--fsa-scope none" can be used. That will restult in FSA's not being restored.
1833
+ The restore test can result in an exit code 5, due to the different filesystems used. In order to avoid the errors, the option `--fsa-scope none` can be used. That will restult in FSA's not being restored.
1546
1834
 
1547
1835
  If you need to use this option, un-comment it in the [.darrc](#darrc) file (located in the virtual environment where dar-backup is installed)
1548
1836
 
@@ -1552,28 +1840,28 @@ If you need to use this option, un-comment it in the [.darrc](#darrc) file (loca
1552
1840
 
1553
1841
  You can run a par2 verification on an archive like this:
1554
1842
 
1555
- ```` bash
1843
+ ```bash
1556
1844
  for file in <archive>*.dar.par2; do
1557
1845
  par2 verify "$file"
1558
1846
  done
1559
- ````
1847
+ ```
1560
1848
 
1561
1849
  if there are problems with a slice, try to repair it like this:
1562
1850
 
1563
- ```` bash
1851
+ ```bash
1564
1852
  par2 repair <archive>.<slice number>.dar.par2
1565
- ````
1853
+ ```
1566
1854
 
1567
1855
  ### Par2 create redundancy files
1568
1856
 
1569
1857
  If you have merged archives, you will need to create the .par2 redundency files manually.
1570
1858
  Here is an example
1571
1859
 
1572
- ```` bash
1860
+ ```bash
1573
1861
  for file in <some-archive>_FULL_yyyy-mm-dd.*; do
1574
1862
  par2 c -r5 -n1 "$file"
1575
1863
  done
1576
- ````
1864
+ ```
1577
1865
 
1578
1866
  where "c" is create, -r5 is 5% redundency and -n1 is 1 redundency file
1579
1867
 
@@ -1586,18 +1874,17 @@ One way to do that, is to let dar create a FULL archive from scratch, another is
1586
1874
 
1587
1875
  I do backups of my homedir. Here it is shown how a FULL archive is merged with a DIFF, creating a new FULL archive.
1588
1876
 
1589
- ```` bash
1590
- dar --merge pj-homedir_FULL_2021-09-12 -A pj-homedir_FULL_2021-06-06 -@pj-homedir_DIFF_2021-08-29 -s 12G
1877
+ ```bash
1878
+ dar --merge user-homedir_FULL_2021-09-12 -A user-homedir_FULL_2021-06-06 -@user-homedir_DIFF_2021-08-29 -s 12G
1591
1879
 
1592
1880
  # test the new FULL archive
1593
- dar -t pj-homedir_FULL_2021-09-12
1881
+ dar -t user-homedir_FULL_2021-09-12
1594
1882
 
1595
1883
  # create Par2 redundancy files
1596
- for file in pj-homedir_FULL_yyyy-mm-dd.*.dar; do
1884
+ for file in user-homedir_FULL_yyyy-mm-dd.*.dar; do
1597
1885
  par2 c -r5 -n1 "$file"
1598
1886
  done
1599
-
1600
- ````
1887
+ ```
1601
1888
 
1602
1889
  ### dar manager databases
1603
1890
 
@@ -1645,8 +1932,144 @@ dar-backup displays 2 visual artifacts to show progress.
1645
1932
 
1646
1933
  The indicators are not shown if dar-backup is run from systemd or if it is used in terminal multiplexers like `tmux` or `screen`. So no polluting of journald logs.
1647
1934
 
1935
+ ### Shell autocompletion
1936
+
1937
+ The `dar-backup`, `manager`, and `cleanup` scripts now support dynamic Bash tab-completion, making them easier and faster to use.
1938
+
1939
+ ✅ Features
1940
+
1941
+ - Autocomplete for all long options (--config-file, --restore, etc.)
1942
+
1943
+ - Dynamic suggestions based on your config:
1944
+
1945
+ - --backup-definition shows available definitions from backup.d/
1946
+
1947
+ - show relevant archives when a backup definition has been chosen:
1948
+
1949
+ dar-backup: --restore, --list-contents, and --alternate-reference-archive
1950
+
1951
+ cleanup: --cleanup-specific-archives
1952
+
1953
+ manager: --list-archive-contents, --add-specific-archive (autocomplete those **not* in the catalog database), --remove-specific-archive
1954
+
1955
+ - Supports paths like ~ and $HOME correctly
1956
+
1957
+ #### Use it
1958
+
1959
+ Try typing:
1960
+
1961
+ ```bash
1962
+ dar-backup --<TAB>
1963
+ ```
1964
+
1965
+ You should see all available flags like --full-backup, --restore, etc.
1966
+
1967
+ Try completion of backup definition and then list contents:
1968
+
1969
+ ```bash
1970
+ dar-backup --backup-definition <TAB>
1971
+ dar-backup -d <the chosen backup-definition> --list-contents <TAB>
1972
+ ```
1973
+
1974
+ #### Archive name completion (smart, context-aware)
1975
+
1976
+ When using `manager--list-archive-contents`, the tab-completer suggests valid archive names.
1977
+
1978
+ The behavior is smart and context-aware:
1979
+
1980
+ - If a --backup-definition (-d) is provided, archive suggestions are restricted to that .db catalog.
1981
+
1982
+ - If no backup definition is given, the completer will:
1983
+
1984
+ - Scan all .db files in the backup_dir
1985
+
1986
+ - Aggregate archive names across all catalogs
1987
+
1988
+ - Sort results by:
1989
+
1990
+ - Backup name (e.g. pCloudDrive, media-files)
1991
+
1992
+ - Date inside the archive name (e.g. 2025-04-19)
1993
+
1994
+ It’s blazing fast and designed for large backup sets.
1995
+
1996
+ ```bash
1997
+ # With a backup definition
1998
+ manager -d pCloudDrive --list-archive-contents <TAB>
1999
+ # ⤷ Suggests: pCloudDrive_FULL_2025-03-04, pCloudDrive_INCR_2025-04-19, ...
2000
+
2001
+ # Without a backup definition
2002
+ manager --list-archive-contents <TAB>
2003
+ # ⤷ Suggests: all archives across all known backup definitions
2004
+ # ⤷ Example: media-files_FULL_2025-01-04, pCloudDrive_INCR_2025-04-19, ...
2005
+
2006
+ # Filter by prefix
2007
+ manager --list-archive-contents media-<TAB>
2008
+ # ⤷ Suggests: media-files_FULL_2025-01-04, media-files_INCR_2025-02-20, ...
2009
+ ```
2010
+
2011
+ #### Enabling Bash completion
2012
+
2013
+ Try auto completion in your session:
2014
+
2015
+ ```bash
2016
+ eval "$(register-python-argcomplete dar-backup)"
2017
+ eval "$(register-python-argcomplete cleanup)"
2018
+ eval "$(register-python-argcomplete manager)"
2019
+ #complete -o nosort -C 'python -m argcomplete cleanup' cleanup
2020
+ #complete -o nosort -C 'python -m argcomplete manager' manager
2021
+ ```
2022
+
2023
+ To make it persistent across sessions, add this to your ~/.bashrc:
2024
+
2025
+ ```bash
2026
+ # Enable autocompletion for dar-backup
2027
+ eval "$(register-python-argcomplete dar-backup)"
2028
+ eval "$(register-python-argcomplete cleanup)"
2029
+ eval "$(register-python-argcomplete manager)"
2030
+ # This disables bash sorting, so sorting is by <backup definition> and <date>
2031
+ #complete -o nosort -C 'python -m argcomplete cleanup' cleanup
2032
+ #complete -o nosort -C 'python -m argcomplete manager' manager
2033
+ ```
2034
+
2035
+ If you're using a virtual environment and register-python-argcomplete isn't in your global PATH, use:
2036
+
2037
+ ```bash
2038
+ # Enable autocompletion for dar-backup
2039
+ eval "$($(which register-python-argcomplete) dar-backup)"
2040
+ eval "$($(which register-python-argcomplete) cleanup)"
2041
+ eval "$($(which register-python-argcomplete) manager)"
2042
+
2043
+ # If it's not working, try reactivating your virtualenv and restarting your terminal.
2044
+ ```
2045
+
2046
+ Then reload your shell:
2047
+
2048
+ ```bash
2049
+ source ~/.bashrc
2050
+ ```
2051
+
2052
+ #### Enable Zsh Completion
2053
+
2054
+ If you're using Zsh, add this to your .zshrc:
2055
+
2056
+ ```zsh
2057
+ autoload -U bashcompinit
2058
+ bashcompinit
2059
+ eval "$(register-python-argcomplete dar-backup)"
2060
+ eval "$(register-python-argcomplete cleanup)"
2061
+ eval "$(register-python-argcomplete manager)"
2062
+ ```
2063
+
2064
+ Then reload Zsh:
2065
+
2066
+ ```zsh
2067
+ source ~/.zshrc
2068
+ ```
2069
+
1648
2070
  ## Todo
1649
2071
 
2072
+ - When run interactively, a progress bar during test and par2 generation would be nice.
1650
2073
  - Look into a way to move the .par2 files away from the `dar` slices, to maximize chance of good redundancy.
1651
2074
  - Add option to dar-backup to use the `dar` option `--fsa-scope none`
1652
2075
 
@@ -1658,54 +2081,65 @@ One backup definition per file
1658
2081
 
1659
2082
  .par2 files created for each slice (may be moved in future)
1660
2083
 
2084
+ ## Projects these scripts benefit from
2085
+
2086
+ 1. [The wonderful dar achiver](https://github.com/Edrusb/DAR)
2087
+ 2. [The Parchive suite](https://github.com/Parchive)
2088
+ 3. [shellcheck - a bash linter](https://github.com/koalaman/shellcheck)
2089
+ 4. [Ubuntu of course :-)](https://ubuntu.com/)
2090
+ 5. [PyPI](https://pypi.org/)
2091
+ 6. Tracking PyPI downloads with [pypi-total-downloads-tracker](https://github.com/per2jensen/pypi-total-downloads-tracker)
2092
+
1661
2093
  ## Reference
1662
2094
 
1663
2095
  ### CLI Tools Overview
1664
2096
 
1665
- | Command | Description |
1666
- |-----------------------|-------------------------------------------|
1667
- | `dar-backup` | Perform full, differential, or incremental backups with verification and restore testing |
1668
- | `manager` | Maintain and query catalog databases for archives |
1669
- | `cleanup` | Remove outdated DIFF/INCR archives (and optionally FULLs) |
1670
- | `clean-log` | Clean up excessive log output from dar command logs |
1671
- | `installer` | Set up required directories and default config files |
1672
- | `dar-backup-systemd` | Generate (and optionally install) systemd timers and services for automated backups |
2097
+ | Command | Description |
2098
+ |----------------------|-------------------------------------------|
2099
+ | [dar-backup](#dar-backup-options)| Perform full, differential, or incremental backups with verification and restore testing |
2100
+ | [manager](#manager-options) | Maintain and query catalog databases for archives |
2101
+ | [cleanup](#cleanup-options) | Remove outdated DIFF/INCR archives (and optionally FULLs) |
2102
+ | [clean-log](#clean-log-options) | Clean up excessive log output from dar command logs |
2103
+ | [dar-backup-systemd](#dar-backup-systemd-options) | Generate (and optionally install) systemd timers and services for automated backups |
2104
+ | [installer](#installer-options) | Set up directories and optionally create catalog databases according to a config file |
2105
+ | [demo](#demo-options) | Set up required directories and config files for a demo|
1673
2106
 
1674
2107
  ### test coverage
1675
2108
 
1676
2109
  Running
1677
2110
 
1678
- ```` bash
2111
+ ```bash
1679
2112
  pytest --cov=dar_backup tests/
1680
- ````
2113
+ ```
1681
2114
 
1682
- results for a dev version 0.6.19 in this report:
2115
+ Results for a version 0.6.19 in this report:
1683
2116
 
1684
- ```` code
1685
- ---------- coverage: platform linux, python 3.12.3-final-0 -----------
2117
+ ```text
1686
2118
  Name Stmts Miss Cover
1687
2119
  ----------------------------------------------------------
1688
2120
  src/dar_backup/__about__.py 1 0 100%
1689
2121
  src/dar_backup/__init__.py 0 0 100%
1690
2122
  src/dar_backup/clean_log.py 68 13 81%
1691
- src/dar_backup/cleanup.py 193 17 91%
1692
- src/dar_backup/command_runner.py 73 1 99%
1693
- src/dar_backup/config_settings.py 66 8 88%
1694
- src/dar_backup/dar_backup.py 535 56 90%
2123
+ src/dar_backup/cleanup.py 196 17 91%
2124
+ src/dar_backup/command_runner.py 80 3 96%
2125
+ src/dar_backup/config_settings.py 66 7 89%
2126
+ src/dar_backup/dar_backup.py 539 56 90%
1695
2127
  src/dar_backup/dar_backup_systemd.py 56 7 88%
1696
2128
  src/dar_backup/installer.py 59 6 90%
1697
- src/dar_backup/manager.py 351 56 84%
2129
+ src/dar_backup/manager.py 403 54 87%
1698
2130
  src/dar_backup/rich_progress.py 70 7 90%
1699
- src/dar_backup/util.py 130 15 88%
2131
+ src/dar_backup/util.py 231 24 90%
1700
2132
  ----------------------------------------------------------
1701
- TOTAL 1602 186 88%
1702
- ````
2133
+ TOTAL 1769 194 89%
2134
+ ```
2135
+
2136
+ ### Dar-backup options
1703
2137
 
1704
- ### dar-backup options
2138
+ This script does backups including par2 redundancy, validation and restoring.
1705
2139
 
1706
- This script does backups, validation and restoring. It has the following options:
2140
+ Available options:
1707
2141
 
1708
- ``` code
2142
+ ```bash
1709
2143
  -F, --full-backup Perform a full backup.
1710
2144
  -D, --differential-backup Perform a differential backup.
1711
2145
  -I, --incremental-backup Perform an incremental backup.
@@ -1724,34 +2158,39 @@ This script does backups, validation and restoring. It has the following options
1724
2158
  --log-level <level> `debug` or `trace`, default is `info`.
1725
2159
  --log-stdout Also print log messages to stdout.
1726
2160
  --do-not-compare Do not compare restores to file system.
1727
- -v --version Show version and license information.
2161
+ -v, --version Show version and license information.
1728
2162
  ```
1729
2163
 
1730
- ### manager options
2164
+ ### Manager Options
1731
2165
 
1732
- This script manages `dar` databases and catalogs. Available options:
2166
+ This script manages `dar` databases and catalogs.
1733
2167
 
1734
- ``` code
1735
- -c, --config-file Path to dar-backup.conf
2168
+ Available options:
2169
+
2170
+ ```bash
2171
+ -c, --config-file <path> Path to dar-backup.conf.
1736
2172
  --create-db Create missing databases for all backup definitions.
1737
2173
  --alternate-archive-dir <path> Use this directory instead of BACKUP_DIR in the config file.
1738
2174
  --add-dir <path> Add all archive catalogs in this directory to databases.
1739
- -d, --backup-def <name> Restrict to work only on this backup definition.
1740
- --add-specific-archive <archive> Add this archive to the catalog database.
1741
- --remove-specific-archive <archive> Remove this archive from the catalog database.
2175
+ -d, --backup-def <name> Restrict operations to this backup definition.
2176
+ --add-specific-archive <archive> Add a specific archive to the catalog database.
2177
+ --remove-specific-archive <archive> Remove a specific archive from the catalog database.
1742
2178
  -l, --list-catalogs List catalogs in databases for all backup definitions.
1743
- --list-catalog-contents <num> List contents of a catalog by catalog number.
1744
- --list-archive-contents <archive> List contents of an archive’s catalog, given the archive name.
2179
+ --list-archive-contents <archive> List the contents of an archive’s catalog by archive name.
1745
2180
  --find-file <file> Search catalogs for a specific file.
1746
2181
  --verbose Enable verbose output.
1747
- --log-level <level> `debug` or `trace`, default is `info`", default="info".
2182
+ --log-level <level> Set log level (`debug` or `trace`, default is `info`).
1748
2183
  ```
1749
2184
 
1750
- ### cleanup options
2185
+ ### Cleanup options
2186
+
2187
+ This script removes old backups and par2 files according to `[AGE]` settings in config file.
1751
2188
 
1752
- This script cleans up old backups and par2 files. Supported options:
2189
+ Catalogs in catalog databases are also removed.
1753
2190
 
1754
- ``` code
2191
+ Supported options:
2192
+
2193
+ ```bash
1755
2194
  -d, --backup-definition Backup definition to cleanup.
1756
2195
  -c, --config-file Path to 'dar-backup.conf'
1757
2196
  -v, --version Show version & license information.
@@ -1764,11 +2203,11 @@ This script cleans up old backups and par2 files. Supported options:
1764
2203
  --test-mode This is used when running pytest test cases
1765
2204
  ```
1766
2205
 
1767
- ### clean-log options
2206
+ ### Clean-log options
1768
2207
 
1769
2208
  This script removes excessive logging output from `dar` logs, improving readability and efficiency. Available options:
1770
2209
 
1771
- ``` code
2210
+ ```bash
1772
2211
  -f, --file <path> Specify the log file(s) to be cleaned.
1773
2212
  -c, --config-file <path> Path to dar-backup.conf.
1774
2213
  --dry-run Show which lines would be removed without modifying the file.
@@ -1776,9 +2215,35 @@ This script removes excessive logging output from `dar` logs, improving readabil
1776
2215
  -h, --help Displays usage info
1777
2216
  ```
1778
2217
 
1779
- ### installer options
2218
+ ### Dar-backup-systemd options
2219
+
2220
+ Generates and optionally install systemd user service units and timers.
2221
+
2222
+ ```bash
2223
+ -h, --help Show this help message and exit
2224
+ --venv VENV Path to the Python venv with dar-backup
2225
+ --dar-path DAR_PATH Optional path to dar binary's directory
2226
+ --install Install the units to ~/.config/systemd/user
2227
+ ```
2228
+
2229
+ ### Installer options
1780
2230
 
1781
- Sets up `dar-backup`for a user.
2231
+ Sets up `dar-backup` according to provided config file.
2232
+
2233
+ The installer creates the necessary backup catalog databases if `--create-db` is given.
2234
+
2235
+ ```bash
2236
+ --config Sets up `dar-backup`.
2237
+ --create-db Create backup catalog databases. Add it to --config
2238
+ --install-autocompletion Add bash or zsh auto completion - idempotent
2239
+ --remove-autocompletion Remove the auto completion from bash or zsh
2240
+ -v, --version Display version and licensing information.
2241
+ -h, --help Displays usage info
2242
+ ```
2243
+
2244
+ ### Demo options
2245
+
2246
+ Sets up `dar-backup` in a demo configuration.
1782
2247
 
1783
2248
  It is non-destructive and stops if directories are already in place.
1784
2249
 
@@ -1795,19 +2260,15 @@ Sets up demo config files:
1795
2260
  - ~/.config/dar-backup/dar-backup.conf
1796
2261
  - ~/.config/dar-backup/backup.d/default
1797
2262
 
1798
- ``` code
1799
- -i, --install Sets up `dar-backup`.
1800
- -v, --version Display version and licensing information.
1801
- -h, --help Displays usage info
1802
- ```
1803
-
1804
- ### dar-backup-systemd
1805
-
1806
- Generates and optionally install systemd user service units and timers
1807
-
1808
- ``` code
1809
- -h, --help Show this help message and exit
1810
- --venv VENV Path to the Python venv with dar-backup
1811
- --dar-path DAR_PATH Optional path to dar binary's directory
1812
- --install Install the units to ~/.config/systemd/user
2263
+ ```bash
2264
+ -i, --install Sets up `dar-backup`.
2265
+ --root-dir Specify the root directory for the backup.
2266
+ --dir-to-backup Directory to backup, relative to the root directory.
2267
+ --backup-dir Directory where backups and redundancy files are put.
2268
+ --override By default, the script will not overwrite existing files or directories.
2269
+ Use this option to override this behavior.
2270
+ --generate Generate config files and put them in /tmp/ for inspection
2271
+ without writing to $HOME.
2272
+ -v, --version Display version and licensing information.
2273
+ -h, --help Displays usage info
1813
2274
  ```