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-25 21:01:22 +01:00
|
|
|
mkdir -p "$1/.config"
|
|
|
|
|
|
|
|
|
|
cp -r "config/nvim" "$1/.config"
|
|
|
|
|
cp "config/starship.toml" "$1/.config"
|
|
|
|
|
|
|
|
|
|
# Graphical setups
|
|
|
|
|
#
|
|
|
|
|
case $HOSTNAME in
|
|
|
|
|
kanto|tokyo)
|
|
|
|
|
mkdir -p "$1/.config/sway"
|
|
|
|
|
|
|
|
|
|
cp "config/sway/$HOSTNAME.sway" "$1/.config/sway/config"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2025-09-24 23:03:16 +01:00
|
|
|
}
|
|
|
|
|
|
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"
|
2025-09-25 21:01:22 +01:00
|
|
|
cp "$1/.config/sway/config" "config/sway/$HOSTNAME.sway"
|
2025-09-25 18:08:46 +01:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2025-09-25 21:01:22 +01:00
|
|
|
echo "usage: $0 <install|pull|diff> [dir]"
|
2025-09-24 16:42:00 +01:00
|
|
|
;;
|
|
|
|
|
esac
|
2025-09-24 23:03:16 +01:00
|
|
|
|
|
|
|
|
popd > /dev/null
|