From 819c05c3b05f6c1f45f208a2b5d5e38c9491fff8 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Sat, 27 Feb 2021 21:59:26 +0100 Subject: [PATCH] fix: zim-tools_linux-x86_64-2021-02-26 This version removes need for fixRedirects. Details: https://github.com/ipfs/distributed-wikipedia-mirror/issues/86 --- .gitignore | 4 +++- Dockerfile | 13 +++++-------- mirrorzim.sh | 5 ++++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 17ec93a..ddeef37 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,6 @@ notes.md /snapshots node_modules /zim-tools -/kiwix-tools \ No newline at end of file +/kiwix-tools + +bin/zimdump diff --git a/Dockerfile b/Dockerfile index e709282..a78e2aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,20 +6,17 @@ RUN apt update RUN apt -y install --no-install-recommends git ca-certificates curl wget apt-utils # install: -# - zimdump from zim-tools_linux-x86_64-2021-02-12 (2.2.0 nightly) # - node and yarn # - go-ipfs -RUN curl - sL https://ipfs.io/ipfs/QmaXutNuSv9T7w62TzMMKUgtxs9g81GvMt1vKqduLn77Yj -o /usr/local/bin/zimdump \ - && chmod +x /usr/local/bin/zimdump \ - && curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh \ +RUN curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh \ && bash nodesource_setup.sh \ && apt -y install --no-install-recommends nodejs \ && npm install -g yarn \ - && wget -nv https://dist.ipfs.io/go-ipfs/v0.7.0/go-ipfs_v0.7.0_linux-amd64.tar.gz \ - && tar xvfz go-ipfs_v0.7.0_linux-amd64.tar.gz \ + && wget -nv https://dist.ipfs.io/go-ipfs/v0.8.0/go-ipfs_v0.8.0_linux-amd64.tar.gz \ + && tar xvfz go-ipfs_v0.8.0_linux-amd64.tar.gz \ && mv go-ipfs/ipfs /usr/local/bin/ipfs \ - && rm -r go-ipfs && rm go-ipfs_v0.7.0_linux-amd64.tar.gz \ - && ipfs init --profile badgerds --empty-repo \ + && rm -r go-ipfs && rm go-ipfs_v0.8.0_linux-amd64.tar.gz \ + && ipfs init -p server,local-discovery,flatfs,randomports --empty-repo \ && ipfs config --json 'Experimental.ShardingEnabled' true # TODO: move repo init after external volume is mounted diff --git a/mirrorzim.sh b/mirrorzim.sh index daf76d7..341e983 100755 --- a/mirrorzim.sh +++ b/mirrorzim.sh @@ -82,8 +82,11 @@ if [ -z ${MAIN_PAGE_VERSION+x} ]; then MAIN_PAGE_VERSION="" fi +printf "\nEnsure zimdump is present...\n" +PATH=$PATH:$(realpath ./bin) +which zimdump &> /dev/null || (curl --progress-bar -L https://ipfs.io/ipfs/bafybeialu4jsuhs3c3po7juutkwow6kdxeieqcbd6ipjc2tg7qqu7rmsm4 -o ./bin/zimdump && chmod +x ./bin/zimdump) -printf "\nDownload the zim file...\n" +printf "\nDownload and verify the zim file...\n" ZIM_FILE_SOURCE_URL="$(./tools/getzim.sh download $WIKI_TYPE $WIKI_TYPE $LANGUAGE_CODE all maxi latest | grep 'URL:' | cut -d' ' -f3)" ZIM_FILE=$(echo $ZIM_FILE_SOURCE_URL | rev | cut -d'/' -f1 | rev) TMP_DIRECTORY="./tmp/$(echo $ZIM_FILE | cut -d'.' -f1)"