-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·63 lines (56 loc) · 2.08 KB
/
install
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
#!/bin/bash
repoLocation="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if ! grep -q "source ${repoLocation}/sourcer" "${HOME}/.bashrc"; then
echo "Installing link to bashrc..."
echo "source ${repoLocation}/sourcer" >>~/.bashrc
else
echo "Link in bashrc already exists, skipping..."
fi
if ! crontab -l 2>/dev/null | grep -q "cd ${repoLocation} && git pull"; then
echo "Installing crontab to update the repository regularly..."
(
crontab -l 2>/dev/null
echo "0 */3 * * * cd ${repoLocation} && git pull"
) | crontab -
else
echo "Crontab already exists, skipping..."
fi
echo -n "Do you want to install or update Lazygit? [Y/N] "
read -r -n 1 answer
if [[ $answer =~ ^[Yy]$ ]]; then
echo -e "\nInstalling lazygit..."
source AliasesAndFunctions/default/functions
install_lazygit
else
echo -e "\nSkipping installation of lazygit..."
fi
if ! which __git_ps1; then
echo "The git prompt is not installed, downloading..."
wget -O "${HOME}/.git-prompt.sh" https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
echo "source ${HOME}/.git-prompt.sh" >>"${HOME}"/.bashrc
fi
echo "Linking configuration files..."
if command -v git >/dev/null 2>&1; then
ln -sf "${repoLocation}/Configurations/gitconfig" "${HOME}/.gitconfig"
fi
if command -v lazygit >/dev/null 2>&1; then
mkdir -p "${HOME}/.config/lazygit/"
ln -sf "${repoLocation}/Configurations/lazygit.yml" "${HOME}/.config/lazygit/config.yml"
fi
if [[ $(cat /proc/version 2>/dev/null) =~ (M|m)icrosoft ]]; then
if [[ ! -f /etc/sudoers.d/sudoers_no_password ]]; then
echo -n "WSL detected, do you want to install the sudoers configuration that allows the usage of no password for elevated commands? [Y/N] "
read -r -n 1 answer
if [[ $answer =~ ^[Yy]$ ]]; then
echo -e "\nInstalling sudoers configuration..."
# No linking possible since the config file has to broad permissions
sudo cp "${repoLocation}/Configurations/sudoers_no_password" "/etc/sudoers.d/"
else
echo -e "\nSkipping sudoers configuration..."
fi
else
echo "WSL detected, but sudoers configuration is already present"
fi
fi
echo "Finished 🎉"
exit 0