[Fixed] Hold Snap Application Update?

Kernels & Hardware, configuring network, installing services

[Fixed] Hold Snap Application Update?

Postby bester69 » 2020-03-05 20:22

Hi,

How can I hold any snap applicattion of updating?

I'd like to apply the equivalen for snaps of:
sudo apt-mark hold <<application>>



Thanks.
Last edited by bester69 on 2020-03-09 16:18, edited 1 time in total.
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1609
Joined: 2015-04-02 13:15

Re: Hold Snap Application Update?

Postby bester69 » 2020-03-06 17:26

https://snapcraft.io/docs/keeping-snaps-up-to-date

We can use:
sudo snap set system refresh.hold="$(date --date=tomorrow +%Y-%m-%dT%H:%M:%S%:z)"

and query:
snap refresh --time
timer: 00:00~24:00/4
last: yesterday at 19:30 CET
hold: in 59 days, at 20:30 CEST
next: today at 05:41 CET (but held)


but it retains whole snap system.. I guess I will have to use chattr in folder application, something like.:
sudo chattr +i /snap/opera/
/snap/opera$ ls
66 67 current
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1609
Joined: 2015-04-02 13:15

Re: Hold Snap Application Update?

Postby Head_on_a_Stick » 2020-03-06 17:33

How about
Code: Select all
snap refresh --revision=$version $package

But you would have to repeat that every time the snaps are updated.
User avatar
Head_on_a_Stick
 
Posts: 12004
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Hold Snap Application Update?

Postby bester69 » 2020-03-06 23:26

Head_on_a_Stick wrote:How about
Code: Select all
snap refresh --revision=$version $package

But you would have to repeat that every time the snaps are updated.


what does it do, put current version to $revision?..,

by default it keeps/retain two versions..everytime it updates, I guess its a FIFO method for updating, wont it delete oldest version first?

That would make it if its not using lowerest version number as the ID for a FIFO update
Last edited by bester69 on 2020-03-07 11:50, edited 1 time in total.
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1609
Joined: 2015-04-02 13:15

Re: Hold Snap Application Update?

Postby Head_on_a_Stick » 2020-03-07 09:48

bester69 wrote:what does it do, put current version to $revision?

I think so, yes. I'm just going from the man page. I don't use snap packages.
User avatar
Head_on_a_Stick
 
Posts: 12004
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Hold Snap Application Update?

Postby bester69 » 2020-03-07 11:41

Head_on_a_Stick wrote:
bester69 wrote:what does it do, put current version to $revision?

I think so, yes. I'm just going from the man page. I don't use snap packages.

Thanks for help mate,

Im gonna use chattr to not take mayor risks and prevent an unwished update.

I will manually process snap updates by setting everytime "refresh.hold" to the maximum allowed of 60 days and apply script, so this way snapd daemon doesnt bother with chattr +i in snap folder. I will also exlude holded application (opera browser) from purge remove snap, so that snapd doesnt freeze when trying the purge in that protetected snap folder.

updates-snap.sh
Code: Select all
#!/bin/bash
clear

#Hold 60 días
sudo snap set system refresh.hold="2029-04-23T17:22:54+01:00"
snap refresh --time
sudo chattr +i /snap/opera/

sleep 3
 
snap list | awk -F" " '{if ($1 && NR>1) { system("sudo snap refresh " $1 "") }}'
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu

snap list --all | awk '/disabled/{print $1, $3}' |
    while read snapname revision; do   
    if [ "$snapname" == "opera" ]
    then
        :
    else
       sudo snap remove "$snapname" --revision="$revision"
    fi
     
    done
Last edited by bester69 on 2020-03-07 11:49, edited 1 time in total.
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1609
Joined: 2015-04-02 13:15

Re: Hold Snap Application Update?

Postby bester69 » 2020-03-07 11:47

I would like very much to know,

I wonder how can I go back to a specific older versions, that itsnt available in the branch anymore.
For example, I would like to know how can I install back Opera 65 in snap.. is there any way to point to that repository back manually. :?: :shock:


Thanks,
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1609
Joined: 2015-04-02 13:15

Re: Hold Snap Application Update?

Postby sunrat » 2020-03-07 21:59

Head_on_a_Stick wrote:I think so, yes. I'm just going from the man page. I don't use snap packages.


Snap is the COVID-19 of Debian IMHO. Don't forget to wash your hands.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3077
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Hold Snap Application Update?

Postby bester69 » 2020-03-08 14:57

