5 DIRNAME=$(dirname $(realpath $0))
6 REQUIRED_GEN_PACK_LIB="0.6.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 if [[ -d ${GEN_PACK_LIB} ]]; then
19 . "${GEN_PACK_LIB}/gen-pack"
22 local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
23 local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
24 if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then
25 echo "Required gen-pack lib not found!" >&2
26 install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}"
29 if [[ -d "${GLOBAL_LIB}" ]]; then
30 . "${GLOBAL_LIB}/gen-pack"
31 elif [[ -d "${USER_LIB}" ]]; then
32 . "${USER_LIB}/gen-pack"
34 echo "Required gen-pack lib is not installed!" >&2
42 #########################################
44 check_links "${DIRNAME}/../Documentation/index.html" "${DIRNAME}"