From f676442f86e530227124e4077efbf11c44ea4f5f Mon Sep 17 00:00:00 2001 From: "tfranken@laurier" Date: Fri, 25 Feb 2022 10:07:59 +0100 Subject: [PATCH] toansible: Make shell dependency work with and and sources to bash and zsh --- roles/bash/files/bash_profile.ansible | 2 +- roles/bash/files/bashrc.ansible | 2 +- dotfiles/shell/aliases => roles/shell/files/shell_aliases | 0 dotfiles/shell/profile => roles/shell/files/shell_profile | 0 roles/shell/tasks/main.yml | 6 ++++++ roles/zsh/files/zprofile | 2 +- roles/zsh/files/zshrc | 2 +- 7 files changed, 10 insertions(+), 4 deletions(-) rename dotfiles/shell/aliases => roles/shell/files/shell_aliases (100%) rename dotfiles/shell/profile => roles/shell/files/shell_profile (100%) create mode 100644 roles/shell/tasks/main.yml diff --git a/roles/bash/files/bash_profile.ansible b/roles/bash/files/bash_profile.ansible index e33cc97..5afc79e 100644 --- a/roles/bash/files/bash_profile.ansible +++ b/roles/bash/files/bash_profile.ansible @@ -6,4 +6,4 @@ export PATH="$HOME/.local/bin:$PATH" [[ -f ~/.bashrc ]] && . ~/.bashrc # Load items that are common to bash and zsh -[[ -f ~/setup-cockpit/dotfiles/shell/profile ]] && . ~/setup-cockpit/dotfiles/shell/profile +[[ -f ~/.shell_profile ]] && . ~/.shell_profile diff --git a/roles/bash/files/bashrc.ansible b/roles/bash/files/bashrc.ansible index cc5dc35..357f1c0 100644 --- a/roles/bash/files/bashrc.ansible +++ b/roles/bash/files/bashrc.ansible @@ -10,7 +10,7 @@ shopt -s histappend # append to the history file, don't overwrite it HISTSIZE=10000 HISTFILESIZE=10000 -. "$HOME"/setup-cockpit/dotfiles/shell/aliases +. "$HOME"/.shell_aliases if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion diff --git a/dotfiles/shell/aliases b/roles/shell/files/shell_aliases similarity index 100% rename from dotfiles/shell/aliases rename to roles/shell/files/shell_aliases diff --git a/dotfiles/shell/profile b/roles/shell/files/shell_profile similarity index 100% rename from dotfiles/shell/profile rename to roles/shell/files/shell_profile diff --git a/roles/shell/tasks/main.yml b/roles/shell/tasks/main.yml new file mode 100644 index 0000000..aadbd65 --- /dev/null +++ b/roles/shell/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- name: Copy common shell rc files + copy: src={{ item.src }} dest={{ item.dest }} backup=true + with_items: + - { src: 'shell_aliases', dest: '~/.shell_aliases' } + - { src: 'shell_profile', dest: '~/.shell_profile' } diff --git a/roles/zsh/files/zprofile b/roles/zsh/files/zprofile index d66bd2a..d44ead2 100644 --- a/roles/zsh/files/zprofile +++ b/roles/zsh/files/zprofile @@ -2,4 +2,4 @@ # # Load items that are common to bash and zsh -[[ -f ~/setup-cockpit/dotfiles/shell/profile ]] && source ~/setup-cockpit/dotfiles/shell/profile +[[ -f ~/.shell_profile ]] && source ~/.shell_profile diff --git a/roles/zsh/files/zshrc b/roles/zsh/files/zshrc index 444f016..060d8be 100644 --- a/roles/zsh/files/zshrc +++ b/roles/zsh/files/zshrc @@ -15,7 +15,7 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] fi # ALIASES -source ~/setup-cockpit/dotfiles/shell/aliases +source ~/.shell_aliases # On Arch Linux, source pkgfile "command not found" hook [[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh