Is it possible to flag/set/update snap as "Deprecated" and link to new Snap?

Hi all,
Is it possible to flag/set/update snap as “Deprecated” and link to new Snap?
When someone try to install it, show a message say “This snap is deprecated, Please install the new snap…”?

Thanks in advance!

the latter shoudl work, there are serveral tutorials and examples here in the forum using yad to show such messages …

1 Like

Thank you on the fast response.
My snap is installed only using terminal… not GUI…
Can I write a message and exit the installation in a nice way? without error message?

Thanks again

ah, in that case you can just add a command-chain script that shows the message before launching the app itself …

1 Like

Sorry but I’m not sure I understand…
Something like:

command: echo “‘alero-connector’ command is depricated. Please call ‘remote-access-cli’ command instead.”

This means that the installation will complete successfully and the message will written only when trying to call the command?

You create a script like below and ship it in your snap

#! /bin/sh

echo "The foo snap is deprecated. Please install the bar  snap instead to recieve further regular updates !"
read -n 1 -s -r -p "Press any key to continue"

exec "$@"

lets say you call it “warning-wrapper” then you need to add it as a prefix to your command: entry … i.e.

    command: bin/foo


    command: warning-wrapper $SNAP/bin/foo
1 Like

Thank you.
And if I want that the “snap install mysnap” command will fail with the message? Is it possible?

that is something you would do from an install hook (simply by making it “exit 1”), though i am not sure it will use stdout, it might only print whatever you echo in the hook to the journal/syslog … you have to try …

1 Like

Maybe it’s not a good idea after all - the auto-update of the snap will probably fail(because the installation will fail)… I will implement your first suggestion. Thanks! :slight_smile:

I’m keep getting the following error:
“x1/warning-wrapper: 4: read: Illegal option -n”

This probably depends on the shell the client uses… do you have other suggestion for “Press any key to continue”?

I can change it to “Press enter to continue” but I prefer the “any key” option

try changing /bin/sh to /bin/bash in the first line … i forgot that read is a shell builtin, so it behaves a little different in sh …

1 Like