mirror of
https://github.com/mentos1386/dotfiles.git
synced 2024-11-22 15:43:42 +00:00
48 lines
928 B
Bash
48 lines
928 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
REPO_DIR=$(dirname $(readlink -f $0))
|
||
|
HOME_DIR=${HOME}
|
||
|
OS_RELEASE=$(cat /etc/os-release | grep -E "^ID=" | cut -d= -f2)
|
||
|
|
||
|
echo_header() {
|
||
|
bold=$(tput bold)
|
||
|
normal=$(tput sgr0)
|
||
|
red=$(tput setaf 1)
|
||
|
echo "${bold}${red}$1${normal}"
|
||
|
}
|
||
|
|
||
|
workspace_link() {
|
||
|
mkdir -p $(dirname $HOME_DIR/$2)
|
||
|
rm $HOME_DIR/$2 || true
|
||
|
ln -s $REPO_DIR/$1 $HOME_DIR/$2 || true
|
||
|
}
|
||
|
|
||
|
GUI=NO
|
||
|
ENVIRONMENT=personal
|
||
|
while [[ $# -gt 0 ]]; do
|
||
|
case $1 in
|
||
|
--env)
|
||
|
ENVIRONMENT=$2
|
||
|
if [ "$ENVIRONMENT" != "personal" ] && [ "$ENVIRONMENT" != "work" ]; then
|
||
|
echo "Unknown environment $ENVIRONMENT"
|
||
|
exit 1
|
||
|
fi
|
||
|
shift # past argument
|
||
|
shift # past value
|
||
|
;;
|
||
|
--gui)
|
||
|
GUI=YES
|
||
|
shift # past argument
|
||
|
;;
|
||
|
-h | --help)
|
||
|
echo "Usage: install.sh [--gui]"
|
||
|
exit 0
|
||
|
;;
|
||
|
-* | --*)
|
||
|
echo "Unknown option $1"
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
echo_header "== DotFiles with GUI: $GUI and ENV: $ENVIRONMENT"
|