Files
dotfiles/dots
T

50 lines
967 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
2025-09-25 16:30:14 +01:00
Install() {
2025-09-24 23:03:16 +01:00
# Installs current dotfiles onto the system
#
echo "[Info] :: Installing dotfiles into $1"
[[ ! -d "$1" ]] && mkdir -p "$1"
2025-09-25 18:08:46 +01:00
cp "bashrc" "$1/.bashrc"
cp "bash_profile" "$1/.bash_profile"
cp "bash_aliases" "$1/.bash_aliases"
2025-09-24 23:03:16 +01:00
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"
2025-09-25 18:08:46 +01:00
cp -r "$1/.config/nvim" "config/"
cp "$1/.config/starship.toml" "config/starship.toml"
cp "$1/.bashrc" "bashrc"
cp "$1/.bash_profile" "bash_profile"
cp "$1/.bash_aliases" "bash_aliases"
2025-09-24 16:42:00 +01:00
}
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-25 16:30:14 +01:00
install)
Install $INSTALL_DIR
2025-09-24 23:03:16 +01:00
;;
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