2023-07-18 21:03:52 -07:00
|
|
|
{{- if ne .host.distro.family "windows" -}}
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
# @file ~/.local/bin/mackup
|
|
|
|
# @brief Creates a wrapper around `mackup` to add support for XDG directories
|
|
|
|
# @description
|
|
|
|
# This script is a wrapper around the `mackup`. `Mackup` does not support XDG specification
|
|
|
|
# for its configuration. The script symlinks the `.config/mackup/.mackup/` folder to `~/.mackup` and
|
|
|
|
# the `.config/mackup/.mackup.cfg` file to `~/.mackup.cfg` before executing `mackup`. The symlinks
|
|
|
|
# are deleted after mackup runs.
|
|
|
|
#
|
|
|
|
# [mackup](https://github.com/lra/mackup) is a tool that can help in keeping your application settings
|
|
|
|
# in sync across multiple computers. It supports many different storage solutions like Dropbox, Google Drive, etc.
|
|
|
|
# to store the settings and sync them across machines. It can also help in restoring settings on a new installation.
|
|
|
|
# A number of applications are supported out of the box. It is trivial to add more applications. Refer to the
|
|
|
|
# [documentation](https://github.com/lra/mackup/blob/master/doc) for details.
|
|
|
|
|
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
|
2023-08-06 22:19:59 -07:00
|
|
|
### Create symlinks pointing to stored configurations
|
2023-08-07 22:29:21 -07:00
|
|
|
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup/" ~/.mackup
|
|
|
|
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup.cfg" ~/.mackup.cfg
|
2023-08-06 22:19:59 -07:00
|
|
|
|
|
|
|
### Run original mackup executable
|
2023-07-18 21:03:52 -07:00
|
|
|
if command -v brew > /dev/null && brew list | grep mackup > /dev/null; then
|
2023-08-06 22:19:59 -07:00
|
|
|
$(brew --prefix)/bin/mackup $* || echo ''
|
2023-07-18 21:03:52 -07:00
|
|
|
elif (command -v pip3 > /dev/null && pip3 list | grep mackup > /dev/null) || \
|
|
|
|
(command -v pip > dev/null && pip3 list | grep mackup > /dev/null) || \
|
|
|
|
(command -v pipx > dev/null && pipx list | grep mackup > /dev/null); then
|
2023-08-06 22:19:59 -07:00
|
|
|
~/.local/bin/mackup $* || echo ''
|
2023-07-18 21:03:52 -07:00
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn 'Homebrew/Python pip is not found. Install mackup using one of these methods'
|
2023-07-18 21:03:52 -07:00
|
|
|
fi
|
2023-08-06 22:19:59 -07:00
|
|
|
|
|
|
|
### Remove temporary configuration files
|
2023-07-18 21:03:52 -07:00
|
|
|
rm -f ~/.mackup
|
|
|
|
rm -f ~/.mackup.cfg
|
2023-08-06 22:19:59 -07:00
|
|
|
|
2023-07-18 21:03:52 -07:00
|
|
|
{{ end }}
|