You are not logged in.

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

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

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

Board footer

Powered by FluxBB