zero-gravity: detect tarball layout — galileo 3.0.8 moved binaries to a shared root bin/ #63
@@ -48,17 +48,52 @@ RUN set -eu; \
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RUN tar -xzf /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz -C /tmp
|
# Extract by DETECTING the layout rather than assuming one per chain. 0G has shipped
|
||||||
RUN if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "galileo" ]; then \
|
# three shapes so far and changed between them without notice:
|
||||||
mv /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/rpc /0g; \
|
#
|
||||||
|
# galileo <= 3.0.3 <root>/{rpc,validator,archive,seed}/bin/ + configs (168 MB)
|
||||||
|
# -> binaries duplicated inside every profile dir
|
||||||
|
# galileo >= 3.0.8 <root>/bin/ shared, + <root>/{rpc,...}/ configs (69 MB)
|
||||||
|
# -> binaries DEDUPLICATED to the tarball root; rpc/ is configs-only
|
||||||
|
# aristotle 1.0.x <root>/bin/ + configs, no profile dirs at all
|
||||||
|
#
|
||||||
|
# So "does <root>/rpc exist" is NOT sufficient: 3.0.8 still has rpc/, it just no longer
|
||||||
|
# holds bin/. Take configs from the profile dir when present, then top the binaries up
|
||||||
|
# from the shared root bin/ if the profile dir didn't supply them.
|
||||||
|
#
|
||||||
|
# The old code hardcoded "galileo -> mv <root>/rpc /0g", so 3.0.8 yielded configs but no
|
||||||
|
# binaries and the build died two layers later at
|
||||||
|
# `chmod: cannot access '/0g/bin/0gchaind'` — an error naming neither the chain, the
|
||||||
|
# version, nor the layout. Assert on the binaries here so the NEXT upstream reshuffle
|
||||||
|
# reports itself at the point of failure instead.
|
||||||
|
RUN set -eu; \
|
||||||
|
SRC="/tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}"; \
|
||||||
|
tar -xzf "${SRC}.tar.gz" -C /tmp; \
|
||||||
|
mkdir -p /0g; \
|
||||||
|
if [ -d "${SRC}/rpc" ]; then \
|
||||||
|
echo "0g: profile dir found -> ${SRC}/rpc"; \
|
||||||
|
cp -a "${SRC}/rpc/." /0g/; \
|
||||||
else \
|
else \
|
||||||
mkdir -p /0g && \
|
echo "0g: no profile dir -> using tarball root ${SRC}"; \
|
||||||
cp -a /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/* /0g/ 2>/dev/null || true; \
|
cp -a "${SRC}/." /0g/; \
|
||||||
cp -a /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/.[^.]* /0g/ 2>/dev/null || true; \
|
fi; \
|
||||||
rm -rf /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}; \
|
if [ ! -f /0g/bin/0gchaind ] && [ -d "${SRC}/bin" ]; then \
|
||||||
fi
|
echo "0g: binaries not in the profile dir -> topping up from ${SRC}/bin"; \
|
||||||
|
cp -a "${SRC}/bin" /0g/; \
|
||||||
RUN chmod +x /0g/bin/0gchaind
|
fi; \
|
||||||
RUN chmod +x /0g/bin/geth
|
rm -rf "${SRC}"; \
|
||||||
|
missing=""; \
|
||||||
|
for b in 0gchaind geth; do \
|
||||||
|
[ -f "/0g/bin/${b}" ] || missing="${missing} bin/${b}"; \
|
||||||
|
done; \
|
||||||
|
if [ -n "${missing}" ]; then \
|
||||||
|
echo "0g: FATAL - missing after extraction:${missing}" >&2; \
|
||||||
|
echo "0g: ${ZERO_GRAVITY_CHAIN_SPEC} v${ZERO_GRAVITY_VERSION} tarball layout not recognised." >&2; \
|
||||||
|
echo "0g: known layouts are '<root>/rpc/bin/' (per-profile) and '<root>/bin/' (flat)." >&2; \
|
||||||
|
echo "0g: contents of /0g were:" >&2; \
|
||||||
|
ls -la /0g >&2 || true; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
chmod +x /0g/bin/0gchaind /0g/bin/geth
|
||||||
|
|
||||||
ENTRYPOINT [ "init.sh" ]
|
ENTRYPOINT [ "init.sh" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user