[COMMIT osv master] scripts: hardened manifest_from_host.hs to verify lddtree is installed on the system

6 views
Skip to first unread message

Commit Bot

unread,
Jul 30, 2019, 11:34:06 AM7/30/19
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <wkoz...@localhost.localdomain>
Committer: Waldemar Kozaczuk <wkoz...@localhost.localdomain>
Branch: master

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

Signed-off-by: Waldemar Kozaczuk <wkoz...@localhost.localdomain>

---
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

Reply all
Reply to author
Forward
0 new messages