From 526a5d0389dc65e541e929b03acac06e4df0764a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Thu, 3 Dec 2020 09:34:32 +0000 Subject: [PATCH] fix: sudogen: proper detection of OS-specific templates --- bin/sudogen/generate-sudoers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/sudogen/generate-sudoers.sh b/bin/sudogen/generate-sudoers.sh index bd3a230..d19ae67 100755 --- a/bin/sudogen/generate-sudoers.sh +++ b/bin/sudogen/generate-sudoers.sh @@ -46,8 +46,8 @@ generate_account_sudoers() do # if $template has two dots, then it's of the form XXX-name.$os.sudoers, # in that case we only include this template if $os is our current OS - if [ "$(echo "$template" | cut -d. -f3)" = "sudoers" ]; then - if [ "$(echo "$template" | cut -d. -f2 | tr '[:upper:]' '[:lower:]')" != "$(echo "$OS_FAMILY" | tr '[:upper:]' '[:lower:]')" ]; then + if [ "$(basename "$template" | cut -d. -f3)" = "sudoers" ]; then + if [ "$(basename "$template" | cut -d. -f2 | tr '[:upper:]' '[:lower:]')" != "$(echo "$OS_FAMILY" | tr '[:upper:]' '[:lower:]')" ]; then # not the same OS, skip it continue fi