-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·93 lines (76 loc) · 2 KB
/
install.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# set -e
SCRIPT_DEST_DIR="/usr/local/bin"
# Usage: make_home_symlink path_to_file name_of_file_in_home_to_symlink_to
make_home_symlink() {
if [ -z "$1" ]; then
>&2 echo "make_home_symlink: missing first argument: path to file"
exit 1
fi
THIS_DOTFILE_PATH="$PWD/$1"
if [ -z "$2" ]; then
HOME_DOTFILE_PATH="$HOME/$1"
else
HOME_DOTFILE_PATH="$HOME/$2"
fi
printf "Installing %s into %s" "$1" "$HOME_DOTFILE_PATH"
if [ -L "$HOME_DOTFILE_PATH" ]; then
echo " skipping, target is already a symlink"
return
fi
if [ -f "$HOME_DOTFILE_PATH" ] && [ ! -L "$HOME_DOTFILE_PATH" ]; then
printf " You already have a regular file at %s. Do you want to remove it? (y/n) " "$HOME_DOTFILE_PATH"
read -r response
if [ "$response" = "y" ] || [ "$response" = "Y" ]; then
rm "$HOME_DOTFILE_PATH"
else
return
fi
fi
ln -s "$THIS_DOTFILE_PATH" "$HOME_DOTFILE_PATH" 2>/dev/null
echo "Done"
}
make_script_symlink() {
local -a scripts=("scripts/"*)
for script in "${scripts[@]}"; do
src="$PWD/$script"
dest="$SCRIPT_DEST_DIR/${script/scripts\/}"
echo "Installing $src into $dest"
sudo ln -s "$src" "$dest"
done
}
install_gitmux() {
which gitmux && return
go get -u github.com/arl/gitmux
}
mkdir -p "$HOME/.cache/zsh"
dotfiles=(
".config/lf"
".config/yazi"
".config/.diricons"
".config/nvim"
".config/polybar"
".config/zsh"
".config/alacritty"
".config/i3"
".config/redshift.conf"
".config/picom.conf"
".config/ranger"
".config/mpv"
".config/.gitmux.conf"
".config/mimeapps.list"
".config/ncspot"
".tmux.conf"
".zshenv"
".Xresources"
".urxvt"
".wegorc"
".gitconfig"
".xinitrc"
)
for dotfile in "${dotfiles[@]}"; do
make_home_symlink "$dotfile"
done
install_gitmux
sudo ln -s "$HOME/.config/lf/lfrun" "/usr/local/bin" 2> /dev/null
make_script_symlink