Backup Script

Update: Over the last ~week dfm has had a few updates, cleanup, and bugfixes

Hey, I’ve got a backup script I use for my dots and want to share.

I’ve had it in varying states for some time but only recently got it to what I would call “stable”, and would love feedback or testing, here’s the bitbucket link

Stuff of note:

  • Has full CLI interface
  • Files are stored in the same file structure as copied files
  • Symbolic links are transformed to the file they are linked to
  • On first run, a blank config (~/.dfmrc) is created and initial setup begins
  • Auto Install req. packages on systems with pacman rsync and git
  • Using git is NOT required, setting REPO="" will skip git related steps and make local backup

There are probably some things I am forgetting or didn’t highlight so ask away

The config can be very simple and you may prefer editing by hand but it isn’t required.
Inside values (strings and arrays) are stored, it’s sourced and written to when running the script.

Here’s my config for reference

#!/usr/bin/env bash

# config for dotfile manager

# git repo https address (for cloning & pushing)
REPO="https://github.com/natemaia/my-dots"

# branch setting, defaults to HEAD (currently checked out)
BRANCH="master"

# directory where repo is located or will be cloned
BKP_DIR="/media/Storage/Git-Projects/my-dots"

# The following are the names for each directory inside BKP_DIR.
# Both will be created if needed & store files from the arrays below
USER_DIR="user"
ROOT_DIR="root"

# File paths which will be backed up to the directories above
USER_PATHS=(
"/home/smoke/bin"
"/home/smoke/.dfmrc"
"/home/smoke/.ncmpcpp"
"/home/smoke/.resources"
"/home/smoke/.Xmodmap"
"/home/smoke/.Xresources"
"/home/smoke/.tmux.conf"
"/home/smoke/.gitconfig"
"/home/smoke/.mpd/mpd.conf"
"/home/smoke/.mpd/playlists"
"/home/smoke/.config/dunst"
"/home/smoke/.config/ranger"
"/home/smoke/.config/qutebrowser"
)

ROOT_PATHS=(
"/etc/X11"
"/etc/mpd.conf"
"/etc/yaourtrc"
"/etc/pacman.conf"
"/etc/makepkg.conf"
)

Cheers

11 Likes

I try it today with a local backup and it works flawlessly! Thank you for that. Greetings

1 Like

Thanks, this is going to help!

Works as advertised; thanks.

Awesome stuff