| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #!/bin/sh
- # download-2305.sh — fetch the OpenWrt 23.05.6 x86_64 rootfs and the
- # few .ipk packages the testbed needs, and pre-extract them.
- #
- # Idempotent: skips any artifact that already exists.
- #
- # Run from balancer-lite-lua/testbed/.
- set -e
- cd "$(dirname "$0")"
- VER=23.05.6
- BASE_URL="https://downloads.openwrt.org/releases/$VER"
- ROOTFS="$VER-x86-64-rootfs.tar.gz"
- mkdir -p ipks
- # 1. Official rootfs tarball
- if [ ! -f "$ROOTFS" ]; then
- echo "Fetching $ROOTFS ..."
- curl -fSL -o "$ROOTFS" "$BASE_URL/targets/x86/64/openwrt-$ROOTFS"
- fi
- # 2. .ipk payloads (from the 23.05.6 x86_64 base feed)
- fetch_ipk() {
- f="$1"
- if [ -f "ipks/$f" ]; then
- echo " $f: present"
- return 0
- fi
- for feed in "packages/x86_64/base" "packages/x86_64/packages" "packages/x86_64/routing" "targets/x86/64/packages"; do
- if curl -fsSL -o "ipks/$f" "$BASE_URL/$feed/$f"; then
- echo " $f: fetched from $feed"
- return 0
- fi
- done
- echo " $f: NOT FOUND in any feed" >&2
- rm -f "ipks/$f"
- return 1
- }
- fetch_ipk lua_5.1.5-11_x86_64.ipk
- fetch_ipk liblua5.1.5_5.1.5-11_x86_64.ipk
- fetch_ipk openssl-util_3.0.9-2_x86_64.ipk
- fetch_ipk libopenssl3_3.0.9-2_x86_64.ipk
- fetch_ipk ca-bundle_20241223-1_all.ipk
- # 3. Pre-extract rootfs (busybox tar in the image can't read the
- # ar-based .ipk either, so extraction happens on the host)
- if [ ! -d rootfs ] || [ -z "$(ls -A rootfs 2>/dev/null)" ]; then
- rm -rf rootfs ipk-extract
- mkdir -p rootfs ipk-extract
- echo "Extracting rootfs + ipk payloads ..."
- tar xzf "$ROOTFS" -C rootfs
- for ipk in ipks/*.ipk; do
- tar -xOf "$ipk" ./data.tar.gz | tar -xz -C ipk-extract
- done
- fi
- echo "Done. Build with: docker build -f Dockerfile-2305 -t openwrt-testbed-2305:latest ."
|