Too good to #0006

“Sudo on demand” from TGT0003 considered more useful for downgrading privileges on the fly

#!/usr/bin/env bash

am_user="$(id -un)"
printf "Running as: %s\n" "${am_user}"
if [[ "${want_user}" != "${am_user}" ]]
        printf "Re-executing with sudo.\n"
        exec sudo -u "${want_user}" "${0}"

JSON export of all installed packages on Debian/Ubuntu


function dpkg_json(){
    printf "{\n"
    format='"${Package}": { "Version": "${Version}", "Architecture": "${Architecture}", "Status": "${db:Status-Abbrev}" },\n'
    dpkg-query --show --showformat="${format}" | sed '$s/,$//'
    printf "}\n"

dpkg_json | jq .

Urlwatch for a new version of a package in the Ubuntu package pool

name: "Ubuntu Curtin package (waiting for apt-key fix)"
  - xpath: //table//td[2]
  - html2text
  - grep: ^curtin.*\.deb$
This entry was posted in Too Good To, UNIX & Linux and tagged , , , , , . Bookmark the permalink.

1 Response to Too good to #0006

  1. Pingback: Too good to #0003 | #!/bin/blog

Leave a Reply

Your email address will not be published. Required fields are marked *