#!/usr/bin/env bash # Opt out of and remove Fedora's flatpak repo if grep -qz 'fedora' <<< "$(flatpak remotes)"; then /usr/bin/gnome-software --quit /usr/lib/fedora-third-party/fedora-third-party-opt-out /usr/bin/fedora-third-party disable flatpak remote-delete fedora --force flatpak remote-delete fedora-testing --force # Remove flatpak apps from origin fedora FEDORA_FLATPAKS=$(flatpak list --app --columns=application,origin | grep -w 'fedora' | awk '{print $1}') flatpak remove --system --noninteractive ${FEDORA_FLATPAKS[@]} # Remove flatpak runtimes from origin fedora FEDORA_FLATPAKS=$(flatpak list --runtime --columns=application,arch,branch,origin | grep -w 'fedora' | awk '{print $1"/"$2"/"$3}') flatpak remove --system --noninteractive ${FEDORA_FLATPAKS[@]} fi REPO_INFO="/usr/share/bluebuild/default-flatpaks/system/repo-info.yml" REPO_URL=$(yq '.repo-url' $REPO_INFO) REPO_NAME=$(yq '.repo-name' $REPO_INFO) REPO_TITLE=$(yq '.repo-title' $REPO_INFO) # General conditions for not running the unnecessary flatpak setup # Currently, we don't modify remote title if it's already modified # Flatpak add remote is ran for some reason, even with --if-not-exists flag, apparently, it modifies the URL # We cannot compare repo URLs properly # Flatpak outputs repo URL, while we have flatpakref URL, which is not the same readarray -t CURRENT_REPO_INFO < <(flatpak remotes --system --columns=name,url,title) for index in "${CURRENT_REPO_INFO[@]}"; do CURRENT_REPO_NAMES+=("$(echo "${index}" | awk '{print $1}')") CURRENT_REPO_TITLES+=("$(echo "${index}" | awk '{ for(i=3;i