From 5659eae991f14c11603119ed5d4576224c0d9e18 Mon Sep 17 00:00:00 2001 From: enggnr <129082112+enggnr@users.noreply.github.com> Date: Wed, 19 Jul 2023 09:33:52 +0530 Subject: [PATCH] 17 profile backups (#42) * Update Brave profile folder paths * Filled browser profile locations * Initial work on Mackup support * Add path for snap and flatpak install * Add info about mackup * Added mackup config for Altair --- home/dot_config/mackup/.mackup.cfg | 79 +++++++++++++++++++ home/dot_config/mackup/.mackup/alrair.cfg | 10 +++ home/dot_config/mackup/.mackup/brave.cfg | 11 +++ home/dot_config/mackup/.mackup/chrome.cfg | 13 +++ home/dot_config/mackup/.mackup/edge.cfg | 10 +++ home/dot_config/mackup/.mackup/ferdium.cfg | 11 +++ home/dot_config/mackup/.mackup/firefox.cfg | 11 +++ home/dot_config/mackup/.mackup/librewolf.cfg | 10 +++ home/dot_config/mackup/.mackup/remmina.cfg | 9 +++ home/dot_config/mackup/.mackup/terraform.cfg | 5 ++ home/dot_config/shell/exports.sh.tmpl | 1 + home/dot_config/task/Taskfile.yml | 60 +++++++++++--- .../bin/mackup/executable_mackup.tmpl | 33 ++++++++ 13 files changed, 251 insertions(+), 12 deletions(-) create mode 100644 home/dot_config/mackup/.mackup.cfg create mode 100644 home/dot_config/mackup/.mackup/alrair.cfg create mode 100644 home/dot_config/mackup/.mackup/brave.cfg create mode 100644 home/dot_config/mackup/.mackup/chrome.cfg create mode 100644 home/dot_config/mackup/.mackup/edge.cfg create mode 100644 home/dot_config/mackup/.mackup/ferdium.cfg create mode 100644 home/dot_config/mackup/.mackup/firefox.cfg create mode 100644 home/dot_config/mackup/.mackup/librewolf.cfg create mode 100644 home/dot_config/mackup/.mackup/remmina.cfg create mode 100644 home/dot_config/mackup/.mackup/terraform.cfg create mode 100644 home/dot_local/bin/mackup/executable_mackup.tmpl diff --git a/home/dot_config/mackup/.mackup.cfg b/home/dot_config/mackup/.mackup.cfg new file mode 100644 index 00000000..04e1f759 --- /dev/null +++ b/home/dot_config/mackup/.mackup.cfg @@ -0,0 +1,79 @@ +[storage] +engine = file_system +path = .local +directory = mackup + +[applications_to_sync] +aria2c +autokey +aws +azure +bash +bat +beets +brave +cerebro +chrome +composer +conky +docker +edge +emacs +ferdium +filezilla +firefox +fontconfig +gimp +git +git-hooks +git-kraken +gradle +homebrew +htop +httpie +hyper +inkscape +intellijidea +iterm2 +kitty +kubectl +libreoffice +librewolf +littlesnitch +lollypop +mackup +microsoft-remote-desktop +mitmproxy +ngrok +npm +npmrc +pandoc +pass +pip +pnpm +poetry +powerline +prezto +rbenv +remmina +rclone +ripgrep +ruby +rvm +ssh +starship +t +terminal +terminator +terraform +tmux +vim +vlc +vscode +wireshark +wp-cli +xcode +xonsh +yarn +zoxide +zsh diff --git a/home/dot_config/mackup/.mackup/alrair.cfg b/home/dot_config/mackup/.mackup/alrair.cfg new file mode 100644 index 00000000..15f075ba --- /dev/null +++ b/home/dot_config/mackup/.mackup/alrair.cfg @@ -0,0 +1,10 @@ +[application] +name = Altair GraphQL Client + +[configuration_files] +{{- if (eq .host.distro.family "darwin") -}} +Library/Application Support/Altair GraphQL Client +{{- else if (eq .host.distro.family "linux") -}} +.config/Altair GraphQL Client +snap/altair/current/.config/Altair GraphQL Client +{{ end }} diff --git a/home/dot_config/mackup/.mackup/brave.cfg b/home/dot_config/mackup/.mackup/brave.cfg new file mode 100644 index 00000000..2ef7e347 --- /dev/null +++ b/home/dot_config/mackup/.mackup/brave.cfg @@ -0,0 +1,11 @@ +[application] +name = Brave + +[configuration_files] +{{- if (eq .host.distro.family "darwin") -}} +Library/Application Support/BraveSoftware/Brave-Browser/Default +{{- else if (eq .host.distro.family "linux") -}} +.config/BraveSoftware/Brave-Browser/Default +snap/brave/current/.config/BraveSoftware/Brave-Browser/Default +.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser/Default +{{ end }} diff --git a/home/dot_config/mackup/.mackup/chrome.cfg b/home/dot_config/mackup/.mackup/chrome.cfg new file mode 100644 index 00000000..a8d6ca93 --- /dev/null +++ b/home/dot_config/mackup/.mackup/chrome.cfg @@ -0,0 +1,13 @@ +[application] +name = Google Chrome + +[configuration_files] +{{- if (eq .host.distro.family "darwin") -}} +Library/Application Support/Google/Chrome/Default +{{- else if (eq .host.distro.family "linux") -}} +.config/google-chrome/default +.config/chromium/default +snap/chromium/common/chromium/Default +.var/app/org.chromium.Chromium/config/chromium/Default +.var/app/com.google.Chrome/config/google-chrome/Default +{{ end }} diff --git a/home/dot_config/mackup/.mackup/edge.cfg b/home/dot_config/mackup/.mackup/edge.cfg new file mode 100644 index 00000000..4f104b4a --- /dev/null +++ b/home/dot_config/mackup/.mackup/edge.cfg @@ -0,0 +1,10 @@ +[application] +name = Edge + +[configuration_files] +{{- if (eq .host.distro.family "darwin") -}} +Library/Application Support/Microsoft Edge/Default +{{- else if (eq .host.distro.family "linux") -}} +.config/microsoft-edge/Default +.var/app/com.microsoft.Edge/config/microsoft-edge/Default +{{ end }} diff --git a/home/dot_config/mackup/.mackup/ferdium.cfg b/home/dot_config/mackup/.mackup/ferdium.cfg new file mode 100644 index 00000000..5517401e --- /dev/null +++ b/home/dot_config/mackup/.mackup/ferdium.cfg @@ -0,0 +1,11 @@ +[application] +name = Ferdium + +[configuration_files] +{{- if (eq .host.distro.family "darwin") -}} +Library/Application Support/Ferdium +{{- else if (eq .host.distro.family "linux") -}} +.config/Ferdium/ +snap/ferdium/current/.config/Ferdium +.var/app/org.ferdium.Ferdium/config/Ferdium +{{ end }} diff --git a/home/dot_config/mackup/.mackup/firefox.cfg b/home/dot_config/mackup/.mackup/firefox.cfg new file mode 100644 index 00000000..2254889f --- /dev/null +++ b/home/dot_config/mackup/.mackup/firefox.cfg @@ -0,0 +1,11 @@ +[application] +name = Firefox + +[configuration_files] +{{- if (eq .host.distro.family "darwin") -}} +Library/Application Support/Firefox/Profiles +{{- else if (eq .host.distro.family "linux") -}} +.mozilla/firefox +snap/firefox/common/.mozilla/firefox +.var/app/org.mozilla.firefox/.mozilla/firefox +{{ end }} diff --git a/home/dot_config/mackup/.mackup/librewolf.cfg b/home/dot_config/mackup/.mackup/librewolf.cfg new file mode 100644 index 00000000..b38b9f79 --- /dev/null +++ b/home/dot_config/mackup/.mackup/librewolf.cfg @@ -0,0 +1,10 @@ +[application] +name = LibreWolf + +[configuration_files] +{{- if (eq .host.distro.family "darwin") -}} +Library/Application Support/LibreWolf/Profiles +{{- else if (eq .host.distro.family "linux") -}} +.librewolf +.var/app/io.gitlab.librewolf-community/.librewolf +{{ end }} diff --git a/home/dot_config/mackup/.mackup/remmina.cfg b/home/dot_config/mackup/.mackup/remmina.cfg new file mode 100644 index 00000000..321acdc2 --- /dev/null +++ b/home/dot_config/mackup/.mackup/remmina.cfg @@ -0,0 +1,9 @@ +[application] +name = Remmina + +[xdg_configuration_files] +remmina/remmina.pref + +[configuration_files] +snap/remmina/current/.config/remmina/remmina.pref +.var/app/org.remmina.Remmina/config/remmina/remmina.pref diff --git a/home/dot_config/mackup/.mackup/terraform.cfg b/home/dot_config/mackup/.mackup/terraform.cfg new file mode 100644 index 00000000..9548aa87 --- /dev/null +++ b/home/dot_config/mackup/.mackup/terraform.cfg @@ -0,0 +1,5 @@ +[application] +name = Terraform + +[configuration_files] +.terraformrc diff --git a/home/dot_config/shell/exports.sh.tmpl b/home/dot_config/shell/exports.sh.tmpl index 2370e4cf..818f77b9 100644 --- a/home/dot_config/shell/exports.sh.tmpl +++ b/home/dot_config/shell/exports.sh.tmpl @@ -48,6 +48,7 @@ export PATH="$HOME/.local/bin/cask:$PATH" 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/mackup:$PATH" export SSH_KEY_PATH="$HOME/.ssh/id_rsa" ### Homebrew diff --git a/home/dot_config/task/Taskfile.yml b/home/dot_config/task/Taskfile.yml index 4bc6303f..3ce48c31 100644 --- a/home/dot_config/task/Taskfile.yml +++ b/home/dot_config/task/Taskfile.yml @@ -99,7 +99,10 @@ tasks: - task: profile:backup vars: AppName: Brave Browser - ProfileFolder: ~/Library/Application Support/BraveSoftware/Brave-Browser/Default + ProfileFolderDarwin: ~/Library/Application Support/BraveSoftware/Brave-Browser/Default + ProfileFolderLinux: ~/.config/BraveSoftware/Brave-Browser/Default + ProfileFolderWindows: %APPDATA%/Local/BraveSoftware/Brave-Browser/Default + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: brave brave:profile:restore: @@ -124,7 +127,10 @@ tasks: vars: AppFolder: /Applications/Brave Browser.app AppName: Brave Browser - ProfileFolder: ~/Library/Application Support/BraveSoftware/Brave-Browser/Default + ProfileFolderDarwin: ~/Library/Application Support/BraveSoftware/Brave-Browser/Default + ProfileFolderLinux: ~/.config/BraveSoftware/Brave-Browser/Default + ProfileFolderWindows: %APPDATA%/Local/BraveSoftware/Brave-Browser/Default + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: brave chrome:profile:backup: @@ -149,7 +155,10 @@ tasks: - task: profile:backup vars: AppName: Google Chrome - ProfileFolder: ~/Library/Application Support/Google/Chrome/Default + ProfileFolderDarwin: ~/Library/Application Support/Google/Chrome/Default + ProfileFolderLinux: ~/.config/google-chrome/default + ProfileFolderWindows: %LOCALAPPDATA%/Google/Chrome/User Data/Default + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: chrome chrome:profile:restore: @@ -174,7 +183,10 @@ tasks: vars: AppFolder: /Applications/Google Chrome.app AppName: Google Chrome - ProfileFolder: ~/Library/Application Support/Google/Chrome/Default + ProfileFolderDarwin: ~/Library/Application Support/Google/Chrome/Default + ProfileFolderLinux: ~/.config/google-chrome/default + ProfileFolderWindows: %LOCALAPPDATA%/Google/Chrome/User Data/Default + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: chrome edge:profile:backup: @@ -199,7 +211,10 @@ tasks: - task: profile:backup vars: AppName: Microsoft Edge - ProfileFolder: ~/Library/Application Support/Microsoft Edge/Default + ProfileFolderDarwin: ~/Library/Application Support/Microsoft Edge/Default + ProfileFolderLinux: ~/.config/microsoft-edge/Default + ProfileFolderWindows: %LOCALAPPDATA%/Microsoft/Edge/User Data/Default + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: edge edge:profile:restore: @@ -224,7 +239,10 @@ tasks: vars: AppFolder: /Applications/Microsoft Edge.app AppName: Microsoft Edge - ProfileFolder: ~/Library/Application Support/Microsoft Edge/Default + ProfileFolderDarwin: ~/Library/Application Support/Microsoft Edge/Default + ProfileFolderLinux: ~/.config/microsoft-edge/Default + ProfileFolderWindows: %LOCALAPPDATA%/Microsoft/Edge/User Data/Default + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: edge ferdium:profile:backup: @@ -249,7 +267,10 @@ tasks: - task: profile:backup vars: AppName: Ferdium - ProfileFolder: ~/Library/Application Support/Ferdium + ProfileFolderDarwin: ~/Library/Application Support/Ferdium + ProfileFolderLinux: ~/.config/Ferdium/ + ProfileFolderWindows: %APPDATA%/Ferdium + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: ferdium ferdium:profile:restore: @@ -274,7 +295,10 @@ tasks: vars: AppFolder: /Applications/Ferdium.app AppName: Ferdium - ProfileFolder: ~/Library/Application Support/Ferdium + ProfileFolderDarwin: ~/Library/Application Support/Ferdium + ProfileFolderLinux: ~/.config/Ferdium/ + ProfileFolderWindows: %APPDATA%/Ferdium + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: ferdium firefox:profile:backup: @@ -299,7 +323,10 @@ tasks: - task: profile:backup vars: AppName: Firefox - ProfileFolder: ~/Library/Application Support/Firefox/Profiles/profile.private + ProfileFolderDarwin: ~/Library/Application Support/Firefox/Profiles/profile.private + ProfileFolderLinux: ~/.mozilla/firefox + ProfileFolderWindows: %APPDATA%/Mozilla/Firefox/Profiles + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: firefox firefox:profile:restore: @@ -324,7 +351,10 @@ tasks: vars: AppFolder: /Applications/Firefox.app AppName: Firefox - ProfileFolder: ~/Library/Application Support/Firefox/Profiles/profile.private + ProfileFolderDarwin: ~/Library/Application Support/Firefox/Profiles/profile.private + ProfileFolderLinux: ~/.mozilla/firefox + ProfileFolderWindows: %APPDATA%/Mozilla/Firefox/Profiles + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: firefox font-test: @@ -359,7 +389,10 @@ tasks: - task: profile:backup vars: AppName: LibreWolf - ProfileFolder: ~/Library/Application Support/LibreWolf/Profiles/profile.default + ProfileFolderDarwin: ~/Library/Application Support/LibreWolf/Profiles/profile.default + ProfileFolderLinux: ~/.librewolf + ProfileFolderWindows: %USERPROFILE%/.librewolf + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: librewolf librewolf:profile:restore: @@ -384,7 +417,10 @@ tasks: vars: AppFolder: /Applications/LibreWolf.app AppName: LibreWolf - ProfileFolder: ~/Library/Application Support/LibreWolf/Profiles/profile.default + ProfileFolderDarwin: ~/Library/Application Support/LibreWolf/Profiles/profile.default + ProfileFolderLinux: ~/.librewolf + ProfileFolderWindows: %USERPROFILE%/.librewolf + ProfileFolder: '{{if eq OS "linux"}}{{.ProfileFolderLinux}}{{else if eq OS "darwin"}}{{.ProfileFolderDarwin}}{{else}}{{.ProfileFolderWindows}}{{end}}' RcloneRepository: librewolf macos:plists: diff --git a/home/dot_local/bin/mackup/executable_mackup.tmpl b/home/dot_local/bin/mackup/executable_mackup.tmpl new file mode 100644 index 00000000..477b7b0f --- /dev/null +++ b/home/dot_local/bin/mackup/executable_mackup.tmpl @@ -0,0 +1,33 @@ +{{- 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 }}