-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathinstall.sh
executable file
·49 lines (40 loc) · 960 Bytes
/
install.sh
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
49
#!/bin/sh
set -e
# Default values, override on the command line
: "${FW_DEST:=/lib/firmware/intel}"
: "${TOOLS_DEST:=/usr/local/bin}"
usage()
{
cat <<EOF
Usage example:
sudo $0 [v1.8.x/]v1.8
EOF
exit 1
}
main()
{
test "$#" -eq 1 || usage
local path; path=$(dirname "$1")
local ver; ver=$(basename "$1")
# Do this first so we can fail immediately and not leave a
# half-install behind
set -x
for sdir in sof sof-tplg; do
ln -sT "$sdir-$ver" "${FW_DEST}/$sdir" || {
set +x
die '%s already installed? (Re)move it first.\n' "${FW_DEST}/$sdir"
}
done
# Trailing slash in srcdir/ ~= srcdir/*
rsync -a "${path}"/sof*"$ver" "${FW_DEST}"/
rsync -a "${path}"/tools-"$ver"/ "${TOOLS_DEST}"/
}
die()
{
>&2 printf '%s ERROR: ' "$0"
# We want die() to be usable exactly like printf
# shellcheck disable=SC2059
>&2 printf "$@"
exit 1
}
main "$@"