mirror of
https://github.com/Luzifer/arch-update.git
synced 2024-12-20 11:01:16 +00:00
Ensure checkupdates is available
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
50fe433078
commit
96f139e421
1 changed files with 9 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue