personal-linux-config/deploy.sh

56 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2021-06-03 17:45:49 +02:00
SERVER=false
FORCE=false
_arguments() {
for PARM in "$@"; do
if [ "${PARM}" = "--server" ]; then
2021-06-03 17:45:49 +02:00
SERVER=true
2021-06-03 17:44:18 +02:00
elif [ "${PARM}" = "--force" ]; then
2021-06-03 17:45:49 +02:00
FORCE=true
elif [ "${PARM}" = "-h" ] || [ "${PARM}" = "--help" ]; then
_help
exit 0
fi
done
}
_help() {
echo "Usage: $(readlink -fm "$0") [-h | --help] [--cleanup]"
echo
echo "Options:"
echo " -h | --help"
echo " Prints this help message and quits"
echo " --force"
echo " Force the reinstallation of the files"
echo " --server"
echo " Customizes the terminal feel for a server installation"
echo
}
_bashrc_ref() {
echo "#REF:bashrc_overrides:REF" >> ~/.bashrc
echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc
}
_main() {
_arguments "$@"
if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then
echo "bash overrides already in place"
echo "skipping..."
echo
else
_bashrc_ref
echo "bash overrides added"
echo
fi
if [ "${SERVER}" = true ]; then
sed -i 's/terminal_fancyfying/terminal_fancyfying_server/' ~/.bashrc_overrides/_all
fi
}
_main "$@"