I just noticed during scripting that it's very hard to ensure that a snap is installed and refreshed if already installed because snap install
fails if the snap is already installed and snap refresh
fails if the snap is not installed yet. Am I missing some option listed or not listed in the --help
of either command?
I know how to script this with snap list
or even rudimentary with ||
in bash (missing a ton of error cases). But there has to be an option, right?
I'm using Ubuntu 23.10.
No, you're not missing an option and that's the whole package AFAIK ... I understand that you probably have in-mind something similar to APT's option
install --reinstall
, but, unfortunately, that's not an option with the current SNAP manager ... So, you can eitherinstall
orrefresh
but not both in one command.Actually, there are ways ...
Have a look at
snap info
:... which you can refine (text-process) like so:
... that was the SNAP version of FireFox (installed) ... Compare it to VLC (not installed) below:
... and refined:
From
man snap
: