forked from ARM-software/CMSIS-RTOS2_Validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_pack.sh
executable file
·78 lines (62 loc) · 1.71 KB
/
gen_pack.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# Version: 2.1
# Date: 2022-08-09
# This bash script generates a CMSIS Software Pack: CMSIS-RTOS2_Validation
#
set -o pipefail
# Set version of gen pack library
REQUIRED_GEN_PACK_LIB="0.2.2"
# Set default command line arguments
DEFAULT_ARGS=(-c "")
# Pack warehouse directory - destination
PACK_OUTPUT=./output
# Temporary pack build directory
PACK_BUILD=./build
# Specify directory names to be added to pack base directory
PACK_DIRS="
Documentation
Include
Layer
Project
Source
"
# Specify file names to be added to pack base directory
PACK_BASE_FILES="
LICENSE.txt
README.md
"
# Specify file names to be deleted from pack build directory
PACK_DELETE_FILES="
./Project/avh.yml
./Project/validation.xsl
"
# Specify patches to be applied
PACK_PATCH_FILES=""
# Specify addition argument to packchk
PACKCHK_ARGS=()
############ DO NOT EDIT BELOW ###########
function install_lib() {
local URL="https://github.com/Open-CMSIS-Pack/gen-pack/archive/refs/tags/v$1.tar.gz"
echo "Downloading gen-pack lib to '$2'"
mkdir -p "$2"
curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1
}
function load_lib() {
local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then
echo "Required gen_pack lib not found!" >&2
install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}"
fi
if [[ -d "${GLOBAL_LIB}" ]]; then
. "${GLOBAL_LIB}/gen-pack"
elif [[ -d "${USER_LIB}" ]]; then
. "${USER_LIB}/gen-pack"
else
echo "Required gen-pack lib is not installed!" >&2
exit 1
fi
}
load_lib
gen_pack "${DEFAULT_ARGS[@]}" "$@"
exit 0