Added debian check, to provide functions only on debian systems.

This commit is contained in:
Heavy@Hetzner 2023-01-27 09:33:10 +00:00
parent 1c00eadb7b
commit 13caedb7b1

View File

@ -113,6 +113,8 @@ list-ssh-keys() {
done
}
{{ if eq .chezmoi.os "linux" }}
{{ if eq .chezmoi.osRelease.id "debian" }}
# Show version of a Debian package
debversion() {
if [ -x dpkg ]; then
@ -135,6 +137,20 @@ deblist() {
fi
}
# Show apt installation history
debhistory() {
zcat /var/log/apt/history.log.*.gz | \
/usr/bin/cat - /var/log/apt/history.log | \
grep -Po '^Commandline:(?= apt)(?=.* install ) \K.*|^Start-Date: \K.*' | \
grep -B1 "^apt" | \
grep -v -- "^--" | \
paste -d " " - - | \
sort
}
{{ end }}
{{ end }}
# Run 'top' by a list of processes matching name.
topby() {
local name=${1:?name required}