5 DIRNAME=$(dirname $(realpath $0))
6 REQUIRED_GEN_PACK_LIB="0.4.0"
8 ############ gen-pack library ###########
10 function install_lib() {
11 local URL="https://github.com/Open-CMSIS-Pack/gen-pack/archive/refs/tags/v$1.tar.gz"
12 echo "Downloading gen_pack lib to '$2'"
14 curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1
18 local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
19 local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
20 if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then
21 echo "Required gen-pack lib not found!" >&2
22 install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}"
25 if [[ -d "${GLOBAL_LIB}" ]]; then
26 . "${GLOBAL_LIB}/gen-pack"
27 elif [[ -d "${USER_LIB}" ]]; then
28 . "${USER_LIB}/gen-pack"
30 echo "Required gen-pack lib is not installed!" >&2
38 #########################################
40 check_links "${DIRNAME}/../Documentation/index.html" "${DIRNAME}"