From 3f4aeda4ada98f8626b2d4e98ed3178e07f4bdfe Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sat, 1 Aug 2020 13:21:48 +0200 Subject: [PATCH] added initDesktop --- bin/initDesktop | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 bin/initDesktop diff --git a/bin/initDesktop b/bin/initDesktop new file mode 100755 index 0000000..125aa14 --- /dev/null +++ b/bin/initDesktop @@ -0,0 +1,56 @@ +#!/bin/bash +# Set up my desktop/laptop with all default setttings that I want. +# +# uses salt-call masterless configuration. + +DOTFILES_REPO="$HOME/.dotfiles" +DOTFILES_REMOTE="https://git.rre.nu:443/jonas/dotfiles.git" + +### NO Changes below this line + +set -aeo pipefail + +function new_log(){ + # script output + printf "[*] - $*\n" +} + +function log(){ + printf " $*\n" +} + +function gnome_key_bindings(){ + 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/']" + + # Open Terminator + $CMD/custom0/ name "Open Terminator" + $CMD/custom0/ command "terminator" + $CMD/custom0/ binding "Return" +} + +function setup_dotfiles(){ + local dotf="/usr/bin/git --git-dir="$DOTFILES_REPO" --work-tree=$HOME" + new_log "Setting up dotf (dotfiles)" + + log "creating git repo in $DOTFILES_REPO" + mkdir "$HOME/.dotfiles" + git init --bare "$DOTFILES_REPO" + $dotf config --local status.showUntrackedFiles no + + log "adding remote repo ($DOTFILES_REMOTE)" + $dotf remote add origin "$DOTFILES_REMOTE" + $dotf branch --set-upstream-to=origin/master master + $dotf pull.ff only + + if [[ -f "$HOME/.bachrc" ]];then + log "renaming local .bashrc to .bashrc.bak" + mv "$HOME/.bashrc" "$HOME/.bashrc.bak" + fi + + log "pulling dotfiles" + $dotf pull +} + +setup_dotfiles