I want to uninstall packages and reinstall them in user mode. I have a manually edited list made with flatpak list, where the first word of the line is the complete name of the package.
I can make a script that prints the names, they are correct. I can execute flatpak uninstall manually on those names and it works.
However, when I run the following loop (I removed the installation part for clarity), the script doesn't give me a choice and answers all the prompts in the negative:
#!/bin/bash
while read line
do
app_name=$(echo "$line" | awk '{print $1}')
flatpak uninstall --delete-data "$app_name"
done < flatpaklist.txt
And here is the kind of output I get:
ID Branch Op
1. io.github.Figma_Linux.figma_linux stable r
2. io.github.Figma_Linux.figma_linux.Locale stable r
3. org.freedesktop.Platform.GL.default 20.08 r
4. org.freedesktop.Platform.Locale 20.08 r
5. org.freedesktop.Platform.VAAPI.Intel 20.08 r
6. org.freedesktop.Platform 20.08 r
Proceed with these changes to the system installation? [Y/n]: n
Similar installed refs found for ‘org.freedesktop.Platform’:
1) runtime/org.freedesktop.Platform/x86_64/20.08 (system)
2) runtime/org.freedesktop.Platform/x86_64/22.08 (system)
3) All of the above
Which do you want to use (0 to abort)? [0-3]: 0
error: No ref chosen to resolve matches for ‘org.freedesktop.Platform’
Similar installed refs found for ‘org.freedesktop.Platform’:
1) runtime/org.freedesktop.Platform/x86_64/20.08 (system)
2) runtime/org.freedesktop.Platform/x86_64/22.08 (system)
3) All of the above
Which do you want to use (0 to abort)? [0-3]: 0
error: No ref chosen to resolve matches for ‘org.freedesktop.Platform’
Similar installed refs found for ‘org.freedesktop.Platform.GL.default’:
1) runtime/org.freedesktop.Platform.GL.default/x86_64/22.08-extra (system)
2) runtime/org.freedesktop.Platform.GL.default/x86_64/22.08 (system)
3) runtime/org.freedesktop.Platform.GL.default/x86_64/21.08 (system)
4) runtime/org.freedesktop.Platform.GL.default/x86_64/20.08 (system)
5) All of the above
As you can see, the answer "n" or "0" has been input. But it's not from me, I got no choice.
I also tried with yes | flatpak uninstall --delete-data "$app_name". When a number is required, it stills automatically answers "0", and when expecting "yes" or "no", it stills answers "n".