Move mackup's config to $XDG_CONFIG_HOME/mackup
- move all of mackup's config files into $XDG_CONFIG_HOME/mackup: + ~/.mackup.cfg => configs for mackup itself + ~/.mackup/*.cfg => custom sync rules applied by mackup - add automatic installation of `pipx` and `mackup` during the setup of the dotfiles + `pipx`'s config is moved into $XDG_CONFIG_HOME + `mackup`s config locations are adapted via a "little hack"
This commit is contained in:
parent
f76b32b790
commit
1cccb7df0e
10 changed files with 68 additions and 6 deletions
16
.config/mackup/README.md
Normal file
16
.config/mackup/README.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Configuration for `mackup`
|
||||
|
||||
This folder contains various **config** files
|
||||
to make [`mackup`](https://github.com/lra/mackup)
|
||||
synchronize (dot) files the general public should *not* see.
|
||||
Their format is described [here](https://github.com/lra/mackup/tree/master/doc#add-support-for-an-application-or-almost-any-file-or-directory).
|
||||
|
||||
|
||||
## Changed Location
|
||||
|
||||
`mackup`'s default configuration lies the the ~/.mackup.cfg file
|
||||
and in the ~/.mackup folder that holds config files with
|
||||
custom sync rules not supported "out of the box."
|
||||
|
||||
With a "little hack" during the setup of the dotfiles in this repository,
|
||||
`mackup`s config files are moved to $XDG_CONFIG_HOME/mackup.
|
5
.config/mackup/gnupg.cfg
Normal file
5
.config/mackup/gnupg.cfg
Normal file
|
@ -0,0 +1,5 @@
|
|||
[application]
|
||||
name = gnupg
|
||||
|
||||
[configuration_files]
|
||||
.local/share/gnupg/trustdb.gpg
|
|
@ -24,3 +24,12 @@ zsh
|
|||
# Do not sync $XDG_DATA_HOME/password-store as it contains symlinks
|
||||
# that Nextcloud does NOT support
|
||||
pass
|
||||
|
||||
|
||||
# This section is mainly needed such that this file
|
||||
# does not cause a ConfigParser error
|
||||
# => Background: The enclosing folder should only
|
||||
# contain config files for individual applications
|
||||
# that are to be synced and not mackup's own config
|
||||
[application]
|
||||
name = mackup
|
|
@ -2,6 +2,7 @@
|
|||
# such that they are available within a user's $HOME as common "dotfiles"
|
||||
|
||||
|
||||
export XDG_BIN_HOME="$HOME/.local/bin" # temporarily set here; mainly set in ~/.profile
|
||||
export XDG_DATA_HOME="$HOME/.local/share" # temporarily set here; mainly set in ~/.profile
|
||||
|
||||
|
||||
|
@ -24,6 +25,27 @@ git --git-dir=$XDG_DATA_HOME/dotfiles/ --work-tree=$HOME config --local status.s
|
|||
[ -d "$XDG_DATA_HOME/gnupg" ] && chmod 700 $XDG_DATA_HOME/gnupg
|
||||
|
||||
|
||||
if _command_exists pip; then
|
||||
|
||||
# Ensure `pipx` is installed in the user's local environment
|
||||
pip install --upgrade --user pipx
|
||||
|
||||
# (Re-)Install `mackup` via `pipx` in the user's local environment
|
||||
export PIPX_BIN_DIR=$XDG_BIN_HOME
|
||||
export PIPX_HOME="$XDG_DATA_HOME/pipx"
|
||||
$XDG_BIN_HOME/pipx uninstall mackup
|
||||
$XDG_BIN_HOME/pipx install mackup
|
||||
|
||||
# Litte Hack: Make `mackup` respect the XDG directory structure
|
||||
sed -in 's/VERSION = \".*\"/VERSION = \"0.999.0\"/g' $HOME/.local/**/mackup/constants.py
|
||||
sed -in 's/CUSTOM_APPS_DIR = \"\.mackup\"/CUSTOM_APPS_DIR = \"\.config\/mackup\"/g' $HOME/.local/**/mackup/constants.py
|
||||
sed -in 's/MACKUP_CONFIG_FILE = \"\.mackup\.cfg\"/MACKUP_CONFIG_FILE = \"\.config\/mackup\/mackup\.cfg\"/g' $HOME/.local/**/mackup/constants.py
|
||||
|
||||
$XDG_BIN_HOME/mackup restore
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if _command_exists zsh; then
|
||||
|
||||
# Set the $ZDOTDIR in /etc[/zsh]/zshenv if that is not already done
|
||||
|
@ -60,6 +82,17 @@ fi
|
|||
echo 'Defaults !admin_flag' | sudo tee /etc/sudoers.d/disable_admin_note
|
||||
|
||||
|
||||
# Warn user if ~/.local/pipx already exists
|
||||
# => As we use the custom $XDG_DATA_HOME/pipx location,
|
||||
# the user should NOT `pipx`'s default install location as well
|
||||
if [ -d "$HOME/.local/pipx" ]; then
|
||||
echo
|
||||
echo "~/.local/pipx already existed!"
|
||||
echo "It is recommended to delete this location in favor of $XDG_DATA_HOME/pipx"
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
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"
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
# Configuration for `mackup`
|
||||
|
||||
This folder contains various **config** files
|
||||
to make [`mackup`](https://github.com/lra/mackup)
|
||||
synchronize (dot) files the general public should *not* see.
|
||||
Their format is described [here](https://github.com/lra/mackup/tree/master/doc#add-support-for-an-application-or-almost-any-file-or-directory).
|
5
.profile
5
.profile
|
@ -11,6 +11,9 @@ export XDG_CACHE_HOME="$HOME/.cache"
|
|||
export XDG_CONFIG_HOME="$HOME/.config"
|
||||
export XDG_DATA_HOME="$HOME/.local/share" # also set temporarily in $XDG_DATA_HOME/dotfiles/setup.sh
|
||||
export XDG_STATE_HOME="$HOME/.local/state" # also set temporarily in $XDG_DATA_HOME/dotfiles/setup.sh
|
||||
# Make up a XDG directory for binaries (that does not exist in the standard)
|
||||
export XDG_BIN_HOME="$HOME/.local/bin" # also set temporarily in $XDG_DATA_HOME/dotfiles/setup.sh
|
||||
|
||||
|
||||
# Move common tools' config and cache files into XDG directories
|
||||
export BAT_CONFIG_PATH="$XDG_CONFIG_PATH/bat/config"
|
||||
|
@ -18,6 +21,7 @@ export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv"
|
|||
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
|
||||
export LESSHISTFILE="$XDG_STATE_HOME/less/history"
|
||||
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass"
|
||||
export PIPX_HOME="$XDG_DATA_HOME/pipx"
|
||||
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc"
|
||||
export PSQLRC="$XDG_CONFIG_HOME/psql/psqlrc"
|
||||
export SSB_HOME="$XDG_DATA_HOME"/zoom
|
||||
|
@ -37,6 +41,7 @@ export REPOS="$HOME/repos"
|
|||
|
||||
|
||||
# Python-specific configs
|
||||
export PIPX_BIN_DIR=$XDG_BIN_HOME
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
# No need for *.pyc files on a dev machine
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
|
|
Loading…
Reference in a new issue