summaryrefslogtreecommitdiff
path: root/tools/download.sh
blob: 901fd3f235beb984d4680dda3ee8fb0307e8fec0 (plain)
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
#!/bin/sh


set -euf


# absolute paths
script="$(realpath $0)"
tools="$(dirname "${script}")"
src="$(dirname "${tools}")"
doc="${src}/doc"

documents='
ft232r.pdf	https://www.ftdichip.com/old2020/Support/Documents/DataSheets/ICs/DS_FT232R.pdf
'


mkdir -pv "$doc"

echo "$documents" | while read line
do
	if [ "$line" == '' ]
	then
		continue
	fi

	name="$(echo "$line" | cut -d$'\t' -f1)"
	url="$(echo "$line" | cut -d$'\t' -f2)"
	path="${doc}/${name}"

	if [ ! -f "$path" ]
	then
		curl "$url" > "$path"
	fi
done