-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·72 lines (60 loc) · 1.5 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
#!/bin/sh
# creates symbolic links for my dotfiles so all files can stay in the dotfiles folder
# WARNING: this script will overwrite existing files
# this script should be POSIX compliant (checked with https://www.shellcheck.net/)
dot_dir=~/dotfiles # FULL path to the repo
# see https://archive.md/TRzn4
while getopts ":p:" opt; do
case $opt in
p)
dot_dir=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
# check if dotfiles repo exists
if [ ! -d "$dot_dir" ]
then
echo "Directory '${dot_dir}' not found, you can specify a path with -p"
exit 1
fi
# make sure to start in the home directory
cd ~/ || exit 1
# start creating symlinks
# files in ~/
for i in .tigrc .zshrc .zshenv .zsh-alias
do
if [ -f "$i" ]; then
rm -f "$i"
fi
ln -sf "$dot_dir"/"$i" "$i"
done
# Librewolf userChrome
cp -r $dot_dir/chrome ~/.librewolf/*.default-release
# ~/.config
if [ ! -d ~/.config ]
then
mkdir -p ~/.config
fi
cd ~/.config || exit 1
for i in alacritty lf mako mpd ncmpcpp neofetch nvim river rofi waybar zathura mimeapps.list user-dirs.dirs
do
if [ -d "$i" ] || [ -f "$i" ]; then
rm -rf "$i"
fi
ln -sf "$dot_dir"/"$i" "$i"
done
# create MPD playlists directory
mkdir -p ~/.config/mpd/playlists
# wrap up
unset "$dot_dir"
cd ~/ || exit 1
echo "All done, no errors."
exit 0