From 96f139e421ff190c5cf381eab76afdfe6077bfcf Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 4 Mar 2020 23:04:20 +0100 Subject: [PATCH] Ensure checkupdates is available Signed-off-by: Knut Ahlers --- arch_update.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch_update.sh b/arch_update.sh index bafeafc..17ab1c0 100755 --- a/arch_update.sh +++ b/arch_update.sh @@ -22,6 +22,10 @@ fi # Load defaults from defaults file [ -f /etc/default/arch_update ] && source /etc/default/arch_update +function checktool() { # ( command ) + which "$1" >/dev/null 2>&1 && return 0 || return 1 +} + function error() { # ( message ) local msg="$@" log "$msg" "${COLOR_RED}" @@ -62,6 +66,11 @@ function mailResult() { # ( ) function main() { # ( ) log "Starting arch_update on $(hostname): $(feature "dry-run" $DRYRUN), $(feature "reboot" $REBOOT), $(feature "service-restart" $RESSVC)" + checktool checkupdates || { + error "Missing tool 'checkupdates': Need to install package pacman-contrib" + exit 1 + } + # Collect packages to be updated log "Collecting packages..." packages=($(checkupdates | awk '{print $1}' || true))