Debian Codegraph @

scripts/install.sh

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/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 [scip-shell system . . `[`. "$#" -ne 2 -o "$1" = "-h" -o "$1" = "--help" ]
10 then
11 echoscip-shell system . . echo. "Usage: $0 config.txt <destdir>" >&2
12 exit 1
13 fi
14
15 CFG="$1"
16 DST="$2"
17
18 if ! [scip-shell system . . `[`. -r "${CFG}" ]
19 then
20 echoscip-shell system . . echo. "config ${CFG} is unreadable" >&2
21 exit 1
22 fi
23
24 mkdirscip-shell system . . mkdir. -p "${DST}"
25
26 # dstdir srcdir
27 do_licencescip-shell shell shell-project 0.0.0 do_licence().() {
28 found=0
29 while read line ; do
30 [scip-shell system . . `[`. "$line" = "Dir: $2" ] && break
31 done
32 while read line ; do
33 lic=${line##Licence: }
34 if [scip-shell system . . `[`. "$lic" != "$line" ]
35 then
36 installscip-shell system . . install. -m 0644 $lic "$1" || exit 1
37 found=1
38 break
39 fi
40 done
41 if [scip-shell system . . `[`. $found -eq 0 ] ; then
42 echoscip-shell system . . echo. "License for $2 not found"
43 exit 1
44 fi
45 }
46
47 # dest subdir DSP QC_IMAGE_VERSION_STRING
48 # FIXME: maybe install only a fixed set of files
49 do_installscip-shell shell shell-project 0.0.0 do_install().() {
50 local srcdir="$2/$4"
51 local dstdir="$1/$2/dsp/$3"
52
53 mkdirscip-shell system . . mkdir. -p "${dstdir}"
54 installscip-shell system . . install. -m 0644 "${srcdir}"/* "${dstdir}"
55
56 do_licencescip-shell shell shell-project 0.0.0 do_licence(). "${dstdir}" "${srcdir}" < WHENCE
57 }
58
59 # dest target link
60 do_linkscip-shell shell shell-project 0.0.0 do_link().() {
61 local target="$1/$2"
62 local link="$1/$3"
63
64 mkdirscip-shell system . . mkdir. -p "`dirnamescip-shell system . . dirname. "${link}"`"
65 rmscip-shell system . . rm. -f "${link}"
66 lnscip-shell system . . ln. -sr -T "${target}" "${link}"
67 }
68
69 grepscip-shell system . . grep. -v '^#\|^$' "${CFG}" | while read verb rest
70 do
71 case ${verb} in
72 "Install:" )
73 do_installscip-shell shell shell-project 0.0.0 do_install(). ${DST} ${rest}
74 ;;
75 "Link:" )
76 do_linkscip-shell shell shell-project 0.0.0 do_link(). ${DST} ${rest}
77 ;;
78 * )
79 echoscip-shell system . . echo. "Unsupported clause ${verb}" >&2
80 exit 1
81 esac
82 done