Is my update script complete and correct?

is my update script complete and right, as I use cooker
now and rolling later, meaning

dnf upgrade

should not be used at all?

#!/bin/bash

echo "   updating  distro OpenMandriva :  "
yes | sudo dnf clean all
yes | sudo dnf dsync
echo "======== phase 1/2 completed - hit any key to continue ========="          
read -rn1
sudo flatpak update -y
echo "========phase 2/2 completed hit a key to close ===========" 
read -rn1

greetings andy

dnf upgrade should not be used for cooker and rolling, distro-sync saves you from headaches :slight_smile:

My evergreen command is:
$ sudo dnf clean all;dnf clean all;dnf repolist;sudo dnf distro-sync

or, my favorite (also in case of console complains about conflicts etc.):
$ sudo dnf clean all;dnf clean all;dnf repolist;sudo dnf --allowerasing distro-sync | tee konsole-sync.log

cool thx, that would mean, my script is
basically correct just lacking the part

dnf repolist;sudo dnf --allowerasing distro-sync | tee konsole-sync.log

?

Yes.

dnf repolist forces lists to refresh before doing anything. May be redundant however I prefer better safe than sorrow (my opinion)

The tee command creates a log of the current transaction so that it’s possible to read it afterwards should one get any doubt. Not strictly needed still convenient.

PS>
I am a scripts fan :grin:

1 Like

From DNF Command Reference:

Repolist Command

Command: repolist

dnf [options] repolist [--enabled|--disabled|--all]

Depending on the exact command lists enabled, disabled or all known repositories. Lists all enabled repositories by default. Provides more detailed information when -v option is used.

This command by default does not force a sync of expired metadata. See also Metadata Synchronization.

sudo dnf clean all erases all metadata. If you then run sudo dnf dsync it has to refresh metadata and will also list enabled repositories. So using dnf repolist in this context is useless.

In my experience with dnf in OMLx it appears that if one runs sudo dnf clean all then the next sudo dnf >any command< command will refresh metadata.

2 Likes

cool thanks, I also trying myself on script writing,

to be mentioned :slight_smile: I wrote a python GUI app, where I can list my command lines hosted in a
file, I can modify, extend, delete them, and most importantly execute them.
There is a temporary input field for your sudo password, which is
initially empty, and will not be stored whatsoever : - )

https://gitlab.com/ycom1/pycommandbox

:slight_smile:

1 Like

thanks for clearing this, the dnf commands are quite
complicated if one dives into details.

Thank both of you, now I can use the script since you confirmed it
to be basically correct.

By the way I like to mention, that I am really enjoying OML so far :slight_smile:
and it is great that a team creates such a nice project, out of passion,
even not
being payed for.

2 Likes

Thank you from me as well. I had been using dnf upgrade to update Cooker, will use distro-sync from now on.

1 Like