shellcheck
This commit is contained in:
parent
cd97c5e46a
commit
4e38646193
@ -8,12 +8,17 @@
|
|||||||
DOTFILES_REPO="$HOME/.dotfiles"
|
DOTFILES_REPO="$HOME/.dotfiles"
|
||||||
DOTFILES_REMOTE="https://git.rre.nu:443/jonas/dotfiles.git"
|
DOTFILES_REMOTE="https://git.rre.nu:443/jonas/dotfiles.git"
|
||||||
|
|
||||||
|
DOTFILES_RENAME_EXISTING_FILES=(
|
||||||
|
.bashrc
|
||||||
|
)
|
||||||
|
|
||||||
### NO Changes below this line
|
### NO Changes below this line
|
||||||
|
|
||||||
set -aeo pipefail
|
set -aeo pipefail
|
||||||
|
|
||||||
function asktobreak(){
|
function asktobreak(){
|
||||||
if [[ "$INITDESKTOP_YES" == 1 ]];then
|
if [[ "$INITDESKTOP_YES" == 1 ]];then
|
||||||
|
printf "\n"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
printf "Do you want to run this step (y/n)"
|
printf "Do you want to run this step (y/n)"
|
||||||
@ -21,6 +26,7 @@ function asktobreak(){
|
|||||||
if [[ $answer == [YyNn] ]];then
|
if [[ $answer == [YyNn] ]];then
|
||||||
[[ $answer == [Yy] ]] && return_value=1
|
[[ $answer == [Yy] ]] && return_value=1
|
||||||
[[ $answer == [Nn] ]] && return_value=0
|
[[ $answer == [Nn] ]] && return_value=0
|
||||||
|
printf "\n"
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -28,11 +34,11 @@ function asktobreak(){
|
|||||||
}
|
}
|
||||||
function new_log(){
|
function new_log(){
|
||||||
# script output
|
# script output
|
||||||
printf "\n**** [$*] ***\n"
|
printf "\n**** [%s] ***\n" "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
function log(){
|
function log(){
|
||||||
printf "$*\n"
|
printf "%s\n" "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
function gnome_key_bindings(){
|
function gnome_key_bindings(){
|
||||||
@ -45,13 +51,13 @@ function gnome_key_bindings(){
|
|||||||
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['$KEY_PATH/custom0/']"
|
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['$KEY_PATH/custom0/']"
|
||||||
|
|
||||||
# Open Terminator
|
# Open Terminator
|
||||||
$CMD/custom0/ name "Open Terminator"
|
"$CMD"/custom0/ name "Open Terminator"
|
||||||
$CMD/custom0/ command "terminator"
|
"$CMD"/custom0/ command "terminator"
|
||||||
$CMD/custom0/ binding "<Primary><Alt>Return"
|
"$CMD"/custom0/ binding "<Primary><Alt>Return"
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_dotfiles(){
|
function setup_dotfiles(){
|
||||||
local dotf="/usr/bin/git --git-dir="$DOTFILES_REPO" --work-tree=$HOME"
|
local dotf="/usr/bin/git --git-dir=$DOTFILES_REPO --work-tree=$HOME"
|
||||||
new_log "Setting up dotf (dotfiles)"
|
new_log "Setting up dotf (dotfiles)"
|
||||||
if asktobreak;then
|
if asktobreak;then
|
||||||
return
|
return
|
||||||
@ -59,19 +65,23 @@ function setup_dotfiles(){
|
|||||||
log "creating git repo in $DOTFILES_REPO"
|
log "creating git repo in $DOTFILES_REPO"
|
||||||
mkdir "$HOME/.dotfiles"
|
mkdir "$HOME/.dotfiles"
|
||||||
git init --bare "$DOTFILES_REPO"
|
git init --bare "$DOTFILES_REPO"
|
||||||
$dotf config --local status.showUntrackedFiles no
|
"$dotf" config --local status.showUntrackedFiles no
|
||||||
|
|
||||||
log "adding remote repo ($DOTFILES_REMOTE)"
|
log "adding remote repo ($DOTFILES_REMOTE)"
|
||||||
$dotf remote add origin "$DOTFILES_REMOTE"
|
"$dotf" remote add origin "$DOTFILES_REMOTE"
|
||||||
|
|
||||||
|
|
||||||
|
for file in "${DOTFILES_RENAME_EXISTING_FILES[@]}"; do
|
||||||
|
|
||||||
if [[ -f "$HOME/.bashrc" ]];then
|
if [[ -f "$HOME/.bashrc" ]];then
|
||||||
log "renaming local .bashrc to .bashrc.bak"
|
log "renaming local $file to ${file}.bak"
|
||||||
mv "$HOME/.bashrc" "$HOME/.bashrc.bak"
|
mv "$HOME/$file" "$HOME/${file}.bak"
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
log "fetching dotfiles"
|
log "fetching dotfiles"
|
||||||
$dotf fetch origin
|
"$dotf" fetch origin
|
||||||
$dotf checkout master
|
"$dotf" checkout master
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_salt_call(){
|
function do_salt_call(){
|
||||||
@ -80,7 +90,7 @@ function do_salt_call(){
|
|||||||
if asktobreak;then
|
if asktobreak;then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
$salt state.apply pillar="{username: $USER}"
|
"$salt" state.apply pillar="{username: $USER}"
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_dotfiles
|
setup_dotfiles
|
||||||
|
Loading…
Reference in New Issue
Block a user