From d44a8eb440542728345effcc28b0d21893cbfdae Mon Sep 17 00:00:00 2001 From: "thibault.dewailly" Date: Mon, 11 Apr 2016 08:55:44 +0200 Subject: [PATCH] 3.1_bootloader_ownership.sh fix --- bin/hardening/3.1_bootloader_ownership.sh | 6 ++++++ lib/utils.sh | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/hardening/3.1_bootloader_ownership.sh b/bin/hardening/3.1_bootloader_ownership.sh index b31250d..044d2b0 100755 --- a/bin/hardening/3.1_bootloader_ownership.sh +++ b/bin/hardening/3.1_bootloader_ownership.sh @@ -40,6 +40,12 @@ apply () { # This function will check config parameters required check_config() { + + is_pkg_installed "grub-pc" + if [ $FNRET != 0 ]; then + warn "Grub is not installed, not handling configuration" + exit 128 + fi does_user_exist $USER if [ $FNRET != 0 ]; then crit "$USER does not exist" diff --git a/lib/utils.sh b/lib/utils.sh index b04f2bc..7020e6a 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -202,11 +202,12 @@ apt_check_updates() # Returns if a package is installed # -is_installed() +is_pkg_installed() { PKG_NAME=$1 - if `dpkg -s $PKG_NAME 2> /dev/null | grep -q '^Status: install '` ; then + if $(dpkg -s $PKG_NAME 2> /dev/null | grep -q '^Status: install ') ; then FNRET=0 + else + FNRET=1 fi - FNRET=1 }