38 lines
1.8 KiB
Bash
38 lines
1.8 KiB
Bash
#!/usr/bin/env bash
|
|
# @file ~/.local/bin/backup-apps
|
|
# @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" }}
|
|
|
|
if command -v mackup > /dev/null; then
|
|
### Create symlinks pointing to stored configurations
|
|
logg info 'Symlinking ~/.mackup and ~/.mackup.cfg'
|
|
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup/" ~/.mackup
|
|
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup.cfg" ~/.mackup.cfg
|
|
|
|
### Run mackup
|
|
logg info 'Running mackup'
|
|
mackup $* || echo ''
|
|
|
|
### Remove temporary configuration files
|
|
logg info 'Removing symlinked ~/.mackup and ~/.mackup.cfg configurations'
|
|
rm -f ~/.mackup
|
|
rm -f ~/.mackup.cfg
|
|
|
|
### Print success message
|
|
logg success 'Successfully ran backup-apps'
|
|
else
|
|
logg error 'mackup is not installed' && exit 1
|
|
fi
|