From f053e0e1a7b1f0d565ef87ca0c94ab2d2fe10464 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Sat, 15 Sep 2018 15:11:11 +0200 Subject: [PATCH] beesd: Fix the wrapper not finding any config file `grep -q something | grep -q something_else` will never find anything. The for-loop is redundant anyways because `grep -l` can already work for us. Let's replace this with a shorter and working version. CC: Timofey Titovets (fixes: commit 06d41fd "Rewrite beesd arg parser") Signed-off-by: Kai Krakow --- scripts/beesd.in | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/beesd.in b/scripts/beesd.in index e41d4f9..7b9f82d 100755 --- a/scripts/beesd.in +++ b/scripts/beesd.in @@ -72,15 +72,9 @@ done [ -z "$UUID" ] && help -FILE_CONFIG="" -for file in "$CONFIG_DIR"/*.conf; do - [ ! -f "$file" ] && continue - if grep -q 'UUID=' "$file" | grep -q -- "$UUID"; then - INFO "Find $UUID in $file, use as conf" - FILE_CONFIG="$file" - fi -done +FILE_CONFIG="$(egrep -l '^[^#]*UUID\s*=\s*"?'"$UUID" "$CONFIG_DIR"/*.conf | head -1)" [ ! -f "$FILE_CONFIG" ] && ERRO "No config for $UUID" +INFO "Find $UUID in $FILE_CONFIG, use as conf" source "$FILE_CONFIG"