aboutsummaryrefslogtreecommitdiff
path: root/script/not-dynamic.sh
blob: 2beb4e0b5883a3a158647ac3c440bd962a2488ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash

set -e

if [ "$#" -ne 1 ]; then
    echo "[fail] usage: $0 binary"
    exit 2
fi

if [ ! -x "$1" ]; then
	echo "[fail] $1 does not exist or is not an executable"
	exit 1
fi

if file "$1" | grep 'dynamically linked' 2>&1; then
    echo "[fail] $1 is dynamic"
    exit 1
fi
echo "[ok] $1 is probably static"