fix: update install_influxdb.sh for core rename and download releases (#26242)
* fix: update install_influxdb.sh for core rename and download releases * chore(install_influxdb.sh): make shellcheck cleanpull/26244/head
parent
1dd8cccbdd
commit
11e4433852
|
@ -22,5 +22,6 @@
|
||||||
|
|
||||||
See `.circleci/packages/config.yaml` for more info on how git tags map to filenames.
|
See `.circleci/packages/config.yaml` for more info on how git tags map to filenames.
|
||||||
|
|
||||||
|
- When satisfied, update `install_influxdb.sh` to use the new version for `INFLUXDB_VERSION`
|
||||||
|
|
||||||
_At some point this should be scripted so that versions etc are in sync between the steps_
|
_At some point this should be scripted so that versions etc are in sync between the steps_
|
||||||
|
|
|
@ -6,6 +6,9 @@ readonly BOLDGREEN='\033[1;32m'
|
||||||
readonly DIM='\033[2m'
|
readonly DIM='\033[2m'
|
||||||
readonly NC='\033[0m' # No Color
|
readonly NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# No diagnostics for: 'printf "...${FOO}"'
|
||||||
|
# shellcheck disable=SC2059
|
||||||
|
|
||||||
ARCHITECTURE=$(uname -m)
|
ARCHITECTURE=$(uname -m)
|
||||||
ARTIFACT=""
|
ARTIFACT=""
|
||||||
OS=""
|
OS=""
|
||||||
|
@ -13,6 +16,7 @@ INSTALL_LOC=~/.influxdb
|
||||||
BINARY_NAME="influxdb3"
|
BINARY_NAME="influxdb3"
|
||||||
PORT=8181
|
PORT=8181
|
||||||
|
|
||||||
|
INFLUXDB_VERSION="3.0.0-0.beta.4"
|
||||||
EDITION="Core"
|
EDITION="Core"
|
||||||
EDITION_TAG="core"
|
EDITION_TAG="core"
|
||||||
if [ "$1" = "enterprise" ]; then
|
if [ "$1" = "enterprise" ]; then
|
||||||
|
@ -33,12 +37,10 @@ if [ "${OS}" = "Linux" ]; then
|
||||||
# prevents it from running when invoked directly. Since we only want to
|
# prevents it from running when invoked directly. Since we only want to
|
||||||
# use '--verbose', find the path to ldd, then invoke under sh to bypass ldd
|
# use '--verbose', find the path to ldd, then invoke under sh to bypass ldd
|
||||||
# hardening.
|
# hardening.
|
||||||
# XXX: use 'uname -o | grep GNU' instead?
|
|
||||||
ldd_exec=$(command -v ldd)
|
|
||||||
if [ "${ARCHITECTURE}" = "x86_64" ] || [ "${ARCHITECTURE}" = "amd64" ]; then
|
if [ "${ARCHITECTURE}" = "x86_64" ] || [ "${ARCHITECTURE}" = "amd64" ]; then
|
||||||
ARTIFACT="x86_64-unknown-linux-gnu"
|
ARTIFACT="linux_amd64"
|
||||||
elif [ "${ARCHITECTURE}" = "aarch64" ] || [ "${ARCHITECTURE}" = "arm64" ]; then
|
elif [ "${ARCHITECTURE}" = "aarch64" ] || [ "${ARCHITECTURE}" = "arm64" ]; then
|
||||||
ARTIFACT="aarch64-unknown-linux-gnu"
|
ARTIFACT="linux_arm64"
|
||||||
fi
|
fi
|
||||||
elif [ "${OS}" = "Darwin" ]; then
|
elif [ "${OS}" = "Darwin" ]; then
|
||||||
if [ "${ARCHITECTURE}" = "x86_64" ]; then
|
if [ "${ARCHITECTURE}" = "x86_64" ]; then
|
||||||
|
@ -47,7 +49,7 @@ elif [ "${OS}" = "Darwin" ]; then
|
||||||
printf "View alternative binaries on our Getting Started guide at \033[4;94mhttps://docs.influxdata.com/influxdb3/${EDITION_TAG}/${NC}.\n"
|
printf "View alternative binaries on our Getting Started guide at \033[4;94mhttps://docs.influxdata.com/influxdb3/${EDITION_TAG}/${NC}.\n"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
ARTIFACT="aarch64-apple-darwin"
|
ARTIFACT="darwin_arm64"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -59,7 +61,7 @@ fi
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
URL="https://dl.influxdata.com/influxdb/snapshots/influxdb3-${EDITION_TAG}_${ARTIFACT}.tar.gz"
|
URL="https://dl.influxdata.com/influxdb/releases/influxdb3-${EDITION_TAG}-${INFLUXDB_VERSION}_${ARTIFACT}.tar.gz"
|
||||||
|
|
||||||
START_TIME=$(date +%s)
|
START_TIME=$(date +%s)
|
||||||
|
|
||||||
|
@ -135,42 +137,42 @@ fi
|
||||||
printf "${BOLD}Downloading InfluxDB 3 %s to %s${NC}\n" "$EDITION" "$INSTALL_LOC"
|
printf "${BOLD}Downloading InfluxDB 3 %s to %s${NC}\n" "$EDITION" "$INSTALL_LOC"
|
||||||
printf "├─${DIM} mkdir -p '%s'${NC}\n" "$INSTALL_LOC"
|
printf "├─${DIM} mkdir -p '%s'${NC}\n" "$INSTALL_LOC"
|
||||||
mkdir -p "$INSTALL_LOC"
|
mkdir -p "$INSTALL_LOC"
|
||||||
printf "└─${DIM} curl -sSL '%s' -o '%s/influxdb3.tar.gz'${NC}\n" "${URL}" "$INSTALL_LOC"
|
printf "└─${DIM} curl -sSL '%s' -o '%s/influxdb3-${EDITION_TAG}.tar.gz'${NC}\n" "${URL}" "$INSTALL_LOC"
|
||||||
curl -sSL "${URL}" -o "$INSTALL_LOC/influxdb3.tar.gz"
|
curl -sSL "${URL}" -o "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
printf "${BOLD}Verifying '%s/influxdb3.tar.gz'${NC}\n" "$INSTALL_LOC"
|
printf "${BOLD}Verifying '%s/influxdb3-${EDITION_TAG}.tar.gz'${NC}\n" "$INSTALL_LOC"
|
||||||
printf "└─${DIM} curl -sSL '%s.sha256' -o '%s/influxdb3.tar.gz.sha256'${NC}\n" "${URL}" "$INSTALL_LOC"
|
printf "└─${DIM} curl -sSL '%s.sha256' -o '%s/influxdb3-${EDITION_TAG}.tar.gz.sha256'${NC}\n" "${URL}" "$INSTALL_LOC"
|
||||||
curl -sSL "${URL}.sha256" -o "$INSTALL_LOC/influxdb3.tar.gz.sha256"
|
curl -sSL "${URL}.sha256" -o "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz.sha256"
|
||||||
dl_sha=$(cut -d ' ' -f 1 "$INSTALL_LOC/influxdb3.tar.gz.sha256" | grep -E '^[0-9a-f]{64}$')
|
dl_sha=$(cut -d ' ' -f 1 "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz.sha256" | grep -E '^[0-9a-f]{64}$')
|
||||||
if [ -z "$dl_sha" ]; then
|
if [ -z "$dl_sha" ]; then
|
||||||
printf "Could not find properly formatted SHA256 in '%s/influxdb3.tar.gz.sha256'. Aborting.\n" "$INSTALL_LOC"
|
printf "Could not find properly formatted SHA256 in '%s/influxdb3-${EDITION_TAG}.tar.gz.sha256'. Aborting.\n" "$INSTALL_LOC"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
printf "└─${DIM} sha256sum '%s/influxdb3.tar.gz'" "$INSTALL_LOC"
|
printf "└─${DIM} sha256sum '%s/influxdb3-${EDITION_TAG}.tar.gz'" "$INSTALL_LOC"
|
||||||
ch_sha=$(sha256sum "$INSTALL_LOC/influxdb3.tar.gz" | cut -d ' ' -f 1)
|
ch_sha=$(sha256sum "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz" | cut -d ' ' -f 1)
|
||||||
if [ "$ch_sha" = "$dl_sha" ]; then
|
if [ "$ch_sha" = "$dl_sha" ]; then
|
||||||
printf " (OK: %s = %s)${NC}\n" "$ch_sha" "$dl_sha"
|
printf " (OK: %s = %s)${NC}\n" "$ch_sha" "$dl_sha"
|
||||||
else
|
else
|
||||||
printf " (ERROR: %s != %s). Aborting.${NC}\n" "$ch_sha" "$dl_sha"
|
printf " (ERROR: %s != %s). Aborting.${NC}\n" "$ch_sha" "$dl_sha"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
printf "└─${DIM} rm '%s/influxdb3.tar.gz.sha256'${NC}\n" "$INSTALL_LOC"
|
printf "└─${DIM} rm '%s/influxdb3-${EDITION_TAG}.tar.gz.sha256'${NC}\n" "$INSTALL_LOC"
|
||||||
rm "$INSTALL_LOC/influxdb3.tar.gz.sha256"
|
rm "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz.sha256"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
printf "${BOLD}Extracting and Processing${NC}\n"
|
printf "${BOLD}Extracting and Processing${NC}\n"
|
||||||
|
|
||||||
# some tarballs have a leading component, check for that
|
# some tarballs have a leading component, check for that
|
||||||
TAR_LEVEL=0
|
TAR_LEVEL=0
|
||||||
if tar -tf "$INSTALL_LOC/influxdb3.tar.gz" | grep -q '[a-zA-Z0-9]/influxdb3$' ; then
|
if tar -tf "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz" | grep -q '[a-zA-Z0-9]/influxdb3$' ; then
|
||||||
TAR_LEVEL=1
|
TAR_LEVEL=1
|
||||||
fi
|
fi
|
||||||
printf "├─${DIM} tar -xf '%s/influxdb3.tar.gz' --strip-components=${TAR_LEVEL} -C '%s'${NC}\n" "$INSTALL_LOC" "$INSTALL_LOC"
|
printf "├─${DIM} tar -xf '%s/influxdb3-${EDITION_TAG}.tar.gz' --strip-components=${TAR_LEVEL} -C '%s'${NC}\n" "$INSTALL_LOC" "$INSTALL_LOC"
|
||||||
tar -xf "$INSTALL_LOC/influxdb3.tar.gz" --strip-components="${TAR_LEVEL}" -C "$INSTALL_LOC"
|
tar -xf "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz" --strip-components="${TAR_LEVEL}" -C "$INSTALL_LOC"
|
||||||
|
|
||||||
printf "└─${DIM} rm '%s/influxdb3.tar.gz'${NC}\n" "$INSTALL_LOC"
|
printf "└─${DIM} rm '%s/influxdb3-${EDITION_TAG}.tar.gz'${NC}\n" "$INSTALL_LOC"
|
||||||
rm "$INSTALL_LOC/influxdb3.tar.gz"
|
rm "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz"
|
||||||
|
|
||||||
if [ -n "$shellrc" ] && ! grep -q "export PATH=.*$INSTALL_LOC" "$shellrc"; then
|
if [ -n "$shellrc" ] && ! grep -q "export PATH=.*$INSTALL_LOC" "$shellrc"; then
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Reference in New Issue