sunrat wrote:
Head_on_a_Stick wrote:I think so, yes. I'm just going from the man page. I don't use snap packages.


Snap is the COVID-19 of Debian IMHO. Don't forget to wash your hands.


I dont tend to wash my hands ..dont believe very much in invisible things, and mass.media thinking

only clean them when i see them dirty.. but I belong to old school mind, you know, just imagine how millons people lived like that in recent past, and nothing happend to them.. neither believe in climatic change and stuff like that.. thay're all patrañas and lies and mk-ultra throught tv news

if Coronavirus only kill old people (mortality rate 0,3% under 75yo), I dont get vey well , why so much scare, In SPain right now we're all happy wothout masks ans measures, propagating the virus throught whole territory :mrgreen: .. meanwhile in Japan and Italy .... :shock: :?
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1609
Joined: 2015-04-02 13:15

Re: Hold Snap Application Update?

Postby sunrat » 2020-03-08 20:24

Now I know you are talking through your arse. The climate has changed markedly in my 65 years on the planet. And I will be careful to avoid Spain during my forthcoming Europe trip, and not because of any virus.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3077
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Hold Snap Application Update?

Postby Dai_trying » 2020-03-08 20:40

bester69 wrote:but I belong to old school mind, you know, just imagine how millons people lived like that in recent past, and nothing happend to them.. neither believe in climatic change and stuff like that.. thay're all patrañas and lies and mk-ultra throught tv news


Do the years 1918 to 1920 mean anything? (https://en.wikipedia.org/wiki/Spanish_flu)

excert from link wrote:The death toll is estimated to have been anywhere from 17 million to 50 million, and possibly as high as 100 million, making it one of the deadliest epidemics in human history
Dai_trying
 
Posts: 917
Joined: 2016-01-07 12:25

Re: Hold Snap Application Update?

Postby wizard10000 » 2020-03-08 21:11

bester69 wrote:dont believe very much in invisible things


Gravity must be quite the mystery to you then.

Yeah, I know - don't feed the troll :mrgreen:
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 145
Joined: 2019-04-16 23:15
Location: southeastern us

Re: Hold Snap Application Update?

Postby bester69 » 2020-03-09 00:17

.
Last edited by bester69 on 2020-03-15 19:54, edited 1 time in total.
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1609
Joined: 2015-04-02 13:15

Re: Hold Snap Application Update?

Postby Head_on_a_Stick » 2020-03-09 15:17

The NASA chiefs didn't believe in Relativity either until they realised they had to use Einstein's equations to stop their satellites from falling out of the sky: https://physicscentral.com/explore/writers/will.cfm

And in respect of Flat Earthers I highly recommend Behind The Curve, it's hilarious. Especially the bit at the end where their experiment to prove that Earth is flat does the exact opposite.

So is this thread [SOLVED] by your ludicrous scripts then? I can feel a lock coming on...
User avatar
Head_on_a_Stick
 
Posts: 12004
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [Fixed] Hold Snap Application Update?

Postby bester69 » 2020-03-15 20:00

Updated, and fixed..

snap installations are created as squashfs images, so the right way to protect it, would be protect parent folder app and squasfhfs image.:

To exclude opera (v67) of purging with snap refresh.:
sudo chattr +i /var/lib/snapd/snaps/opera_67.snap
sudo chattr +i /snap/opera/


/snap/opera$ ls -l
total 4
drwxr-xr-x 1 root root 0 feb 25 15:20 66
drwxr-xr-x 11 root root 144 mar 2 22:36 67
lrwxrwxrwx 1 root root 2 mar 7 03:59 current -> 67



update-snaps.sh
Code: Select all
#!/bin/bash
clear

#Hold 60 días
sudo snap set system refresh.hold="2029-04-23T17:22:54+01:00"
snap refresh --time
sudo chattr +i /var/lib/snapd/snaps/opera_67.snap
sudo chattr +i /snap/opera/

sleep 3

 
snap list | awk -F" " '{if ($1 && NR>1) { system("sudo snap refresh " $1 "") }}'

# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu

snap list --all | awk '/disabled/{print $1, $3}' |
    while read snapname revision; do
   
    if [ "$snapname" == "opera" ]
    then
        :
    else
       sudo snap remove "$snapname" --revision="$revision"
    fi
     
    done
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1609
Joined: 2015-04-02 13:15


Return to System configuration

Who is online

Users browsing this forum: No registered users and 1 guest

fashionable