• apt update vs. KDE Discover?

    From Van Snyder@21:1/5 to All on Wed Apr 23 23:00:01 2025
    KDE discover put a popup on my screen saying there are updates
    available.

    I ran "apt update" and it said "nothing to see here; move on."

    So I pushed the little button in the tool tray with the little red dot
    and Discover said there were 250 updates occupying 454 MB.


    <html><head></head><body><div>KDE discover put a popup on my screen saying there are updates available.</div><div><br></div><div>I ran "apt update" and it said "nothing to see here; move on."</div><div><br></div><div>So I pushed the little button in the
    tool tray with the little red dot and Discover said there were 250 updates occupying 454 MB.</div><div><br></div><div><span></span></div></body></html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Lee on Fri Apr 25 17:00:01 2025
    Just a few notes:

    On Fri, Apr 25, 2025 at 10:39:58 -0400, Lee wrote:
    #!/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

    You're not actually using the exit code, other than to check for
    success vs. failure, so you could do this instead:

    if ! tempf=$(mktemp -q --tmpdir=/tmp -t updXXXXX); then
    echo "OhNoes!!! ..." >&2
    exit 9
    fi

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

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

    Again, you're not actually using the size, other than to check whether
    the file is empty. The shell has a builtin test operator for empty
    vs. non-empty files: -s.

    Also, you should quote "$tempf".

    [ -s "$tempf" ] && notify-send ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Lee on Fri Apr 25 19:00:01 2025
    On Fri, Apr 25, 2025 at 11:33:54 -0400, Lee wrote:
    Also, you should quote "$tempf".

    [ -s "$tempf" ] && notify-send ...

    is there any way that
    $(mktemp -q --tmpdir=/tmp -t updXXXXX)
    would return a 0 status and a filename with embedded spaces .. or with anything that would require quoting?

    The mktemp(1) man page doesn't document which characters can be used
    to replace the X's.

    The info page does. It says "alpha-numeric characters".

    So, you *might* be safe, if the info page is telling the truth, and if
    no future version of the mktemp program changes the behavior.

    But why take the chance?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)