Files
dotfiles/install
T

41 lines
674 B
Bash
Raw Normal View History

2025-09-24 16:42:00 +01:00
#!/bin/sh
set -e
2025-09-24 23:03:16 +01:00
pushd "$(dirname $0)" > /dev/null
Push() {
# Installs current dotfiles onto the system
#
echo "[Info] :: Installing dotfiles into $1"
[[ ! -d "$1" ]] && mkdir -p "$1"
cp -RT "config" "$1/.config"
}
2025-09-24 16:42:00 +01:00
Pull() {
# Allows system changes to be pulled into the repository to be committed
#
echo "[Info] :: Pulling dotfile changes from $1"
cp -r "$1/.config/nvim" "config/"
}
INSTALL_DIR=${2:-$HOME}
2025-09-24 23:03:16 +01:00
ACTION=$1
2025-09-24 16:42:00 +01:00
[[ -z $INSTALL_DIR ]] && echo "[Error] :: Installation directory not set" && exit 1
case $ACTION in
2025-09-24 23:03:16 +01:00
push)
Push $INSTALL_DIR
;;
2025-09-24 16:42:00 +01:00
pull)
Pull $INSTALL_DIR
;;
*)
echo "usage: $0 <push|pull|diff> [dir]"
;;
esac
2025-09-24 23:03:16 +01:00
popd > /dev/null