]> code.delx.au - dotfiles/commitdiff
install.sh
authorJames Bunton <jamesbunton@delx.au>
Wed, 7 Feb 2024 01:35:18 +0000 (12:35 +1100)
committerJames Bunton <jamesbunton@delx.au>
Wed, 7 Feb 2024 01:35:18 +0000 (12:35 +1100)
install.sh [new file with mode: 0755]

diff --git a/install.sh b/install.sh
new file mode 100755 (executable)
index 0000000..6965fe5
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+set -eu
+
+cd "$HOME"
+
+FILES=(
+    .bash_logout
+    .profile
+    .bash_profile
+    .bashrc
+    .gitconfig
+    .git-hooks-global
+    .gitignore-global
+    .inputrc
+    .pythonrc.py
+    .screenrc
+    .vimrc
+)
+
+if ! [ -d .dotfiles ]; then
+    git clone https://code.delx.au/dotfiles .dotfiles
+fi
+
+echo 'Removing...'
+for f in "${FILES[@]}"; do
+    rm -f "$f" && echo "  $f"
+done
+
+echo 'Installing...'
+for f in "${FILES[@]}"; do
+    if [ -f "${HOME}/.dotfiles/$f" ]; then
+       echo "  $f"
+       ln -s "${HOME}/.dotfiles/$f"
+    fi
+done
+
+echo 'Done!'