From 13caedb7b104beabd9cdd28fbdcb19b8a394b295 Mon Sep 17 00:00:00 2001 From: "Heavy@Hetzner" Date: Fri, 27 Jan 2023 09:33:10 +0000 Subject: [PATCH] Added debian check, to provide functions only on debian systems. --- dot_bashrc.d/executable_09.functions.tmpl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dot_bashrc.d/executable_09.functions.tmpl b/dot_bashrc.d/executable_09.functions.tmpl index 5b3fba7..0b663d5 100755 --- a/dot_bashrc.d/executable_09.functions.tmpl +++ b/dot_bashrc.d/executable_09.functions.tmpl @@ -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}