local policy
policy="$(apt-cache policy)"
archive=$(debian-archive "$policy")
- printf "%s\n" "$policy" | sed -rn "s/^.*a=$archive,n=([a-z]+).*/\1/p;T;q" || [[ $? == 141 ]]
+ sed -rn "s/^.*a=$archive,n=([a-z]+).*/\1/p;T;q" <<<"$policy"
}
debian-codename-compat() {
local n
fi
done
}
+ # returns 1 if $@ are all already installed packages.
pcheck() {
+ local arg count
for arg; do
if [[ $1 == -* ]]; then
shift
break
fi
done
- if dpkg -s -- "$@" |& grep -Fx "Status: install ok installed" &>/dev/null; then
- return 1
+ if count=$(dpkg -s -- "$@" 2>/dev/null | grep -cFx "Status: install ok installed"); then
+ if [[ $count == "$#" ]]; then
+ return 1
+ fi
fi
return 0
}
fi
fi
done
- if (( cachetime > limittime )); then
+ if (( cachetime < limittime )); then
$s apt-get update
fi
}