Non-interactive setup

This commit is contained in:
Daniel Flanagan 2019-03-29 13:30:15 -05:00
parent 5729004665
commit d6cdb0f582

32
setup
View file

@ -2,6 +2,17 @@
# TODO: ascii art header # TODO: ascii art header
INTERACTIVE=1
while test $# -gt 0; do
case "$1" in
-x|--non-interactive)
INTERACTIVE=0
shift
;;
esac
done
dfp=$(cd "$(dirname "${BASH_SOURCE[0]}" )/" && pwd) dfp=$(cd "$(dirname "${BASH_SOURCE[0]}" )/" && pwd)
source "${dfp}/scripts/setup_helpers.bash" source "${dfp}/scripts/setup_helpers.bash"
@ -83,15 +94,18 @@ links=(
"$dfp/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs" "$dfp/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs"
) )
# TODO: pass interactive?
_dotfiles_setup_run_setup "$dfp/.agreed-to-erasing-files.lock" "${links[@]}" _dotfiles_setup_run_setup "$dfp/.agreed-to-erasing-files.lock" "${links[@]}"
echo -n -e "Do you want to run the sudo_setup script for changes to /etc" if [[ "$INTERACTIVE" = 1 ]]; then
echo -n -e "\nand other root directories?" echo -n -e "Do you want to run the sudo_setup script for changes to /etc"
read -r -p " [y/N] " response echo -n -e "\nand other root directories?"
response=${response,,} # to lower case read -r -p " [y/N] " response
if [[ $response =~ ^(yes|y)$ ]]; then response=${response,,} # to lower case
"$dfp/sudo_setup" if [[ $response =~ ^(yes|y)$ ]]; then
fi "$dfp/sudo_setup"
fi
echo -e "Dotfiles Installed! Running 'exec bash'...\n" echo -e "Dotfiles Installed! Running 'exec bash'...\n"
exec bash exec bash
fi