]> begriffs open source - cmsis-driver-validation/blob - DoxyGen/check_links.sh
Update GitHub Actions runner to ubuntu-22.04 (#18)
[cmsis-driver-validation] / DoxyGen / check_links.sh
1 #!/bin/bash
2
3 set -o pipefail
4
5 DIRNAME=$(dirname $(realpath $0))
6 REQUIRED_GEN_PACK_LIB="0.4.0"
7
8 ############ gen-pack library ###########
9
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'"
13   mkdir -p "$2"
14   curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1
15 }
16
17 function load_lib() {
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}"
23   fi
24
25   if [[ -d "${GLOBAL_LIB}" ]]; then
26     . "${GLOBAL_LIB}/gen-pack"
27   elif [[ -d "${USER_LIB}" ]]; then
28     . "${USER_LIB}/gen-pack"
29   else
30     echo "Required gen-pack lib is not installed!" >&2
31     exit 1
32   fi
33 }
34
35 load_lib
36 find_linkchecker
37
38 #########################################
39
40 check_links "${DIRNAME}/../Documentation/index.html" "${DIRNAME}"