diff options
author | Matt Singleton <matt@xcolour.net> | 2023-02-03 14:39:07 -0600 |
---|---|---|
committer | Matt Singleton <matt@xcolour.net> | 2023-02-03 14:39:07 -0600 |
commit | e9dc4c1090abb01317847c417b75d3960f3da34d (patch) | |
tree | 2fb84cf24675f1294f9f7a33ea949d514844c6f1 /bin/linux/dnf-needs-restarting | |
parent | 969f76a8238e2d43a25740c8272bf635d436f0d3 (diff) |
only install platform-appropriate configs based on uname
Diffstat (limited to 'bin/linux/dnf-needs-restarting')
-rwxr-xr-x | bin/linux/dnf-needs-restarting | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/linux/dnf-needs-restarting b/bin/linux/dnf-needs-restarting new file mode 100755 index 0000000..60f7f7c --- /dev/null +++ b/bin/linux/dnf-needs-restarting @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eo pipefail + +if command -v dnf > /dev/null; then + DNFCMD="dnf" +fi +if command -v jq > /dev/null; then + JQCMD="jq" +fi +if [ -z "$DNFCMD" ] || [ -z "$JQCMD" ]; then + echo "{\"tooltip\": \"requires 'jq' and 'dnf'\", \"text\": \"\"}" + exit 1 +fi + +set -u + +if ! output="$($DNFCMD needs-restarting -r)"; then + icon="勒" +else + icon="" +fi + +# this is a literal expression for `jq` +# shellcheck disable=SC2016 +$JQCMD --unbuffered -n -c '{tooltip: $ARGS.positional[0], text: $ARGS.positional[1]}' --args "$output" "$icon" |