diff --git a/books.sh b/books.sh index 5de308f..f1f0e38 100644 --- a/books.sh +++ b/books.sh @@ -1,25 +1,23 @@ # Google SRE Books. + +# NOTE: The indentation before inner vars should be always "tab" not "space". declare -A BOOKS BOOKS=( # Site Reliability Engineering - ["SRE_BOOK"]=$( - echo ' - BOOK_NAME=sre-book - BOOK_NAME_FULL=Site Reliability Engineering - BOOK_FILE=google-sre-book - BOOK_TOC_URL=https://landing.google.com/sre/sre-book/toc/index.html - ' - ) + ["SRE_BOOK"]=' + BOOK_NAME=sre-book + BOOK_NAME_FULL=Site Reliability Engineering + BOOK_FILE=google-sre-book + BOOK_TOC_URL=https://landing.google.com/sre/sre-book/toc/index.html + ' # Site Reliability Workbook - ["SRW_BOOK"]=$( - echo ' - BOOK_NAME=workbook - BOOK_NAME_FULL=The Site Reliability Workbook - BOOK_FILE=google-sre-workbook - BOOK_TOC_URL=https://landing.google.com/sre/workbook/toc/index.html - ' - ) + ["SRW_BOOK"]=' + BOOK_NAME=workbook + BOOK_NAME_FULL=The Site Reliability Workbook + BOOK_FILE=google-sre-workbook + BOOK_TOC_URL=https://landing.google.com/sre/workbook/toc/index.html + ' ) diff --git a/bootstrap.sh b/bootstrap.sh index f9f06b3..79af46b 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -3,13 +3,13 @@ if [[ "${DEBUG}" == 1 ]]; then set -x fi set -euo pipefail +IFS=$'\n\t' # Get book details. source books.sh export ${BOOKS[${BOOK_SLUG^^}]} # Common vars. -IFS=$'\n\t' IMGS_DOMAIN="lh3.googleusercontent.com" # @@ -20,6 +20,7 @@ IMGS_DOMAIN="lh3.googleusercontent.com" # Enable recursion, timestamping (--mirror) # Images are hosted elsewhere, download them as well. # 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 \ --convert-links \ --directory-prefix=html \ @@ -31,7 +32,7 @@ wget \ --mirror \ --no-verbose \ --recursive \ - --domains=${IMGS_DOMAIN},landing.google.com ${BOOK_TOC_URL} + --domains=${IMGS_DOMAIN},landing.google.com ${BOOK_TOC_URL} || true # echo "Get working mode..."