-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·133 lines (109 loc) · 3.49 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
echo "******************************"
echo "* DevPod installation Script *"
echo "******************************"
function aptInstall {
local app=$1
if [[ -z "$app" ]]; then
echo "Invalid argument missing component name"
return 1
fi
local appInstalled=$(dpkg -l | grep -iq "^ii\s*$app" && echo "installed")
# Guard clause to not install more than once
if [[ -n $appInstalled ]]; then
echo "$app is installed by apt-get"
return 0;
fi
echo "apt-get Installing: $app"
sudo apt-get update
sudo apt-get install "$app" -y
}
function cargoInstall {
local app=$1
local echoBootstrap=$2
if [[ -z "$app" ]]; then
echo "Missing required argument: the name of the cargo package to install"
return 1
fi
local installed=$(cargo install --list | grep -iq "$app" && echo "installed")
# Guard clause to not install more than once
if [[ -n $installed ]]; then
echo "$app is installed by cargo"
return 0;
fi
echo "Cargo Installing: $app"
cargo install "$app" --locked
}
function createAlias() {
local aliasName=$1
local aliasValue=$2
local aliasExists=$(grep "alias $aliasName=\"$aliasValue\"" "$RC_FILE")
[[ -n $aliasExists ]] || echo "alias $aliasName=\"$aliasValue\"" >> "$RC_FILE"
}
# sudo apt-get install zsh -y
# sudo chsh -s /usr/bin/zsh
# /bin/zsh # start the shell
if $SHELL *= "/bin/zsh"; then
STARSHIP_SHELL="zsh"
RC_FILE="$HOME/.zshrc"
else
STARSHIP_SHELL="bash"
RC_FILE="$HOME/.bashrc"
fi
echo "============================ $SHELL <<<<<<<<<<<<<<<<<<<<<<<<<"
aptInstall build-essential
aptInstall unzip
aptInstall xclip
aptInstall cmake
if $SHELL *= "/bin/zsh"; then
# Install Oh-My-Zsh
if [ ! -d ~/.oh-my-zsh ]; then
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
fi
# Install Autosuggestions for Oh-My-Zsh
if [ ! -d ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
sed -i 's/^plugins=(\(.*\))/plugins=(\1 zsh-autosuggestions)/' $RC_FILE
fi
fi
if ! which rustup; then
echo "Installing Rust via Rustup"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# https://stackoverflow.com/questions/57251508/run-rustups-curl-fetched-installer-script-non-interactively
# `-s` parameter: you set sh to read command from the standard input
# `-y` to auto accept options
source ~/.cargo/env
fi
cargoInstall "bob-nvim"
cargoInstall "bat"
cargoInstall "ripgrep"
cargoInstall "eza"
cargoInstall "tealdeer"
createAlias "cat" "bat"
createAlias "ls" "eza"
createAlias "ll" "eza -lh"
createAlias "c" "clear"
if ! which nvim; then
echo "Installing NeoVim Stable"
bob install stable
bob use stable
echo 'export PATH=$PATH:$HOME/.local/share/bob/nvim-bin' >> $RC_FILE
source $RC_FILE
fi
# TODO: extend cargoInstall to hadle the echo eval line
if ! which -s starship; then
echo "Installing Starship Prompt 🚀"
cargo install starship --locked
if $STARSHIP_SHELL = "zsh"; then
echo 'eval "$(starship init zsh)"' >> $RC_FILE
else
echo 'eval "$(starship init bash)"' >> $RC_FILE
fi
source $RC_FILE
fi
rm "$HOME/.config/starship.toml"
ln -sf "$PWD/.config/nvim" "$HOME/.config/nvim"
ln -sf "$PWD/.config/starship.toml" "$HOME/.config/starship.toml"
ln -sf "$PWD/sample.gitconfig" "$HOME/.gitconfig"
ln -sf "$PWD/.config/tealdeer" "$HOME/.config/tealdeer"
ln -sf "$PWD/sample.devpod.ssh.config" "$HOME/.ssh/config"