From c9d2cf6c805aee6f897d17dd0bba805d889a8907 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Tue, 25 Jun 2024 00:06:22 +0200 Subject: [PATCH] Add post install/update functionality. --- config/zsh/.zshrc | 3 +++ config/zsh/aliases.zsh | 2 +- install.sh | 8 +++++--- scripts/post-install.sh | 13 +++++++++++++ scripts/post-update.sh | 3 +++ 5 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 scripts/post-install.sh create mode 100644 scripts/post-update.sh diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc index 69f3a4a..071d946 100644 --- a/config/zsh/.zshrc +++ b/config/zsh/.zshrc @@ -65,6 +65,9 @@ if [[ -f ~/.note ]]; then echo fi +# cleaning +rm -rf ~/.warprc + # local settings if [[ -f ~/.local/config/zsh ]]; then source ~/.local/config/zsh diff --git a/config/zsh/aliases.zsh b/config/zsh/aliases.zsh index a311732..1657dee 100644 --- a/config/zsh/aliases.zsh +++ b/config/zsh/aliases.zsh @@ -46,7 +46,7 @@ fi function ud() { for i in ${LOCAL_GIT_DIR}/dotfiles ${LOCAL_GIT_DIR}/zsh_modules/*; do git -C ${i} pull; done - nvim -c "lua require('lazy').sync({wait = true})" + . ${LOCAL_GIT_DIR}/dotfiles/scripts/post-update.sh } function upgrade() { diff --git a/install.sh b/install.sh index 80b01c8..73ec9b7 100644 --- a/install.sh +++ b/install.sh @@ -8,7 +8,7 @@ XDG_DATA_HOME=${HOME}/.local/share XDG_STATE_HOME=${HOME}/.local/state # clean + prepare local dirs -rm -rf ~/.cache ~/.config/_cache ~/.fdignore ~/.fzf.bash ~/.fzf.zsh ~/.gitconfig ~/.gitignore ~/.history ~/.tmux.conf ~/.vim* ~/.zcomp* ~/.zsh* +rm -rf ~/.cache ~/.config/_cache ~/.fdignore ~/.fzf.bash ~/.fzf.zsh ~/.gitconfig ~/.gitignore ~/.history ~/.hushlogin ~/.tmux.conf ~/.vim* ~/.zcomp* ~/.zsh* rm -rf ${XDG_CACHE_HOME} ${XDG_DATA_HOME}/nvim ${XDG_STATE_HOME}/nvim mkdir -p ${XDG_CACHE_HOME} ${XDG_CONFIG_HOME} ${XDG_DATA_HOME} chmod 700 ${XDG_CACHE_HOME} @@ -31,5 +31,7 @@ for i in ${LOCAL_GIT_DIR}/dotfiles/config/*; do ln -sf ${LOCAL_GIT_DIR}/dotfiles/config/$(basename $i) ${XDG_CONFIG_HOME}/ done -# nvim setup -nvim -c "lua require('lazy').sync({wait = true})" -c "MasonInstallAll" +# execute post-install script +printf "Running post-install script... " +. ${LOCAL_GIT_DIR}/dotfiles/scripts/post-install.sh +echo "done." diff --git a/scripts/post-install.sh b/scripts/post-install.sh new file mode 100644 index 0000000..a9c2bc0 --- /dev/null +++ b/scripts/post-install.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# basic git configuration +if [[ ! -d ${XDG_CONFIG_HOME}/git ]]; then + mkdir -p ${XDG_CONFIG_HOME}/git + cat << EOF > ${XDG_CONFIG_HOME}/git/config + [pull] + rebase = true +EOF +fi + +# nvim setup +nvim -c "lua require('lazy').sync({wait = true})" -c "MasonInstallAll" diff --git a/scripts/post-update.sh b/scripts/post-update.sh new file mode 100644 index 0000000..b223649 --- /dev/null +++ b/scripts/post-update.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +nvim -c "lua require('lazy').sync({wait = true})"