diff --git a/home/dot_config/mackup/.mackup/altair.cfg b/home/dot_config/mackup/.mackup/altair.cfg index 4fc8ccb8..edca0fd9 100644 --- a/home/dot_config/mackup/.mackup/altair.cfg +++ b/home/dot_config/mackup/.mackup/altair.cfg @@ -1,9 +1,5 @@ [application] name = Altair GraphQL Client -[configuration_files] -Library/Application Support/Altair GraphQL Client -snap/altair/current/.config/Altair GraphQL Client - [xdg_configuration_files] Altair GraphQL Client diff --git a/home/dot_config/mackup/.mackup/brave.cfg b/home/dot_config/mackup/.mackup/brave-browser.cfg similarity index 50% rename from home/dot_config/mackup/.mackup/brave.cfg rename to home/dot_config/mackup/.mackup/brave-browser.cfg index dfd6b94a..e5d3b8ca 100644 --- a/home/dot_config/mackup/.mackup/brave.cfg +++ b/home/dot_config/mackup/.mackup/brave-browser.cfg @@ -1,8 +1,5 @@ [application] name = Brave -[configuration_files] -Library/Application Support/BraveSoftware/Brave-Browser/Default - [xdg_configuration_files] BraveSoftware/Brave-Browser/Default diff --git a/home/dot_config/mackup/.mackup/chromium.cfg b/home/dot_config/mackup/.mackup/chromium.cfg deleted file mode 100644 index b1ca39cf..00000000 --- a/home/dot_config/mackup/.mackup/chromium.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[application] -name = Chromium - -[configuration_files] -snap/chromium/common/chromium/Default - -[xdg_configuration_files] -chromium/Default diff --git a/home/dot_config/mackup/.mackup/ferdium.cfg b/home/dot_config/mackup/.mackup/ferdium.cfg index 6cd589bd..9845a862 100644 --- a/home/dot_config/mackup/.mackup/ferdium.cfg +++ b/home/dot_config/mackup/.mackup/ferdium.cfg @@ -1,11 +1,5 @@ [application] name = Ferdium -[configuration_files] -Library/Application Support/Ferdium -Library/Preferences/org.ferdium.ferdium-app.plist -snap/ferdium/current/.config/Ferdium -.var/app/org.ferdium.Ferdium/config/Ferdium - [xdg_configuration_files] Ferdium \ No newline at end of file diff --git a/home/dot_config/mackup/.mackup/firefox.cfg b/home/dot_config/mackup/.mackup/firefox.cfg index d6b97bd5..29d68fa2 100644 --- a/home/dot_config/mackup/.mackup/firefox.cfg +++ b/home/dot_config/mackup/.mackup/firefox.cfg @@ -1,8 +1,5 @@ [application] name = Firefox -[configuration_files] -Library/Application Support/Firefox/Profiles -.mozilla/firefox -snap/firefox/common/.mozilla/firefox -.var/app/org.mozilla.firefox/.mozilla/firefox +[xdg_configuration_files] +firefox/profiles diff --git a/home/dot_config/mackup/.mackup/chrome.cfg b/home/dot_config/mackup/.mackup/google-chrome.cfg similarity index 100% rename from home/dot_config/mackup/.mackup/chrome.cfg rename to home/dot_config/mackup/.mackup/google-chrome.cfg diff --git a/home/dot_config/mackup/.mackup/edge.cfg b/home/dot_config/mackup/.mackup/microsoft-edge.cfg similarity index 50% rename from home/dot_config/mackup/.mackup/edge.cfg rename to home/dot_config/mackup/.mackup/microsoft-edge.cfg index 2b5a90b8..0d9384ec 100644 --- a/home/dot_config/mackup/.mackup/edge.cfg +++ b/home/dot_config/mackup/.mackup/microsoft-edge.cfg @@ -1,8 +1,5 @@ [application] name = Edge -[configuration_files] -Library/Application Support/Microsoft Edge/Default - [xdg_configuration_files] microsoft-edge/Default \ No newline at end of file diff --git a/home/dot_config/mackup/README.md b/home/dot_config/mackup/README.md new file mode 100644 index 00000000..748ac106 --- /dev/null +++ b/home/dot_config/mackup/README.md @@ -0,0 +1,40 @@ +# Application Settings Backup + +The command-line utility [`mackup`](https://github.com/lra/mackup) provides a decent starting point to enable Install Doctor to provide the capability of backing up personalized application settings. `mackup` has a shortcoming though. It was not designed to accompany configurations that end up being stored in different places on different operating systems / package managers. + +### Mackup + +For this reason, we use `mackup` to handle the back-up and restore of the "golden" copy of application settings which will usually be stored in the `~/.config` directory. In some cases, we can get away with, for example, symlinking the `~/.config/ABC` to `~/Library/Application Settings/ABC`. But, in other cases like Flatpak, we need to keep the Flatpak configuration stored under `~/.var/com.abc.XYZ` synchronized with `~/.config/ABC`. + +## `software.yml` Application Setting Definitions + +The `mackup` configurations will handle the backing up of the "golden" copy and the technical package manager specific linking / synchronization is handled by our CLI. If you browse through the `software.yml` file, you will see something like the following which provides enough details to our CLI to handle the technical details: + +```yaml + google-chrome: + _name: Google Chrome + _app: Google Chrome.app + _link:cask: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/google-chrome/Default" + target: "$HOME/Library/Application Support/Google/Chrome/Default" + _link:choco: 'TODO' + _link:flatpak: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/google-chrome/Default" + target: "$HOME/.var/app/com.google.Chrome/config/google-chrome/Default" + cask: google-chrome + choco: googlechrome + flatpak: com.google.Chrome + yay: google-chrome +``` + +The keys that start with `_link` add the instructions necessary to synchronize the configurations amongst the various possible locations in the most efficient manner. The `cask` and `flatpak` have their definitions in place. The `choco` still needs some work. And the `yay` option needs no definition because the configuration is already in the proper place by default for unrestricted system package managers. + +## `backup-apps` Script + +On a side note, once the proper application definitions are in place in the `software.yml` file and the proper configurations are made in this folder's `.mackup` folder, then you can use our convienience script located at `~/.local/bin/backup-apps` to perform the backup. It was created to avoid having to leave a `~/.mackup` folder and a `~/.mackup.cfg` file in the home directory. + +## TODO + +We need to go through the `software.yml` file and figure out which applications would benefit from application setting synchronization. Basically, any application that has `cask` and `flatpak` options will need to be configured. It is possible that some settings might reside outside of `~/Library/Application Support`. + +For now, the `choco` definitions should use Unix style forward slash definitions along with `%APPDATA%` to define the location of the settings. diff --git a/home/dot_config/shell/exports.sh.tmpl b/home/dot_config/shell/exports.sh.tmpl index 0908afc1..202fa245 100644 --- a/home/dot_config/shell/exports.sh.tmpl +++ b/home/dot_config/shell/exports.sh.tmpl @@ -54,7 +54,6 @@ export PATH="$HOME/.local/bin/docker:$PATH" export PATH="$HOME/.local/bin/firejail:$PATH" export PATH="$HOME/.local/bin/flatpak:$PATH" export PATH="$HOME/.local/bin/gpt:$PATH" -export PATH="$HOME/.local/bin/mackup:$PATH" export PATH="$HOME/.local/bin/pipx:$PATH" export SSH_KEY_PATH="$HOME/.ssh/id_rsa" diff --git a/home/dot_local/bin/executable_backup-apps.tmpl b/home/dot_local/bin/executable_backup-apps.tmpl new file mode 100644 index 00000000..7998239f --- /dev/null +++ b/home/dot_local/bin/executable_backup-apps.tmpl @@ -0,0 +1,38 @@ +#!/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 diff --git a/home/dot_local/bin/mackup/executable_mackup.tmpl b/home/dot_local/bin/mackup/executable_mackup.tmpl deleted file mode 100644 index 55f7efe3..00000000 --- a/home/dot_local/bin/mackup/executable_mackup.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -{{- 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" }} - -### Create symlinks pointing to stored configurations -ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup/" ~/.mackup -ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup.cfg" ~/.mackup.cfg - -### Run original mackup executable -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 - -### Remove temporary configuration files -rm -f ~/.mackup -rm -f ~/.mackup.cfg - -{{ end }} diff --git a/software.yml b/software.yml index 1afa2bf6..382991b2 100644 --- a/software.yml +++ b/software.yml @@ -519,6 +519,13 @@ softwarePackages: _home: https://altairgraphql.dev/ _name: Altair GraphQL Client _app: Altair GraphQL Client.app + _link:cask: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/Altair GraphQL Client" + target: "$HOME/Library/Application Support/Altair GraphQL Client" + _link:choco: 'TODO' + _link:snap: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/Altair GraphQL Client" + target: "$HOME/snap/altair/current/.config/Altair GraphQL Client" cask: altair-graphql-client choco: altair-graphql snap: altair @@ -1645,7 +1652,18 @@ softwarePackages: _home: https://brave.com/ _name: Brave Browser _app: Brave Browser.app - ansible: professormanhattan.bravebrowser + _link:cask: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/BraveSoftware/Brave-Browser/Default" + target: "$HOME/Library/Application Support/BraveSoftware/Brave-Browser/Default" + _link:choco: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/BraveSoftware/Brave-Browser/Default" + target: "%APPDATA%/Local/BraveSoftware/Brave-Browser/User Data" + _link:flatpak: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/BraveSoftware/Brave-Browser/Default" + target: "$HOME/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser/Default" + _link:snap: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/BraveSoftware/Brave-Browser/Default" + target: "$HOME/snap/brave/current/.config/BraveSoftware/Brave-Browser/Default" cask: brave-browser choco: brave flatpak: com.brave.Browser @@ -1870,13 +1888,12 @@ softwarePackages: _home: https://www.google.com/chrome/ _name: Google Chrome _app: Google Chrome.app - _post:cask: | - mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/google-chrome/Default" - mkdir -p "$HOME/Library/Application Support/Google/Chrome" - ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/google-chrome/Default" "$HOME/Library/Application Support/Google/Chrome/Default" - _post:flatpak: | - mkdir -p "" - ln -s + _link:cask: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/google-chrome/Default" + target: "$HOME/Library/Application Support/Google/Chrome/Default" + _link:flatpak: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/google-chrome/Default" + target: "$HOME/.var/app/com.google.Chrome/config/google-chrome/Default" ansible: professormanhattan.chrome cask: google-chrome choco: googlechrome @@ -3383,7 +3400,21 @@ softwarePackages: _home: https://www.mozilla.org/en-US/firefox/new/ _name: Mozilla Firefox _app: Firefox.app - ansible: professormanhattan.firefox + _link: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/profiles" + target: "$HOME/.mozilla/firefox" + _link:cask: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/profiles" + target: "$HOME/Library/Application Support/Firefox/Profiles" + _link:choco: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/profiles" + target: 'TODO' + _link:flatpak: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/profiles" + target: "$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox" + _link:snap: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/profiles" + target: "$HOME/snap/firefox/common/.mozilla/firefox" apt: firefox apt:debian: firefox-esr cask: firefox @@ -5793,9 +5824,20 @@ softwarePackages: ferdium: _bin: ferdium _app: Ferdium.app + _link:cask: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/Ferdium" + target: "$HOME/Library/Application Support/Ferdium" + _link:choco: 'TODO' + _link:flatpak: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/Ferdium" + target: "$HOME/.var/app/org.ferdium.Ferdium/config/Ferdium" + _link:snap: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/Ferdium" + target: "$HOME/snap/ferdium/current/.config/Ferdium" cask: ferdium choco: ferdium flatpak: org.ferdium.Ferdium + snap: ferdium thunderbird: _bin: thunderbird _app: Thunderbird.app @@ -5925,7 +5967,11 @@ softwarePackages: _home: https://www.microsoft.com/en-us/edge _name: Microsoft Edge _app: Microsoft Edge.app - ansible: professormanhattan.microsoftedge + _link:cask: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/microsoft-edge/Default" + target: "$HOME/Library/Application Support/Microsoft Edge/Default" + _link:choco: 'TODO' + _link:flatpak: 'TODO' cask: microsoft-edge choco: microsoft-edge flatpak: com.microsoft.Edge @@ -8119,12 +8165,18 @@ softwarePackages: - remmina - xrdp remmina: - _bin: null + _bin: remmina _desc: Remmina is a GTK Remmina Remote Desktop Client which provides remote access, screen and file sharing to your desktop _docs: https://gitlab.com/Remmina/Remmina/-/wikis/home _github: null _home: https://remmina.org/ _name: Remmina + _link:flatpak: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/remmina/remmina.pref" + target: "$HOME/.var/app/org.remmina.Remmina/config/remmina/remmina.pref" + _link:snap: + - src: "${XDG_CONFIG_HOME:-$HOME/.config}/remmina/remmina.pref" + target: "$HOME/snap/remmina/current/.config/remmina/remmina.pref" apt: remmina dnf: remmina flatpak: org.remmina.Remmina