popey / unsnap

Quickly migrate from using snap packages to flatpaks
MIT License
1.01k stars 48 forks source link

Handle existing installed flatpaks #20

Open philclifford opened 2 years ago

philclifford commented 2 years ago

Is your feature request related to a problem? Please describe.

Unsnap does not consider installed flatpaks. It would be nice if it would detect (or provide candidate matches) where the system already has both the snap and the flatpak installed. (I have a couple, but this also might arise for a sane user from attempts to migrate with or without using this utility)

Describe the solution you'd like

I would like the script to match installed flatpaks (and/or make them candidate suggestions) rather than report them as missing, and maybe to comment out their entry in the generated installation script, and if they do not exist in the mapping also provide a possible mapping and a note to maybe submit an issue ...

For example:

$snap list obsidian fractal
Name      Version                Rev  Tracking       Publisher    Notes
fractal   4.4.0-244-g8781378a79  106  latest/stable  ken-vandine  -
obsidian  0.14.2                 x2   -              -            -
$sort missingflatpak.txt|grep -v snap-store >missing
$flatpak list|sort -u |join -i - missing
Fractal org.gnome.Fractal 4.4 stable system
Obsidian md.obsidian.Obsidian 0.14.2 stable system

Note the case of the flatpaks. joining the other way round can generate some suggested matches.

flatpak list|sort -u |join -i  missing - |awk '{print $1 "," $2}' |tee -a extra-applist.csv
fractal,org.gnome.Fractal
obsidian,md.obsidian.Obsidian

I don't have any flatpaks and snaps installed that are already in the applist.csv but I guess handling that then handling the "unknown"/"candidate" scenario would be OK - for such an edge-case I'd expect to end up with a candidate match list to submit as well as a a missing list, and to be able to chose to merge the "candidates" and re-generate new scripts to review/use.

Desktop (please complete the following information):

OS: Ubuntu MATE 21.10 x86_64 Kernel: 5.13.0-39-lowlatency Shell: bash 5.1.8

Describe alternatives you've considered Just ignoring the daft edge-case users who might be in this situation would be fine too .

popey commented 2 years ago

Thanks for the issue @philclifford . Yes, I agree, there's no point running flatpak install foo if foo is already installed. So we should at least omit those from the install script.