dbkp

command module
v0.0.0-...-87a2a3b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: MPL-2.0 Imports: 1 Imported by: 0

README

dbkp - dotfiles backup

dbkp simply backups and restores dotfiles. You can use it with any version control or backup strategy you want.

Instalation

With nix flakes: nix install github:acristoffers/dbkp

With go: go install github.com/acristoffers/dbkp@latest

Usage

Create the backup folder and configuration file

Create a folder where you want to backup to. I put this folder into git for version control. Initialise the backup with dbkp init or, if you want encryption (GCM-AES-256) dbkp init --encrypt.

It will create a dbkp.toml (with some random data if you passed --encrypt).

Backing up/restoring files

Now, add some files with:

dbkp add ~/bin

which adds the folder ~/bin to the backup (but does not backup yet). However, I have a folder inside ~/bin that I don't want to backup, so I run this instead:

dbkp add ~/bin -e tree-sitter-grammars

which is going to skip ~/bin/tree-sitter-grammars. There is also an --only|-o option that only picks the given files/folders. To pass more than one, separate their names by commas.

To backup, run dbkp backup. If you want to encrypt a previously unencrypted backup, pass the -e flag. If you want to stop encrypting files, edit dbkp.toml and make sure that the line of EncryptionSalt reads:

EncryptionSalt = ["", ""]

To restore, run dbkp restore.

Backing up/restoring with commands

dbkp also supports backup/restore through commands. It will execute the Backup command and save its stdout during backup, and will read the saved content and feed it to Restore's stdin. The commands will be executed by sh -c.

To add a backup command:

dbkp add --command gnome-settings --backup "dconf dump /" --restore "dconf load /"

If needed, you can use sh to pipe things and xargs to turn stdin into arguments:

dbkp add --command flatpak --backup "flatpak list --columns=ref --app | tail -n +1" --restore "xargs flatpak install -y --noninteractive --or-update"

Documentation

Overview

dbkp allows you to backup and restore dotfiles with ease.

Create the configuration file to specify what files and folders you want to keep track of, then run "dbkp backup" to backup and "dbkp restore" to restore into a subfolder where the configuration file is. That simple. Pair it with git for version control.

For example to backup fish and you bin folder into Dropbox:

mkdir ~/Documents/Dropbox/dotfiles
cd ~/Documents/Dropbox/dotfiles
dbkp init
dbkp add ~/.config/fish
dbkp add ~/bin
dbkp backup

Usage:

dbkp [command]

Available Commands:

add         Adds files/folders or commands from the file system to the backup
backup      Executes the backup in dbkp.toml.
completion  Generate the autocompletion script for the specified shell
help        Help about any command
init        Creates a dbkp project in the current directory
remove      Removes and entry from the backup recipe
restore     Restores the backup in dbkp.toml.
version     Shows version and exits

Flags:

-h, --help   help for dbkp

Use "dbkp [command] --help" for more information about a command.

Directories

Path Synopsis
cmd
pkg
dbkp
Package dbkp implements dotfiles backup and restore.
Package dbkp implements dotfiles backup and restore.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL