-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·42 lines (29 loc) · 863 Bytes
/
install.sh
File metadata and controls
executable file
·42 lines (29 loc) · 863 Bytes
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
#!/bin/bash
INSTALL_PATH="/usr/local/bin"
install() {
uninstall
SCRIPT_URL="https://raw.githubusercontent.com/antonioolf/cdi/master/cdi.sh"
TMP_FILE="$(mktemp)"
if [ ! -d "$INSTALL_PATH" ]; then
sudo mkdir -p $INSTALL_PATH
fi
echo "Downloading CDI..."
wget -q --show-progress -O "$TMP_FILE" "$SCRIPT_URL" &&
sudo mv $TMP_FILE "$INSTALL_PATH/cdi.sh"
# Add execution permission
sudo chmod +x "$INSTALL_PATH/cdi.sh"
# Appends alias for cdi execution in .bashrc file and source it
echo "
alias cdi='. $INSTALL_PATH/cdi.sh'
" >> ~/.bashrc
. ~/.bashrc
}
uninstall() {
# Deletes cdi script from installation folder
sudo rm -f "$INSTALL_PATH/cdi.sh"
echo "Removing older versions of CDI"
# Remove alias for cdi in in .bashrc
sed '/alias cdi=/d' -i ~/.bashrc
. ~/.bashrc
}
install