fix exit on 404 code and space in vars
This commit is contained in:
parent
f05b66ee19
commit
b2db3af075
30
books.sh
30
books.sh
|
@ -1,25 +1,23 @@
|
||||||
# Google SRE Books.
|
# Google SRE Books.
|
||||||
|
|
||||||
|
# NOTE: The indentation before inner vars should be always "tab" not "space".
|
||||||
declare -A BOOKS
|
declare -A BOOKS
|
||||||
BOOKS=(
|
BOOKS=(
|
||||||
|
|
||||||
# Site Reliability Engineering
|
# Site Reliability Engineering
|
||||||
["SRE_BOOK"]=$(
|
["SRE_BOOK"]='
|
||||||
echo '
|
BOOK_NAME=sre-book
|
||||||
BOOK_NAME=sre-book
|
BOOK_NAME_FULL=Site Reliability Engineering
|
||||||
BOOK_NAME_FULL=Site Reliability Engineering
|
BOOK_FILE=google-sre-book
|
||||||
BOOK_FILE=google-sre-book
|
BOOK_TOC_URL=https://landing.google.com/sre/sre-book/toc/index.html
|
||||||
BOOK_TOC_URL=https://landing.google.com/sre/sre-book/toc/index.html
|
'
|
||||||
'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Site Reliability Workbook
|
# Site Reliability Workbook
|
||||||
["SRW_BOOK"]=$(
|
["SRW_BOOK"]='
|
||||||
echo '
|
BOOK_NAME=workbook
|
||||||
BOOK_NAME=workbook
|
BOOK_NAME_FULL=The Site Reliability Workbook
|
||||||
BOOK_NAME_FULL=The Site Reliability Workbook
|
BOOK_FILE=google-sre-workbook
|
||||||
BOOK_FILE=google-sre-workbook
|
BOOK_TOC_URL=https://landing.google.com/sre/workbook/toc/index.html
|
||||||
BOOK_TOC_URL=https://landing.google.com/sre/workbook/toc/index.html
|
'
|
||||||
'
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,13 +3,13 @@ if [[ "${DEBUG}" == 1 ]]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
# Get book details.
|
# Get book details.
|
||||||
source books.sh
|
source books.sh
|
||||||
export ${BOOKS[${BOOK_SLUG^^}]}
|
export ${BOOKS[${BOOK_SLUG^^}]}
|
||||||
|
|
||||||
# Common vars.
|
# Common vars.
|
||||||
IFS=$'\n\t'
|
|
||||||
IMGS_DOMAIN="lh3.googleusercontent.com"
|
IMGS_DOMAIN="lh3.googleusercontent.com"
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -20,6 +20,7 @@ IMGS_DOMAIN="lh3.googleusercontent.com"
|
||||||
# Enable recursion, timestamping (--mirror)
|
# Enable recursion, timestamping (--mirror)
|
||||||
# Images are hosted elsewhere, download them as well.
|
# Images are hosted elsewhere, download them as well.
|
||||||
# We need to go up a level from /toc/ where we start
|
# We need to go up a level from /toc/ where we start
|
||||||
|
# The "ture" at the end to ignore non-200 URLs like 404.
|
||||||
wget \
|
wget \
|
||||||
--convert-links \
|
--convert-links \
|
||||||
--directory-prefix=html \
|
--directory-prefix=html \
|
||||||
|
@ -31,7 +32,7 @@ wget \
|
||||||
--mirror \
|
--mirror \
|
||||||
--no-verbose \
|
--no-verbose \
|
||||||
--recursive \
|
--recursive \
|
||||||
--domains=${IMGS_DOMAIN},landing.google.com ${BOOK_TOC_URL}
|
--domains=${IMGS_DOMAIN},landing.google.com ${BOOK_TOC_URL} || true
|
||||||
|
|
||||||
#
|
#
|
||||||
echo "Get working mode..."
|
echo "Get working mode..."
|
||||||
|
|
Loading…
Reference in New Issue