Non-interactive setup

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

30
setup
View file

@ -2,6 +2,17 @@
# 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)
source "${dfp}/scripts/setup_helpers.bash"
@ -83,15 +94,18 @@ links=(
"$dfp/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs"
)
# TODO: pass interactive?
_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"
echo -n -e "\nand other root directories?"
read -r -p " [y/N] " response
response=${response,,} # to lower case
if [[ $response =~ ^(yes|y)$ ]]; then
if [[ "$INTERACTIVE" = 1 ]]; then
echo -n -e "Do you want to run the sudo_setup script for changes to /etc"
echo -n -e "\nand other root directories?"
read -r -p " [y/N] " response
response=${response,,} # to lower case
if [[ $response =~ ^(yes|y)$ ]]; then
"$dfp/sudo_setup"
fi
fi
echo -e "Dotfiles Installed! Running 'exec bash'...\n"
exec bash
echo -e "Dotfiles Installed! Running 'exec bash'...\n"
exec bash
fi