From a6142a9564cb66b5a025a9149a52773feb95566b Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sat, 1 Aug 2020 14:06:50 +0200 Subject: [PATCH] added asktobreak and salt --- bin/initDesktop | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/bin/initDesktop b/bin/initDesktop index e6f6d0a..100854c 100755 --- a/bin/initDesktop +++ b/bin/initDesktop @@ -10,6 +10,17 @@ DOTFILES_REMOTE="https://git.rre.nu:443/jonas/dotfiles.git" set -aeo pipefail +function asktobreak(){ + 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 + break; + fi + done + return $return_value +} function new_log(){ # script output printf "\n**** [$*] ***\n" @@ -20,6 +31,10 @@ function log(){ } function gnome_key_bindings(){ + new_log "Setting my default gnome bindings" + if asktobreak; then + return + fi local KEY_PATH="/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings" local CMD="gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH" gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['$KEY_PATH/custom0/']" @@ -33,7 +48,9 @@ function gnome_key_bindings(){ function setup_dotfiles(){ local dotf="/usr/bin/git --git-dir="$DOTFILES_REPO" --work-tree=$HOME" new_log "Setting up dotf (dotfiles)" - + if asktobreak;then + return + fi log "creating git repo in $DOTFILES_REPO" mkdir "$HOME/.dotfiles" git init --bare "$DOTFILES_REPO" @@ -52,4 +69,12 @@ function setup_dotfiles(){ $dotf checkout master } +function do_salt_call(){ + alias salt='sudo salt-call --local --file-root "$HOME/salt/states" --pillar-root "$HOME/salt/pillars" "$@"' + new_log "Running salt high state" + if asktobreak;then + return + fi + salt state.apply +} setup_dotfiles