Package: dotbackup
dotbackupYAML config based backup utility. Easy to use yet flexible. With a primary focus on
dotfile backup & setup, but not limited to dotfiles.FeaturesSimple configuration.Custom hooks.InstallationYou can downloadthe scriptand place it to somewhere you like:curl-L-o~/.local/bin/dotbackup\"https://github.com/jaxvanyang/dotbackup/raw/main/src/dotbackup.py"chmod+x~/.local/bin/dotbackupOr you can install from one of these package managers:PyPIAURConfigurationThe default configuration file path is~/.config/dotbackup/dotbackup.yml, however you
can use the-coption to specify another configuration file. Configuration files use
YAML syntax. If you are new to YAML and want to learn more, seeLearn yaml in Y Minutes.
If you want a quick start, you can takethisas an example.
Following are the configuration keyword definitions, undefined keywords are ignored
(maybe I'll write a validator someday).backup_dirRequired. The directory where backup files be stored.Example:backup_dir:~/dotfilescleanOptional. Whether to do clean backup/setup, i.e., delete target files before backup or
setup. The default isfalse. This may be overridden by the command line option--clean.Example:clean:trueignoreOptional. The global ignored file patterns. Files that matches these patterns will be
ignored in backup and setup. But files which are directly specified inapps.<app>.fileswill not be ignored.Example:apps:nvim:files:[~/.config/nvim]ignore:['.git']apps.<app>.filesOptional. The files to be backed up of the application<app>,<app>can be any
string. File paths MUST be under the$HOMEdirectory due to implementation. You can
usecustom hooksto back up other
files.Example:apps:nvim:files:-~/.config/nvim/init.lua-~/.config/nvim/luaapps.<app>.ignoreOptional. The Application ignored file patterns. Files that matches these patterns will
be ignored in backup and setup. But files which are directly specified inapps.<app>.fileswill not be ignored.Example:apps:nvim:files:[~/.config/nvim]ignore:['*.json']apps.<app>.<pre_backup|post_backup|pre_setup|post_setup>Optional. The hooks to be executed before/after<app>backup/setup,<app>can be any
string. Each hook accept a list of commands, command are passed tosh -c. You can use
these hooks to do advance operation.Example:FIXME: definingBACKUP_DIRis not implemented yet.apps:dotbackup:pre_backup:-cp /etc/dotbackup/dotbackup.yml "$BACKUP_DIR/dotbackup/dotbackup.yml"post_backup:-cd "$BACKUP_DIR" && git add dotbackuppre_setup:-pip install --user dotbackup || truepost_setup:-sudo cp "$BACKUP_DIR/dotbackup/dotbackup.yml" /etc/dotbackup/dotbackup.yml<pre_backup|post_backup|pre_setup|post_setup>Optional. The hooks to be executed before/after all backup/setup. Each hook accept a
list of commands, command are passed tosh -c. You can use these hooks to do advance
operation.Example:FIXME: definingBACKUP_DIRis not implemented yet.pre_backup:-date > "$BACKUP_DIR/backup_date.txt"post_backup:-|cd "$BACKUP_DIR"git add backup_date.txtgit commit -m "update backups"git pushpre_setup:-cd "$BACKUP_DIR" && git pullpost_setup:-paru -Syu base-develUsageSome examples:dotbackupnvimtmux
dotbackupbackupnvimtmux
dotbackupsetupnvimtmux
dotbackupsetupRundotbackup -hfor more information.