You are not logged in.

#1 2025-10-12 16:16:57

drslmr
Member
Registered: 2011-05-14
Posts: 58

Script to updating AUR and standard packages

I'm using aura for updating packages. I have written a script to do both in one go. With the flag -s given to the script the systems shuts down if everything succeeded, else it keeps running. In order to prevent laptops from going to sleep in between the commands are run with systemd-inhibit. I just wanted to share this and maybe get some hints if that can be simplified even?

$ cat /opt/scripts/myupdate.sh 
#!/bin/bash

mdown=true # does nothing when invoked
[ "$1" == "-s" ] && mdown=mshut

mshut () {
    /usr/bin/shutdown -h 3
}

run_update () {
    /usr/bin/aura --noconfirm -Sy --needed archlinux-keyring &&
    /usr/bin/aura --noconfirm -Su  &&
    /usr/bin/aura --noconfirm -Aua
}

export -f run_update

/usr/bin/systemd-inhibit /usr/bin/bash -c "run_update" && $mdown

Offline

#2 2025-10-20 10:28:48

jl2
Member
From: 47° 18' N 8° 34' E
Registered: 2022-06-01
Posts: 1,116

Re: Script to updating AUR and standard packages

Wouldn't something like this do the job?

systemd-inhibit --whateverargs sh -c "paru -Syu && systemctl poweroff || notify-send --whatevertomakeiturgent 'update failed'"

Then set this as a alias in your shell's .rc .

Last edited by jl2 (2025-10-20 12:32:53)


Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...

Upload longer text output like this

Offline

#3 2025-10-22 18:43:08

drslmr
Member
Registered: 2011-05-14
Posts: 58

Re: Script to updating AUR and standard packages

Thanks  jl2.
These are actually two hints, one for simplifying the script and the other for paru.
I will check it out.

Offline

Board footer

Powered by FluxBB