From b123e28d1685320d9025a2cfceb5cc0c2df827ef Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Wed, 24 Jan 2024 18:59:53 -0800 Subject: [PATCH] fix: Create git repository if it doesn't already exist in Firefox/Thunderbird GNOME theme updater --- .../topgrade/mozilla-gnome-theme-update | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/system_files/desktop/shared/usr/libexec/topgrade/mozilla-gnome-theme-update b/system_files/desktop/shared/usr/libexec/topgrade/mozilla-gnome-theme-update index ceb7e302..80f7bb99 100755 --- a/system_files/desktop/shared/usr/libexec/topgrade/mozilla-gnome-theme-update +++ b/system_files/desktop/shared/usr/libexec/topgrade/mozilla-gnome-theme-update @@ -4,21 +4,33 @@ shopt -s nullglob echo "Looking for updates..." # Flatpak Firefox -for firefox_gnome_theme in "$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox/"*".default"*"/chrome/firefox-gnome-theme/"; do +for firefox_gnome_theme in "$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox/"*".default"*"/chrome/firefox-gnome-theme"; do if [ -d "$firefox_gnome_theme" ]; then - echo "Firefox theme found, pulling latest with git" - cd "$firefox_gnome_theme" - git pull + if [ ! -d "$firefox_gnome_theme/.git" ]; then + echo "Firefox theme found, but not a git repository. Correcting." + rm -rf "$firefox_gnome_theme" + git clone https://github.com/rafaelmardojai/firefox-gnome-theme.git --single-branch "$firefox_gnome_theme" + else + echo "Firefox theme found, pulling latest with git" + cd "$firefox_gnome_theme" + git pull + fi echo "Update complete" fi done # Flatpak Thunderbird -for thunderbird_gnome_theme in "$HOME/.var/app/org.mozilla.Thunderbird/.thunderbird/"*".default"*"/chrome/thunderbird-gnome-theme/"; do +for thunderbird_gnome_theme in "$HOME/.var/app/org.mozilla.Thunderbird/.thunderbird/"*".default"*"/chrome/thunderbird-gnome-theme"; do if [ -d "$thunderbird_gnome_theme" ]; then - echo "Thunderbird theme found, pulling latest with git" - cd "$thunderbird_gnome_theme" - git pull + if [ ! -d "$thunderbird_gnome_theme/.git" ]; then + echo "Thunderbird theme found, but not a git repository. Correcting." + rm -rf "$thunderbird_gnome_theme" + git clone https://github.com/rafaelmardojai/thunderbird-gnome-theme.git --single-branch "$thunderbird_gnome_theme" + else + echo "Thunderbird theme found, pulling latest with git" + cd "$thunderbird_gnome_theme" + git pull + fi echo "Update complete" fi done