-
Notifications
You must be signed in to change notification settings - Fork 3
/
helloworld-downloader.sh
executable file
·35 lines (27 loc) · 1.42 KB
/
helloworld-downloader.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
#!/bin/bash
set -o errexit
#set -o pipefail ## it's failing for line 82 + 86 in downloader
set -o nounset
IFS=$'\n\t'
# ------------------------------------------------------------------
# [Author] joergi - https://github.com/joergi/WireframeDownloader
# downloader for all Wireframe magzine issues
# based on Magpi Downloader: https://github.com/joergi/MagpiDownloader
# they are downloadable for free under https://wireframe.raspberrypi.org/issues
# or you can buy the paper issues under: https://store.rpipress.cc/collections/wireframe
# this script is under GNU GENERAL PUBLIC LICENSE 3
# ------------------------------------------------------------------
# VERSION=0.2.0
# USAGE="Usage: bash helloworld-downloader.sh [-f firstissue] [-l lastissue]"
OUTDIR=issues
if [ ! -d "$OUTDIR" ]; then
mkdir "$OUTDIR"
fi
downloadUrl="https://www.raspberrypi.org/hello-world/issues/%d"
file="regular-issues.txt";
recentIssue=$(cat "$file");
# workaround for a known limitation in bash 3.x: http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00018.html
# stackoverflow: https://stackoverflow.com/questions/32596123/why-source-command-doesnt-work-with-process-substitution-in-bash-3-2/32596626#32596626
# shellcheck disable=SC1091
source /dev/stdin <<<"$(curl -s https://raw.githubusercontent.com/joergi/downloader/0.5.0/linux_mac/downloader.sh)" "$downloadUrl" "$OUTDIR" "$recentIssue" HelloWorld_ "$@"
exit 0