YAML config based backup utility. Easy to use yet flexible. With a primary focus on dotfile backup & setup, but not limited to dotfiles.
Project description
dotbackup
YAML config based backup utility. Easy to use yet flexible. With a primary focus on dotfile backup & setup, but not limited to dotfiles.
Features
- Simple configuration.
- Custom hooks.
Installation
You can download the script and place it to somewhere you like:
curl -L -o ~/.local/bin/dotbackup \
"https://github.com/jaxvanyang/dotbackup/blob/main/src/dotbackup.py"
chmod +x ~/.local/bin/dotbackup
Or you can install from one of these package managers:
Configuration
The default configuration file path is ~/.config/dotbackup/config.yml
, however you can
use the -c
option to specify another configuration file. Configuration files use YAML
syntax. If you are new to YAML and want to learn more, see Learn yaml in Y Minutes.
If you want a quick start, you can take this as an example.
Following are the configuration keyword definitions, undefined keywords are ignored
(maybe I'll write a validator someday).
backup_dir
Required. The directory where backup files store.
Example:
backup_dir: ~/dotfiles
apps.<app>.files
Optional. The files to be backed up of the application <app>
, <app>
can be any
string. File paths MUST be under the $HOME
directory due to implementation. You can
use custom hooks to back up other
files.
Example:
apps:
nvim:
files:
- ~/.config/nvim/init.lua
- ~/.config/nvim/lua
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 to sh -c
. You can use
these hooks to do advance operation.
Example:
FIXME: defining
BACKUP_DIR
is not implemented yet.
apps:
dotbackup:
pre_backup:
- cp /etc/dotbackup/config.yml "$BACKUP_DIR/dotbackup/config.yml"
post_backup:
- cd "$BACKUP_DIR" && git add dotbackup
pre_setup:
- pip install --user dotbackup || true
post_setup:
- sudo cp "$BACKUP_DIR/dotbackup/config.yml" /etc/dotbackup/config.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 to sh -c
. You can use these hooks to do advance
operation.
Example:
FIXME: defining
BACKUP_DIR
is not implemented yet.
pre_backup:
- date > "$BACKUP_DIR/backup_date.txt"
post_backup:
- |
cd "$BACKUP_DIR"
git add backup_date.txt
git commit -m "update backups"
git push
pre_setup:
- cd "$BACKUP_DIR" && git pull
post_setup:
- paru -Syu base-devel
Usage
Some examples:
dotbackup nvim tmux
dotbackup backup nvim tmux
dotbackup setup nvim tmux
dotbackup setup
Run dotbackup -h
for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dotbackup-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 936ad274844fdbf0eecdc302d183697604abaa796b7d7132feb811b6258a0340 |
|
MD5 | 912edbee9ffc450be3ef9bd3c1596a48 |
|
BLAKE2b-256 | 3a1890e22334b2804f2b714e971fa30145ce916f7e9926c1fb123aa518e4bce3 |