Move everything possible into XDG directories
With the help of xdg-ninja (https://github.com/b3nj5m1n/xdg-ninja) we move all kinds of config/cache files into the XDG directories
This commit is contained in:
parent
7ceed45a28
commit
13b8724696
27 changed files with 131 additions and 42 deletions
|
|
@ -56,7 +56,7 @@ _command_exists exa && alias exa='exa --group-directories-first --git --time-sty
|
|||
_command_exists netstat && alias ports='netstat -tulanp'
|
||||
_command_exists screenfetch && alias screenfetch='screenfetch -n'
|
||||
alias uptime='uptime --pretty'
|
||||
alias wget='wget --continue'
|
||||
alias wget="wget --continue --hsts-file=$XDG_STATE_HOME/wget/history"
|
||||
|
||||
|
||||
# Create shorter aliases for various utilities
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
# This file initializes the ~/.dotfiles as a bare repository
|
||||
# This file sets up the $XDG_DATA_HOME/dotfiles, a bare git repository,
|
||||
# such that they are available within a user's $HOME as common "dotfiles"
|
||||
|
||||
|
||||
export XDG_DATA_HOME="$HOME/.local/share" # temporarily set here; mainly set in ~/.profile
|
||||
|
||||
|
||||
_command_exists() {
|
||||
|
|
@ -14,14 +18,27 @@ rm -rf "$HOME/.dotfiles" >/dev/null
|
|||
git clone --bare https://code.webartifex.biz/alexander/dotfiles.git "$HOME/.dotfiles"
|
||||
|
||||
# Distribute the dotfiles in $HOME
|
||||
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME checkout --force
|
||||
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME config --local status.showUntrackedFiles no
|
||||
git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME checkout --force
|
||||
git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME config --local status.showUntrackedFiles no
|
||||
# Dirty Fix: Otherwise `gnupg` emits a warning
|
||||
[ -d "$XDG_DATA_HOME/gnupg" ] && chmod 700 $XDG_DATA_HOME/gnupg
|
||||
|
||||
|
||||
if _command_exists zsh; then
|
||||
|
||||
# Set the $ZDOTDIR in /etc[/zsh]/zshenv if that is not already done
|
||||
# Notes:
|
||||
# - must use $HOME as $XDG_CONFIG_HOME is not yet set
|
||||
# - on Fedora, the global config files are not in /etc/zsh but in /etc
|
||||
export ZDOTDIR="$HOME/.config/zsh"
|
||||
for _file in '/etc/zshenv' '/etc/zsh/zshenv'; do
|
||||
if [ -f $_file ]; then
|
||||
grep -q -F "export ZDOTDIR" $_file || echo 'export ZDOTDIR="$HOME"/.config/zsh' | sudo tee -a $_file
|
||||
fi
|
||||
done
|
||||
|
||||
# (Re-)Install oh-my-zsh
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
export ZSH="$XDG_DATA_HOME/oh-my-zsh" # temporarily set here; mainly set in $XDG_CONFIG_HOME/zsh/.zshenv
|
||||
rm -rf $ZSH >/dev/null
|
||||
# Let's NOT use the main repository but our personal fork
|
||||
git clone --origin fork --branch forked https://code.webartifex.biz/alexander/oh-my-zsh.git $ZSH
|
||||
|
|
@ -30,16 +47,19 @@ if _command_exists zsh; then
|
|||
cd $HOME
|
||||
|
||||
# (Re-)Install zplug
|
||||
export ZPLUG_HOME="$HOME/.zplug"
|
||||
export ZPLUG_HOME="$XDG_DATA_HOME/zplug" # temporarily set here; mainly set in $XDG_CONFIG_HOME/zsh/.zshenv
|
||||
rm -rf $ZPLUG_HOME >/dev/null
|
||||
git clone https://github.com/zplug/zplug $ZPLUG_HOME
|
||||
|
||||
# Set up all the zplug plugins (-i so that the new ~/.zshrc is sourced)
|
||||
# Set up all the zplug plugins (-i so that the new $XDG_CONFIG_HOME/zsh/.zshrc is sourced)
|
||||
zsh -i -c "zplug install"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Disable the creation of ~/.sudo_as_admin_successful
|
||||
echo 'Defaults !admin_flag' | sudo tee /etc/sudoers.d/disable_admin_note
|
||||
|
||||
|
||||
echo
|
||||
echo "Probably it's a good idea to restart the shell"
|
||||
echo "Make sure to start bash or zsh as a login shell the next time"
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ _update_repositories() {
|
|||
|
||||
ZSH_DOTENV_FILE='.env'
|
||||
|
||||
_command_exists pass && echo "Fetching $HOME/.password-store" && pass git pull
|
||||
_command_exists pass && echo "Fetching $XDG_DATA_HOME/pass" && pass git pull
|
||||
_update_dotfiles
|
||||
|
||||
cd $cwd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue