From 33e04073d0afc11b998aebe10162f5639e605294 Mon Sep 17 00:00:00 2001 From: Ezri Brimhall Date: Wed, 13 Mar 2024 23:33:39 -0600 Subject: [PATCH] Fixed prompt --- .config/zsh/prompt.zsh | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/.config/zsh/prompt.zsh b/.config/zsh/prompt.zsh index db4b3f4..37cf266 100644 --- a/.config/zsh/prompt.zsh +++ b/.config/zsh/prompt.zsh @@ -22,8 +22,6 @@ precmd_pyenv_info() { fi } -_kernel_pkg=$(pacman -Qqo /usr/lib/modules/$(uname -r)/vmlinuz 2>/dev/null) - precmd_kernel_info() { # check to see if a kernel update has been installed # since we need to reboot to use it @@ -33,26 +31,13 @@ precmd_kernel_info() { if [[ -n ${kernel_info_msg_0_} ]]; then return fi - if [[ -z ${_kernel_pkg} ]]; then - # no kernel package found, so we can't check for updates - return - fi - case ${_kernel_pkg} in - "linux") - # mainline kernel - diff <(uname -r | sed 's/-/./;s/\.0\././') <(pacman -Q linux | cut -d' ' -f2) >/dev/null - _ret=$? - ;; - "linux-lts") - # lts kernel - diff <(uname -r | sed 's/-lts//') <(pacman -Q linux-lts | cut -d' ' -f2) >/dev/null - _ret=$? - ;; - esac - diff <(uname -r | sed 's/-/./;s/\.0\././') <(pacman -Q linux | cut -d' ' -f2) >/dev/null - if [[ $? -eq 1 ]]; then - # kernel update available - kernel_info_msg_0_="%F{red} reboot required %f" + if [[ ${OS_ID} == "arch" ]] || [[ ${OS_ID_LIKE} == "arch" ]]; then + # Arch Linux removes the old kernel when updating, so we can + # just check to see if /usr/lib/modules/$(uname -r)/vmlinuz exists + if [[ -f /usr/lib/modules/$(uname -r)/vmlinuz ]]; then + # kernel update available + kernel_info_msg_0_="%F{red} reboot required %f" + fi fi }