Debian Codegraph @

scripts/dist.sh

raw symbols SCIP
1 #! /bin/sh
2 # SPDX-License-Identifier: MIT
3 # Copyright (c) 2024 Linaro Ltd.
4 #
5 # Install DSP shell and libraries
6
7 set -e
8
9 if [ "$#" -ne 2 -o "$1" = "-h" -o "$1" = "--help" ]
10 then
11 echo "Usage: $0 config.txt <destdir>" >&2
12 exit 1
13 fi
14
15 CFG="$1"
16 DST="$2"
17
18 if ! [ -r "${CFG}" ]
19 then
20 echo "config ${CFG} is unreadable" >&2
21 exit 1
22 fi
23
24 mkdir -p "${DST}"
25
26 # dest subdir DSP QC_IMAGE_VERSION_STRING
27 # FIXME: maybe install only a fixed set of files
28 do_install() {
29 local srcdir="$2/$4"
30 local dstdir="$1/$2/$4"
31
32 mkdir -p "${dstdir}"
33 install -m 0644 "${srcdir}"/* "${dstdir}"
34 }
35
36 grep -v '^#\|^$' "${CFG}" | while read verb rest
37 do
38 case ${verb} in
39 "Install:" )
40 do_install ${DST} ${rest}
41 ;;
42 "Link:" )
43 # ignore
44 ;;
45 "*" )
46 echo "Unsupported clause ${verb}" >&2
47 echo
48 esac
49 done
50
51 grep ^Licence WHENCE | cut -d ' ' -f 2 | while read licence
52 do
53 [ -r "${DST}/$licence" ] || install -m 0644 $licence "${DST}"
54 done
55
56 install -d ${DST}/conf.d
57 install -m 0644 conf.d/*.yaml ${DST}/conf.d/
58 install -m 0644 conf.d/schema.json ${DST}/conf.d/
59
60 install -d ${DST}/scripts
61 install -m 0755 scripts/*.sh scripts/*.py ${DST}/scripts/
62
63 install -m 0644 Makefile config.txt ${DST}
64
65 ./scripts/filter_whence.py config.txt WHENCE ${DST}/WHENCE