[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt update vs. KDE Discover?



On Fri, Apr 25, 2025 at 10:24 AM Greg wrote:
>
> On 2025-04-25, Lee wrote:
> >>
> >> I never run 'apt list --upgradable' because 'apt upgrade' shows the same
> >> info, while offering the chance to say no.
> >
> > ^shrug^
> > it's harder to fuck up 'apt list --upgradable' if all you want is a
> > list of what updates are available, but whatever works for you..
>
> Considerable extra typing susceptible to error, and as I suffer from a
> digital deformity, I prefer less to more.

I prefer not having to remember, much less to type so I've been
working on a script:

$ cat check-for-updates.sh
#!/bin/bash
# see if there are any Debian updates and pop-up a notice if there are

# needs an /etc/sudoers.d/adm-apt-privs that has
#   Cmnd_Alias    ADM_COMMANDS = /usr/bin/apt update
#   %adm          ALL = (root) NOPASSWD: ADM_COMMANDS

# get a temporary file
tempf=$(mktemp -q --tmpdir=/tmp -t updXXXXX)
stat=$?
if [ ${stat} != 0 ]; then
   echo "OhNoes!!! Unable to create a temporary file.  Status: ${stat}"
   exit 9
fi

# check for updates
sudo apt update   1>/dev/null 2>&1  && \
apt list --upgradable  2>/dev/null  | grep -v '^Listing' > $tempf

size=$(ls -s $tempf | awk '{print $1}')

[ $size != "0" ] && \
notify-send  -u critical  "Debian updates available" "$(cat $tempf)"


And have the script run automatically at login time.
The obvious fail is if the network isn't available .. I need to figure
out how to check for networking being up without being fooled if I'm
behind a captive portal

Regards
Lee


Reply to: