Skip to content

Commit a7c3e9f

Browse files
authored
update-checksums (#296)
1 parent b18bb1f commit a7c3e9f

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

build.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,26 @@
77
DUMP=wsl-vpnkit.wsl # exported rootfs file
88
TAG_NAME=wslvpnkit # build tag
99
BASE_DISTRO=$1
10+
UPDATE_CHECKSUMS=$2
1011

11-
# build
1212
build_args=()
1313
[ -z "${http_proxy}" ] || build_args+=( --build-arg http_proxy="${http_proxy}" )
1414
[ -z "${https_proxy}" ] || build_args+=( --build-arg https_proxy="${https_proxy}" )
1515
[ -z "${no_proxy}" ] || build_args+=( --build-arg no_proxy="${no_proxy}" )
16-
${DOCKER} build --network host "${build_args[@]}" --tag ${TAG_NAME} --file ./distro/$BASE_DISTRO.dockerfile .
17-
CONTAINER_ID=$(${DOCKER} create ${TAG_NAME})
18-
${DOCKER} export "${CONTAINER_ID}" | gzip > ${DUMP}
16+
17+
if [ "${UPDATE_CHECKSUMS}" = "update-checksums" ]; then
18+
CHECKSUM_TAG="${TAG_NAME}-checksum"
19+
20+
${DOCKER} build --network host "${build_args[@]}" --target gvisor-tap-vsock-arm64 \
21+
--tag "${CHECKSUM_TAG}" --file "./distro/${BASE_DISTRO}.dockerfile" .
22+
GVFORWARDER_CHECKSUM=$(${DOCKER} run --rm "${CHECKSUM_TAG}" sha256sum /app/bin/gvforwarder | cut -d ' ' -f1)
23+
[ "$(grep -Ec '^[[:xdigit:]]+[[:space:]]+\./bin/arm64/gvforwarder$' distro/checksums)" -eq 1 ]
24+
sed -i -E "s|^[[:xdigit:]]+[[:space:]]+\\./bin/arm64/gvforwarder\$|${GVFORWARDER_CHECKSUM} ./bin/arm64/gvforwarder|" distro/checksums
25+
fi
26+
27+
# build
28+
${DOCKER} build --network host "${build_args[@]}" --tag "${TAG_NAME}" --file "./distro/${BASE_DISTRO}.dockerfile" .
29+
CONTAINER_ID=$(${DOCKER} create "${TAG_NAME}")
30+
${DOCKER} export "${CONTAINER_ID}" | gzip > "${DUMP}"
1931
${DOCKER} container rm "${CONTAINER_ID}"
20-
ls -la ${DUMP}
32+
ls -la "${DUMP}"

0 commit comments

Comments
 (0)