I decided to automate my dotfiles for working on different systems but didn't want to have symlinks everywhere so reworked an old script I made in 2014 for backing up dotfiles.

This time I thought I'd automate both backup and install making it easier & quicker for clean installs.

The script also makes it possible to automate the install of extensions in Visual Studio Code & Vim.

My Desktop Setup #

I use a tiling WM in linux with dual monitors and have odd numbered desktops on the left monitor & even numbered on the right monitor.

Programs are launched using dmenu ( ctrl + space ).

I've had the same setup since 2014 and find it a lot faster than the mini game of dragging windows around.

archlinux i3wm desktop

Script Design #

The script copies files as an alternative to having symlinks everywhere.

This allows me to control when I commit config changes to github (there may be times when testing settings etc).

It also means I don't have symlinks across different disk mount points.

function copy() {
    if [ -f $1 ]; then
        ORIGIN=$1
        DESTINATION=$(echo "$ORIGIN" | sed "s#^\./configs/#$HOME/#")
        mkdir -p $(dirname "$DESTINATION")
        if [ -a "$DESTINATION" ]; then
            if diff "$ORIGIN" "$DESTINATION" >/dev/null; then
                echo -e "$bplus $DESTINATION already up to date"
                return 2
            fi

Install & Backup Features #

Folder Structure #

.
├── backup.sh
├── install.sh
├── configs/
├── lists/
└── sys/
  • configs contains config files from users home directory
  • lists contains vscode extensions list
  • sys contains files from linux system (eg: /etc/)

Download #

The scripts and my dotfiles can be downloaded from github.

Download