-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·36 lines (30 loc) · 1.21 KB
/
install.sh
File metadata and controls
executable file
·36 lines (30 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -euo pipefail
CONFIGDIR="$HOME/src/github.com/fredsmith/dotfiles"
if [ -d "$CONFIGDIR" ]; then
echo "Dotfiles already installed at $CONFIGDIR, pulling latest..."
git -C "$CONFIGDIR" pull
else
echo "Cloning dotfiles to $CONFIGDIR..."
mkdir -p "$(dirname "$CONFIGDIR")"
git clone https://github.com/fredsmith/dotfiles.git "$CONFIGDIR"
fi
# Link shell configs
for rc in bashrc zshrc profile; do
if [ -f "$HOME/.$rc" ] && [ ! -L "$HOME/.$rc" ]; then
mv "$HOME/.$rc" "$HOME/.$rc.old"
fi
ln -sf "$CONFIGDIR/$rc" "$HOME/.$rc"
done
# Fish config - link the whole directory
mkdir -p "$HOME/.config"
if [ -d "$HOME/.config/fish" ] && [ ! -L "$HOME/.config/fish" ]; then
mv "$HOME/.config/fish" "$HOME/.config/fish.old"
fi
ln -sf "$CONFIGDIR/fish" "$HOME/.config/fish"
# environment.d - systemd reads this at user manager startup, before the
# desktop session begins. Sets XDG_CONFIG_HOME early enough that GUI apps
# and services launched outside a shell still see the right value.
mkdir -p "$HOME/.config/environment.d"
ln -sf "$CONFIGDIR/environment.d/10-dotfiles.conf" "$HOME/.config/environment.d/10-dotfiles.conf"
echo "Done! Log out and back in for environment.d changes to take effect."