added asktobreak and salt
This commit is contained in:
parent
64d0510af6
commit
a6142a9564
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user