-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.bash
executable file
·32 lines (27 loc) · 1020 Bytes
/
install.bash
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
#!/usr/bin/env bash
# Check 'column' dependency
if ! command -v column &> /dev/null; then
echo "Command 'column' not available on the system, please make sure all dependencies are fulfilled."
exit 1
fi
# Adds $1 to ~/.bashrc if not already present
function _add_to_config {
if ! grep "$1" ~/.bashrc > /dev/null; then
echo "$1" >> ~/.bashrc
fi
}
# Link files
basedir="$(dirname "$(realpath "$0")")"
mkdir -p ~/.local/{bin,share/bash-completion/completions}
ln -frs "${basedir}/gis" ~/.local/bin/gis
echo "Created link '~/.local/bin/gis'"
ln -frs "${basedir}/gis_completion.bash" ~/.local/share/bash-completion/completions/gis
echo "Created link '~/.local/share/bash-completion/completions/gis'"
# Modify bashrc
touch ~/.bashrc
_add_to_config "export PATH=\$PATH:${HOME}/.local/bin"
_add_to_config "source ${HOME}/.local/share/bash-completion/completions/gis"
echo "Updated '~/.bashrc'"
echo
echo "Source ~/.bashrc to use gis"
echo "To update gis in future execute 'git pull' in '${basedir}'"