mirror of
https://github.com/gmodena/nix-flatpak.git
synced 2024-11-28 00:27:21 +03:00
Compare commits
2 Commits
5f88fbe578
...
1d8bd8fc71
Author | SHA1 | Date | |
---|---|---|---|
|
1d8bd8fc71 | ||
|
e637f51f65 |
@ -16,13 +16,23 @@ let
|
||||
# Delete all remotes that are present in the old state but not the new one
|
||||
# $OLD_STATE and $NEW_STATE are globals, declared in the output of pkgs.writeShellScript.
|
||||
# If uninstallUnmanagedState is true, then the remotes will be deleted forcefully.
|
||||
#
|
||||
# Test if the remote exists before deleting it. This guards against two potential issues:
|
||||
# 1. A Flatpakref might install non-enumerable remotes that are automatically deleted
|
||||
# when the application is uninstalled, so attempting to delete them without checking
|
||||
# could cause errors.
|
||||
# 2. Users might manually delete apps/remotes, which could impact nix-flatpak state;
|
||||
# checking prevents errors if the remote has already been removed.
|
||||
${pkgs.jq}/bin/jq -r -n \
|
||||
--argjson old "$OLD_STATE" \
|
||||
--argjson new "$NEW_STATE" \
|
||||
'(($old.remotes // []) - ($new.remotes // []))[]' \
|
||||
| while read -r REMOTE_NAME; do
|
||||
${pkgs.flatpak}/bin/flatpak remote-delete ${if uninstallUnmanaged then " --force " else " " } --${installation} $REMOTE_NAME
|
||||
|
||||
if ${pkgs.flatpak}/bin/flatpak --${installation} remotes --columns=name | grep -q "^$REMOTE_NAME$"; then
|
||||
${pkgs.flatpak}/bin/flatpak remote-delete ${if uninstallUnmanaged then " --force " else " " } --${installation} $REMOTE_NAME
|
||||
else
|
||||
echo "Remote '$REMOTE_NAME' not found in flatpak remotes"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user