#!/bin/bash # Set up my desktop/laptop with all default setttings that I want. # # uses salt-call masterless configuration. # # to auto answer YES set the INITDESKTOP_YES=1 environment variable DOTFILES_REPO="$HOME/.dotfiles" DOTFILES_REMOTE="https://git.rre.nu:443/jonas/dotfiles.git" DOTFILES_RENAME_EXISTING_FILES=( .bashrc ) ### NO Changes below this line set -aeo pipefail function printHelp(){ cat << EOF Usage ${0##*/} [options..] -h,-?, --help Show help and exit -f, --firefox configure firefox and install addons -g, --gnome configure gnome and install extentions -d, --dotfiles configure dotfiles -s, --salt run a masterless salt-call -y, --yes answer 'yes' on all questions EOF } function asktobreak(){ if [[ "$ANSWER_YES" == true ]];then printf "\n" return 1 fi printf "Do you want to run this step (y/n)" while read -r -n 1 -s answer; do if [[ $answer == [YyNn] ]];then [[ $answer == [Yy] ]] && return_value=1 [[ $answer == [Nn] ]] && return_value=0 printf "\n" break; fi done return $return_value } function new_log(){ # script output printf "\n**** [%s] ***\n" "$*" } function log(){ printf "%s\n" "$*" } function gnome_config(){ new_log "Setting my default gnome bindings" log "WARNING! All running firefox instances will be killed" if asktobreak; then return fi pkill -f firefox firefox log "Launching firefox to install GNOME Extetions" firefox https://extensions.gnome.org/extension/1031/topicons/ firefox https://extensions.gnome.org/extension/600/launch-new-instance/ firefox https://extensions.gnome.org/extension/921/multi-monitors-add-on/ log "loading dconf settings" dconf load < cat <&2 exit 1 ;; *) #Break out of case, no more options break esac shift done [[ $ALL == true ]] || [[ $DOTFILES == true ]] && setup_dotfiles [[ $ALL == true ]] || [[ $SALT == true ]] && do_salt_call [[ $ALL == true ]] || [[ $FIREFOX == true ]] && firefox_config [[ $ALL == true ]] || [[ $GNOME == true ]] && gnome_config printf "\n DONE!!!!!!!\n"