install.fairie/home/dot_local/bin/mackup/executable_mackup.tmpl

34 lines
1.7 KiB
Cheetah
Raw Normal View History

{{- 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" }}
ln -s "$HOME/.config/mackup/.mackup/" ~/.mackup
ln -s "$HOME/.config/mackup/.mackup.cfg" ~/.mackup.cfg
if command -v brew > /dev/null && brew list | grep mackup > /dev/null; then
$(brew --prefix)/bin/mackup "$@" || echo ''
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
~/.local/bin/mackup "$@" || echo ''
else
logg warn 'Homebrew/Python pip is not found. Install `mackup` using one of these methods'
fi
rm -f ~/.mackup
rm -f ~/.mackup.cfg
{{ end }}