-
Notifications
You must be signed in to change notification settings - Fork 384
/
Copy pathfetch-external.sh
executable file
·115 lines (93 loc) · 5.89 KB
/
fetch-external.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env bash
# This script pulls in external documentation that should be edited in the corresponding upstream repo
# exit on error, unassigned vars, or pipe fails
set -euo pipefail
#!/usr/bin/env bash
dirname=$(dirname $0)
cd $dirname/..
mkdir -p shared/masterclass/debugging/
# Use node-jq if jq is not pre-installed in the environment nor set in path
which jq && JQ="$(which jq)" || JQ="../../node_modules/node-jq/bin/jq"
# Engine
# get latest balena-engine debugging docs
curl --fail --show-error -o shared/masterclass/debugging/engine.md -L https://github.com/balena-os/balena-engine/raw/master/balena-docs/engine-debugging.md &
# diagnostics
curl --fail --show-error -o pages/reference/diagnostics.md -L https://github.com/balena-io-modules/device-diagnostics/raw/master/diagnostics.md &
# Supervisor
# get latest supervisor update-lock docs
curl --fail --show-error -o pages/learn/deploy/release-strategy/update-locking.md -L https://github.com/balena-io/balena-supervisor/raw/master/docs/update-locking.md &
# get latest supervisor API docs
curl --fail --show-error -o pages/reference/supervisor/supervisor-api.md -L https://github.com/balena-os/balena-supervisor/raw/master/docs/API.md &
# get latest supervisor debugging docs
curl --fail --show-error -o shared/masterclass/debugging/supervisor.md -L https://github.com/balena-os/balena-supervisor/raw/master/docs/debugging-supervisor.md &
# balenaOS
# get meta-balena README and extract partials
cd shared/meta-balena/ && {
curl --fail --show-error -o meta-balena.md -L https://raw.githubusercontent.com/balena-os/meta-balena/master/README.md
# Extract modem text
# ../../tools/extract-markdown.sh "Modems" <meta-balena.md >supported-modems.md
# Extract Wifi adapters
# ../../tools/extract-markdown.sh "WiFi Adapters" <meta-balena.md >supported-wifi-adapters.md
# Extract Recommended WiFi USB dongle
# ../../tools/extract-markdown.sh "Recommended WiFi USB dongle" <meta-balena.md >supported-wifi-usb-dongle.md
# Extract config.json
../../tools/extract-markdown.sh "config.json" <meta-balena.md >config-json.md
rm meta-balena.md
cd -
} &
# get meta-balena rollbacks docs
curl --fail --show-error -o pages/reference/OS/updates/rollbacks.md -L https://raw.githubusercontent.com/balena-os/meta-balena/master/docs/rollbacks.md &
# get latest custom board support docs
curl --fail --show-error -o pages/reference/OS/customer-board-support.md -L https://github.com/balena-os/meta-balena/raw/master/contributing-device-support.md &
# get latest balenaOS debugging docs
curl --fail --show-error -o pages/reference/OS/debugging-balenaos.md -L https://github.com/balena-os/meta-balena/raw/master/docs/debugging-balenaos.md && {
cd pages/reference/OS
../../../tools/extract-markdown.sh "Journal Logs" <debugging-balenaos.md >journal-logs.md
mv journal-logs.md ../../../shared/masterclass/debugging/
../../../tools/extract-markdown.sh "Using the Kernel Logs" <debugging-balenaos.md >kernel-logs.md
mv kernel-logs.md ../../../shared/masterclass/debugging/
rm debugging-balenaos.md
} &
# Masterclasses
curl --fail --show-error -o pages/learn/more/masterclasses/cli-masterclass.md -L https://raw.githubusercontent.com/balena-io/balena-cli-masterclass/master/README.md &
curl --fail --show-error -o pages/learn/more/masterclasses/advanced-cli.md -L https://raw.githubusercontent.com/balena-io/balena-cli-advanced-masterclass/master/README.md &
curl --fail --show-error -o pages/learn/more/masterclasses/host-os-masterclass.md -L https://raw.githubusercontent.com/balena-io/balenaos-masterclass/master/README.md &
curl --fail --show-error -o pages/learn/more/masterclasses/services-masterclass.md -L https://raw.githubusercontent.com/balena-io/services-masterclass/master/README.md &
curl --fail --show-error -o pages/learn/more/masterclasses/fleet-management.md -L https://raw.githubusercontent.com/balena-io-projects/balena-fleet-management-masterclass/master/README.md &
curl --fail --show-error -o pages/learn/more/masterclasses/device-debugging.md -L https://raw.githubusercontent.com/balena-io/debugging-masterclass/master/README.md &
curl --fail --show-error -o pages/learn/more/masterclasses/docker-masterclass.md -L https://raw.githubusercontent.com/balena-io/docker-masterclass/master/README.md &
# pull in balenaLabs GitHub projects
cd shared/projects/ && {
echo "Name|Description
---|---" | tee balena-labs-projects.md balena-example-projects.md >/dev/null
curl --fail --show-error https://api.github.com/orgs/balena-labs-projects/repos?per_page=30 | $JQ -r 'sort_by(-.stargazers_count) | (.[] | [.name,.html_url,.description] | "[\(.[0])](\(.[1]))|\(.[2] // "")") ' >>balena-labs-projects.md
curl --fail --show-error https://api.github.com/orgs/balena-io-examples/repos?per_page=100 | $JQ -r 'sort_by(-.stargazers_count) | (.[] | [.name,.html_url,.description] | "[\(.[0])](\(.[1]))|\(.[2] // "")") ' >>balena-example-projects.md
cd -
} &
# get latest node SDK docs
# cd pages/reference/sdk/ && {
# curl --fail --show-error -O -L https://github.com/balena-io/balena-sdk/raw/master/DOCUMENTATION.md
# echo "# Balena Node.js SDK" >node-sdk.md
# tail -n +2 DOCUMENTATION.md >>node-sdk.md
# rm DOCUMENTATION.md
# cd -
# } &
# get SDK README
cd shared/sdk/ && {
curl --fail --show-error -O -L https://raw.githubusercontent.com/balena-io/balena-sdk/master/README.md
# Extract deprecation text
../../tools/extract-markdown.sh "Deprecation policy" <README.md >deprecation-policy.md
rm README.md
cd -
} &
# get latest python SDK docs
# curl --fail --show-error -o pages/reference/sdk/python-sdk.md -L https://github.com/balena-io/balena-sdk-python/raw/master/DOCUMENTATION.md &
# get latest base images ref docs
cd pages/reference/base-images/ && {
curl --fail --show-error -L https://raw.githubusercontent.com/balena-io-library/base-images/master/docs/base-images-ref.md >temp.md
echo "# Base Images List" >base-images-ref.md
cat temp.md >>base-images-ref.md
rm temp.md
cd -
} &
wait