gis/install.bash
2023-09-20 10:38:27 +00:00

23 lines
559 B
Bash
Executable file

#!/usr/bin/env bash
# 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
ln -frs "${basedir}/gis" ~/.local/bin/gis
echo "Created link '~/.local/bin/gis'"
# Modify bashrc
touch ~/.bashrc
_add_to_config "export PATH=\$PATH:${HOME}/.local/bin"
echo "Updated '~/.bashrc'"
echo
echo "Source ~/.bashrc to use gis"
echo "To update gis in future execute 'git pull' in '${basedir}'"