1
0
Fork 0
mirror of https://github.com/Luzifer/arch-update.git synced 2024-10-18 06:44:23 +00:00

Ensure checkupdates is available

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-03-04 23:04:20 +01:00
parent 50fe433078
commit 96f139e421
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -22,6 +22,10 @@ fi
# Load defaults from defaults file # Load defaults from defaults file
[ -f /etc/default/arch_update ] && source /etc/default/arch_update [ -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 ) function error() { # ( message )
local msg="$@" local msg="$@"
log "$msg" "${COLOR_RED}" log "$msg" "${COLOR_RED}"
@ -62,6 +66,11 @@ function mailResult() { # ( )
function main() { # ( ) function main() { # ( )
log "Starting arch_update on $(hostname): $(feature "dry-run" $DRYRUN), $(feature "reboot" $REBOOT), $(feature "service-restart" $RESSVC)" 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 # Collect packages to be updated
log "Collecting packages..." log "Collecting packages..."
packages=($(checkupdates | awk '{print $1}' || true)) packages=($(checkupdates | awk '{print $1}' || true))