File: 01-ensure-binaries

package info (click to toggle)
python-diskimage-builder 3.37.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,572 kB
  • sloc: sh: 7,380; python: 6,444; makefile: 37
file content (48 lines) | stat: -rwxr-xr-x 1,082 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Ensure that all binaries listed in ramdisk elements, exist

if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

export TARGET_DIR="/tmp/in_target.d/"

if [ -z $TARGET_DIR ] ; then
    echo "Target dir not specified"
    exit 1
fi

if [ ! -d $TARGET_DIR ] ; then
    echo "Unable to find specified directory in target: $TARGET_DIR"
    bash
    exit 1
fi

BINARY_DEPS=

for _FILE in $(ls ${TARGET_DIR}/binary-deps.d/) ; do
    _FILE="${TARGET_DIR}/binary-deps.d/${_FILE}"
    if [ -a $_FILE ]; then
        for _LINE in $(cat $_FILE) ; do
            BINARY_DEPS="${BINARY_DEPS} $_LINE"
        done
    fi
done

for _BIN in $BINARY_DEPS ; do
    _LOCATION=$(type -p "$_BIN" || echo "")
    if [ -z "$_LOCATION" ]; then
        echo "$_BIN is not found in PATH. Please ensure your elements install it"
        exit 1
    fi
done

if [ "$BINARY_DEPS" == "" ]; then
    echo "No binary-deps found"
else
    DEPS_OUTPUT="/etc/dib_binary_deps"
    echo "Creating binary_deps record at: ${DEPS_OUTPUT}"
    echo "$BINARY_DEPS" >${DEPS_OUTPUT}
fi