-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeps
More file actions
executable file
·37 lines (30 loc) · 879 Bytes
/
deps
File metadata and controls
executable file
·37 lines (30 loc) · 879 Bytes
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
#!/usr/bin/env bash
#
# This script reads ./dependencies.tsv and fetches the entries in the
# second column into the first column. A poor man's package manager if
# you will...
if [ ! -f dependencies.tsv ]; then
echo "No 'dependencies.tsv' file"
exit 1
fi
if [ -z $DEST ]; then
echo "DEST is not defined."
exit 1
fi
if [ ! -d $DEST ]; then
echo "Creating $DEST..."
mkdir -p $DEST
fi
while read -r line
do
origin=$(sed -e 's:\(.*\)[[:space:]]::g' <<< $line)
target=$(sed -e 's:[[:space:]]\(.*\)::g' <<< $line)
if [[ -f $DEST/$target ]]; then
echo "$target exists. Skip."
elif [[ -z $origin ]]; then
echo "Could not parse line: '$line'. Skip."
else
(curl -L $origin --silent --fail -o $DEST/$target && echo "Fetched $target" ) || \
echo "FAILED to fetch $target!"
fi
done <dependencies.tsv