From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master

scripts: hardened manifest_from_host.hs to verify lddtree is installed on the system

Signed-off-by: Waldemar Kozaczuk <[email protected]>

---
diff --git a/scripts/manifest_from_host.sh b/scripts/manifest_from_host.sh
--- a/scripts/manifest_from_host.sh
+++ b/scripts/manifest_from_host.sh
@@ -69,7 +69,7 @@ detect_elf()
 {
        local file_path=$1
        local file_desc=$(file -L $file_path)
- local elf_filter=$(echo $file_desc | grep -P 'LSB shared object|LSB executable' | wc -l) + local elf_filter=$(echo $file_desc | grep -P 'LSB shared object| LSB.*executable' | wc -l)
        if [[ $elf_filter == 1 ]]; then
local shared_object_filter=$(echo $file_desc | grep -P 'LSB shared object' | wc -l)
                if [[ $shared_object_filter == 1 ]]; then
@@ -111,6 +111,12 @@ done
 shift $((OPTIND - 1))
 [[ -z $1 ]] && usage 1

+LDDTREE_INSTALLED=$(command -v lddtree)
+if [ -z "$LDDTREE_INSTALLED" ]; then
+       echo "Please install lddtree which is part of pax-utils package"
+       exit 1
+fi
+
 NAME_OR_PATH=$1
 SUBDIRECTORY_PATH=$2

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000199e2e058ee7bd78%40google.com.

Reply via email to