🛸 Sync 2026-10-06 21:21:05

This commit is contained in:
github-actions[bot] committed 2026-10-06 21:21:05 +08:00
1 parent b239ebf896
commit 3c831d5757
56 files changed
+5677

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
#!/bin/bash
set -e
SRC="/home/zamimondol/easymesh-build/src/luci-app-easymesh"
OUT="/home/zamimondol/easymesh-build/output"
BUILD="/tmp/easymesh-apk"
APK="/home/zamimondol/easymesh-build/sdk-25.12/staging_dir/host/bin/apk"
PO2LMO="/home/zamimondol/easymesh-build/sdk-24.10/staging_dir/hostpkg/bin/po2lmo"
VERSION="2.4.1-r1"
BASE_DEPS="libc luci-base luci-compat luci-lua-runtime libiwinfo-lua kmod-cfg80211 kmod-batman-adv luci-proto-batman-adv batctl-default usteer luci-app-usteer"
mkdir -p "$OUT"
rm -rf "$BUILD"
mkdir -p "$BUILD"
stage_main() {
local DEST="$1"
mkdir -p "$DEST/usr/lib/lua/luci"
cp -a "$SRC/luasrc/." "$DEST/usr/lib/lua/luci/"
[ -d "$SRC/htdocs" ] && { mkdir -p "$DEST/www"; cp -a "$SRC/htdocs/." "$DEST/www/"; }
[ -d "$SRC/root" ] && cp -a "$SRC/root/." "$DEST/"
find "$DEST" -name '*.luadoc' -delete
}
build_apk() {
local NAME="$1" DIR="$2" DEPS="$3" DESC="$4"
local OUTFILE="$OUT/${NAME}-${VERSION}.apk"
rm -f "$OUTFILE"
SOURCE_DATE_EPOCH=0 "$APK" mkpkg \
--info "name:$NAME" \
--info "version:$VERSION" \
--info "arch:noarch" \
--info "description:$DESC" \
--info "maintainer:Arafat Rahman Zami Mondol <arafatrahmanzami@users.noreply.github.com>" \
--info "depends:$DEPS" \
--info "origin:luci-app-easymesh" \
--files "$DIR" \
--output "$OUTFILE"
local MAGIC=$(head -c 4 "$OUTFILE" | od -An -tx1 | tr -d ' \n')
[ "$MAGIC" = "41444264" ] && echo " OK: $NAME" || echo " WARN: $NAME"
}
echo "==> Building APK variants"
# Main (no wpad)
MAIN="$BUILD/main"
mkdir -p "$MAIN"
stage_main "$MAIN"
build_apk "luci-app-easymesh" "$MAIN" "$BASE_DEPS" \
"LuCI Management Interface for EasyMesh (Batman-adv mesh)"
# Meta variants (empty package with just a wpad dep)
for v in openssl wolfssl mbedtls; do
M="$BUILD/meta-$v"
mkdir -p "$M"
build_apk "luci-app-easymesh-wpad-$v" "$M" \
"luci-app-easymesh wpad-mesh-$v" \
"EasyMesh meta-package — installs with wpad-mesh-$v"
done
# i18n
if [ -x "$PO2LMO" ] && [ -f "$SRC/po/zh_Hans/easymesh.po" ]; then
I18N="$BUILD/i18n"
mkdir -p "$I18N/usr/lib/lua/luci/i18n" "$I18N/etc/uci-defaults"
"$PO2LMO" "$SRC/po/zh_Hans/easymesh.po" \
"$I18N/usr/lib/lua/luci/i18n/easymesh.zh-cn.lmo"
echo "uci set luci.languages.zh_cn='简体中文'; uci commit luci" \
> "$I18N/etc/uci-defaults/luci-i18n-easymesh-zh-cn"
build_apk "luci-i18n-easymesh-zh-cn" "$I18N" "libc luci-app-easymesh" \
"Chinese Simplified translation for luci-app-easymesh"
fi
echo ""
echo "============================================================"
ls -lh "$OUT"/*.apk
+104
View File
@@ -0,0 +1,104 @@
#!/bin/bash
set -e
SRC="/home/zamimondol/easymesh-build/src/luci-app-easymesh"
OUT="/home/zamimondol/easymesh-build/output"
BUILD="/tmp/easymesh-ipk-dpkg"
PO2LMO="/home/zamimondol/easymesh-build/sdk-24.10/staging_dir/hostpkg/bin/po2lmo"
V="2.4.1-r1"
PKG="luci-app-easymesh"
I18N="luci-i18n-easymesh-zh-cn"
BASE_DEPS="libc, luci-base, luci-compat, luci-lua-runtime, libiwinfo-lua, kmod-cfg80211, kmod-batman-adv, luci-proto-batman-adv, batctl-default, usteer, luci-app-usteer"
mkdir -p "$OUT"
rm -rf "$BUILD"
mkdir -p "$BUILD"
build_ipk() {
local NAME="$1" DATADIR="$2" DEPS="$3" DESC="$4"
local WORK="$BUILD/$NAME"
rm -rf "$WORK"
mkdir -p "$WORK/DEBIAN"
# Copy data files into deb root
if [ -d "$DATADIR" ]; then
cp -a "$DATADIR/." "$WORK/"
fi
rm -rf "$WORK/CONTROL" "$WORK/.git"
# DEBIAN/control
cat > "$WORK/DEBIAN/control" <<EOF
Package: $NAME
Version: $V
Depends: $DEPS
Architecture: all
Maintainer: Arafat Rahman Zami Mondol <arafatrahmanzami@users.noreply.github.com>
Section: luci
Priority: optional
Description: $DESC
EOF
if [ "$NAME" = "$PKG" ]; then
echo "/etc/config/easymesh" > "$WORK/DEBIAN/conffiles"
cat > "$WORK/DEBIAN/postinst" <<'POST'
#!/bin/sh
[ -n "${IPKG_INSTROOT}" ] && exit 0
rm -f /tmp/luci-indexcache 2>/dev/null
/etc/init.d/rpcd restart 2>/dev/null
/etc/init.d/uhttpd restart 2>/dev/null
exit 0
POST
chmod 0755 "$WORK/DEBIAN/postinst"
fi
# Build .deb (which IS an ar archive, same format as .ipk)
rm -f "$OUT/${NAME}_${V}_all.ipk"
dpkg-deb --build -Zgzip -z9 "$WORK" "$OUT/${NAME}_${V}_all.ipk" >/dev/null
# Verify
local MAGIC=$(head -c 8 "$OUT/${NAME}_${V}_all.ipk" | od -An -tx1 | tr -d ' \n')
if [ "$MAGIC" = "213c617263683e0a" ]; then
echo " OK: $NAME ($(stat -c%s "$OUT/${NAME}_${V}_all.ipk") bytes)"
else
echo " FAIL: $NAME — magic $MAGIC"
fi
}
# Main package
MAIN_DATA="$BUILD/main-data"
mkdir -p "$MAIN_DATA/usr/lib/lua/luci"
cp -a "$SRC/luasrc/." "$MAIN_DATA/usr/lib/lua/luci/"
[ -d "$SRC/root" ] && cp -a "$SRC/root/." "$MAIN_DATA/"
find "$MAIN_DATA" -name '*.luadoc' -delete
echo "==> Main"
build_ipk "$PKG" "$MAIN_DATA" "$BASE_DEPS" \
"LuCI Management Interface for EasyMesh (Batman-adv mesh)"
# Meta packages
for v in openssl wolfssl mbedtls; do
echo "==> Meta $v"
EMPTY="$BUILD/empty"
rm -rf "$EMPTY"; mkdir -p "$EMPTY"
build_ipk "luci-app-easymesh-wpad-$v" "$EMPTY" \
"libc, $PKG, wpad-mesh-$v" \
"EasyMesh meta — installs with wpad-mesh-$v"
done
# i18n
if [ -x "$PO2LMO" ] && [ -f "$SRC/po/zh_Hans/easymesh.po" ]; then
echo "==> i18n"
I18N_DATA="$BUILD/i18n-data"
rm -rf "$I18N_DATA"
mkdir -p "$I18N_DATA/usr/lib/lua/luci/i18n" "$I18N_DATA/etc/uci-defaults"
"$PO2LMO" "$SRC/po/zh_Hans/easymesh.po" \
"$I18N_DATA/usr/lib/lua/luci/i18n/easymesh.zh-cn.lmo"
echo "uci set luci.languages.zh_cn='简体中文'; uci commit luci" \
> "$I18N_DATA/etc/uci-defaults/luci-i18n-easymesh-zh-cn"
build_ipk "$I18N" "$I18N_DATA" "libc, $PKG" "Chinese Simplified"
fi
echo ""
echo "==> Output:"
ls -lh "$OUT"/*.ipk
+121
View File
@@ -0,0 +1,121 @@
#!/bin/bash
set -e
SRC="/home/zamimondol/easymesh-build/src/luci-app-easymesh"
OUT="/home/zamimondol/easymesh-build/output"
BUILD="/tmp/easymesh-tarball"
PO2LMO="/home/zamimondol/easymesh-build/sdk-24.10/staging_dir/hostpkg/bin/po2lmo"
VERSION="2.4.1-r1"
mkdir -p "$OUT"
rm -rf "$BUILD"
mkdir -p "$BUILD"
# =========================================================
# Main app tarball
# =========================================================
echo "==> Building main tarball..."
STAGE="$BUILD/stage-main"
mkdir -p "$STAGE"
# luasrc/ -> usr/lib/lua/luci/
mkdir -p "$STAGE/usr/lib/lua/luci"
cp -a "$SRC/luasrc/." "$STAGE/usr/lib/lua/luci/"
# root/ -> ./ (etc/init.d/easymesh, etc/config/easymesh, etc/uci-defaults/, usr/share/...)
if [ -d "$SRC/root" ]; then
cp -a "$SRC/root/." "$STAGE/"
fi
# htdocs/ (if present) -> www/
if [ -d "$SRC/htdocs" ]; then
mkdir -p "$STAGE/www"
cp -a "$SRC/htdocs/." "$STAGE/www/"
fi
# Remove stray files
find "$STAGE" -name '*.luadoc' -delete
find "$STAGE" -name '.git*' -delete 2>/dev/null || true
# Build the tarball with clean permissions
cd "$STAGE"
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 755 etc/init.d/easymesh 2>/dev/null || true
tar czf "$OUT/luci-app-easymesh-${VERSION}-all.tar.gz" \
--numeric-owner --owner=0 --group=0 \
--sort=name \
--mtime='2026-09-11 00:00:00' \
-C "$STAGE" \
./etc ./usr 2>/dev/null || \
tar czf "$OUT/luci-app-easymesh-${VERSION}-all.tar.gz" \
--numeric-owner --owner=0 --group=0 \
-C "$STAGE" .
echo " Created: $OUT/luci-app-easymesh-${VERSION}-all.tar.gz"
ls -lh "$OUT/luci-app-easymesh-${VERSION}-all.tar.gz"
# Show what's inside
echo ""
echo " Contents:"
tar tzf "$OUT/luci-app-easymesh-${VERSION}-all.tar.gz" | head -25
# =========================================================
# i18n tarball
# =========================================================
if [ -x "$PO2LMO" ] && [ -f "$SRC/po/zh_Hans/easymesh.po" ]; then
echo ""
echo "==> Building i18n tarball..."
STAGE_I18N="$BUILD/stage-i18n"
mkdir -p "$STAGE_I18N/usr/lib/lua/luci/i18n"
mkdir -p "$STAGE_I18N/etc/uci-defaults"
"$PO2LMO" "$SRC/po/zh_Hans/easymesh.po" \
"$STAGE_I18N/usr/lib/lua/luci/i18n/easymesh.zh-cn.lmo"
echo "uci set luci.languages.zh_cn='简体中文 (Chinese Simplified)'; uci commit luci" \
> "$STAGE_I18N/etc/uci-defaults/luci-i18n-easymesh-zh-cn"
chmod -R 755 "$STAGE_I18N/etc"
chmod 644 "$STAGE_I18N/usr/lib/lua/luci/i18n/easymesh.zh-cn.lmo"
tar czf "$OUT/luci-i18n-easymesh-zh-cn-${VERSION}-all.tar.gz" \
--numeric-owner --owner=0 --group=0 \
--sort=name \
--mtime='2026-09-11 00:00:00' \
-C "$STAGE_I18N" .
echo " Created: $OUT/luci-i18n-easymesh-zh-cn-${VERSION}-all.tar.gz"
ls -lh "$OUT/luci-i18n-easymesh-zh-cn-${VERSION}-all.tar.gz"
else
echo "!! po2lmo not found, skipping i18n tarball"
fi
# =========================================================
# Combined "install everything" tarball
# =========================================================
echo ""
echo "==> Building combined tarball (main + i18n)..."
STAGE_ALL="$BUILD/stage-all"
mkdir -p "$STAGE_ALL"
cp -a "$BUILD/stage-main/." "$STAGE_ALL/"
[ -d "$BUILD/stage-i18n" ] && cp -a "$BUILD/stage-i18n/." "$STAGE_ALL/"
tar czf "$OUT/luci-app-easymesh-${VERSION}-full.tar.gz" \
--numeric-owner --owner=0 --group=0 \
--sort=name \
--mtime='2026-09-11 00:00:00' \
-C "$STAGE_ALL" .
echo " Created: $OUT/luci-app-easymesh-${VERSION}-full.tar.gz"
ls -lh "$OUT/luci-app-easymesh-${VERSION}-full.tar.gz"
echo ""
echo "============================================================"
echo "Tarballs in $OUT:"
ls -lh "$OUT"/*.tar.gz
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
"""Create a Debian/OpenWrt .ipk (ar archive) from debian-binary + control.tar.gz + data.tar.gz."""
import sys
import os
import struct
def write_ar_header(f, name, size):
# ar member header is 60 bytes
# name must end with '/' for GNU/SysV compatibility
name_field = (name + '/')[:16].ljust(16)
header = "{}{:<12}{:<6}{:<6}{:<8}{:<10}`\n".format(
name_field, "0", "0", "0", "100644", size
)
f.write(header.encode('ascii'))
def add_file(ar, path, archive_name):
data = open(path, 'rb').read()
write_ar_header(ar, archive_name, len(data))
ar.write(data)
# Pad to even length
if len(data) % 2:
ar.write(b'\n')
def main():
if len(sys.argv) != 5:
print("Usage: make-ipk.py <out.ipk> <debian-binary> <control.tar.gz> <data.tar.gz>")
sys.exit(1)
out, debian_bin, control_tgz, data_tgz = sys.argv[1:]
with open(out, 'wb') as ar:
# Magic
ar.write(b'!<arch>\n')
add_file(ar, debian_bin, 'debian-binary')
add_file(ar, control_tgz, 'control.tar.gz')
add_file(ar, data_tgz, 'data.tar.gz')
if __name__ == '__main__':
main()
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
# Create wpad meta-package APKs (OpenWrt 25.12+ apk format)
set -e
OUT="${1:-/home/zamimondol/easymesh-build/output}"
V="2.4.1-r1"
PKG="luci-app-easymesh"
MAINTAINER="Arafat Rahman Zami Mondol <arafatrahmanzami@users.noreply.github.com>"
APK="/home/zamimondol/easymesh-build/sdk-25.12-fresh/staging_dir/host/bin/apk"
if [ ! -x "$APK" ]; then
echo "ERROR: apk tool not found at $APK"
exit 1
fi
mkdir -p "$OUT"
create_meta_apk() {
local NAME="$1" DEPS="$2" DESC="$3"
local EMPTY="/tmp/meta-apk-empty"
rm -rf "$EMPTY"
mkdir -p "$EMPTY"
rm -f "$OUT/${NAME}-${V}.apk"
SOURCE_DATE_EPOCH=0 "$APK" mkpkg \
--info "name:$NAME" \
--info "version:$V" \
--info "arch:noarch" \
--info "description:$DESC" \
--info "maintainer:$MAINTAINER" \
--info "depends:libc $PKG $DEPS" \
--info "origin:luci-app-easymesh" \
--files "$EMPTY" \
--output "$OUT/${NAME}-${V}.apk" 2>&1 | tail -2
rm -rf "$EMPTY"
local SIZE=$(stat -c%s "$OUT/${NAME}-${V}.apk" 2>/dev/null || echo 0)
local MAGIC=$(head -c 4 "$OUT/${NAME}-${V}.apk" 2>/dev/null | od -An -tx1 | tr -d ' \n')
if [ "$MAGIC" = "41444264" ]; then
echo " OK: $NAME (${SIZE} bytes, ADBd magic)"
else
echo " FAIL: $NAME (magic=$MAGIC)"
fi
}
echo "==> Creating wpad MESH meta APKs"
create_meta_apk "luci-app-easymesh-wpad-openssl" \
"wpad-mesh-openssl" \
"EasyMesh meta - installs with wpad-mesh-openssl (default OpenWrt)"
create_meta_apk "luci-app-easymesh-wpad-wolfssl" \
"wpad-mesh-wolfssl" \
"EasyMesh meta - installs with wpad-mesh-wolfssl (ImmortalWrt default)"
create_meta_apk "luci-app-easymesh-wpad-mbedtls" \
"wpad-mesh-mbedtls" \
"EasyMesh meta - installs with wpad-mesh-mbedtls (lightweight)"
echo ""
ls -lh "$OUT"/luci-app-easymesh-wpad-*.apk
+78
View File
@@ -0,0 +1,78 @@
#!/bin/bash
set -e
OUT="/home/zamimondol/easymesh-build/output"
PKG="/home/zamimondol/easymesh-build/easymesh-pkg"
SRC="/home/zamimondol/easymesh-build/src/luci-app-easymesh"
META="/home/zamimondol/easymesh-build/meta-packages"
V="2.4.1-r1"
rm -rf "$PKG"
mkdir -p "$PKG"/{ipk,apk,tarballs,meta-packages/luci-app-easymesh,meta-packages/wpad-openssl,meta-packages/wpad-wolfssl,meta-packages/wpad-mbedtls}
# Source
cp -a "$SRC/." "$PKG/meta-packages/luci-app-easymesh/"
rm -rf "$PKG/meta-packages/luci-app-easymesh/.git"
cp "$META/openssl/Makefile" "$PKG/meta-packages/wpad-openssl/"
cp "$META/wolfssl/Makefile" "$PKG/meta-packages/wpad-wolfssl/"
cp "$META/mbedtls/Makefile" "$PKG/meta-packages/wpad-mbedtls/"
# IPKs
cp -v "$OUT"/luci-app-easymesh_${V}_all.ipk "$PKG/ipk/"
cp -v "$OUT"/luci-app-easymesh-wpad-openssl_${V}_all.ipk "$PKG/ipk/"
cp -v "$OUT"/luci-app-easymesh-wpad-wolfssl_${V}_all.ipk "$PKG/ipk/"
cp -v "$OUT"/luci-app-easymesh-wpad-mbedtls_${V}_all.ipk "$PKG/ipk/"
find "$OUT" -name "luci-i18n-easymesh-zh-cn_*_all.ipk" -exec cp {} "$PKG/ipk/" \;
# APKs
cp -v "$OUT"/luci-app-easymesh-${V}.apk "$PKG/apk/"
cp -v "$OUT"/luci-app-easymesh-wpad-openssl-${V}.apk "$PKG/apk/"
cp -v "$OUT"/luci-app-easymesh-wpad-wolfssl-${V}.apk "$PKG/apk/"
cp -v "$OUT"/luci-app-easymesh-wpad-mbedtls-${V}.apk "$PKG/apk/"
find "$OUT" -name "luci-i18n-easymesh-zh-cn-*_all.apk" -exec cp {} "$PKG/apk/" \;
# Tarballs
find "$OUT" -name "luci-app-easymesh-${V}-*.tar.gz" -exec cp {} "$PKG/tarballs/" \;
cat > "$PKG/MANIFEST.txt" <<EOF
EasyMesh $V — Package Bundle
Generated: $(date)
Pick ONE of the following for your router:
A) Fresh install, want auto wpad selection
OpenWrt 24.10 (opkg):
opkg install ipk/luci-app-easymesh_${V}_all.ipk
opkg install ipk/luci-app-easymesh-wpad-openssl_${V}_all.ipk
OpenWrt 25.12 (apk):
apk add --allow-untrusted apk/luci-app-easymesh-${V}.apk
apk add --allow-untrusted apk/luci-app-easymesh-wpad-openssl-${V}.apk
B) Already have wpad-mesh-wolfssl (ImmortalWrt default)
Use wpad-wolfssl variant instead
C) Already have wpad-mesh-mbedtls (lightweight builds)
Use wpad-mbedtls variant instead
D) Any OpenWrt, any wpad already installed
opkg install ipk/luci-app-easymesh_${V}_all.ipk
(no wpad meta needed)
E) Tarball install (any OpenWrt)
scp tarballs/luci-app-easymesh-${V}-full.tar.gz root@router:/tmp/
ssh root@router
cd /
tar xzf /tmp/luci-app-easymesh-${V}-full.tar.gz
chmod +x /etc/init.d/easymesh
rm -f /tmp/luci-indexcache
/etc/init.d/rpcd restart
/etc/init.d/uhttpd restart
(Installs the app. Install your wpad variant separately.)
Credits:
Original: torguardvpn/luci-app-easymesh
Fixes: mobing8/luci-app-easymesh-dawn
This build: Arafat Rahman Zami Mondol
EOF
echo "Bundle ready: $PKG"
du -sh "$PKG"/*
+214
View File
@@ -0,0 +1,214 @@
#!/bin/bash
# Verify all EasyMesh build artifacts before shipping
OUT="/home/zamimondol/easymesh-build/output"
PKG="/home/zamimondol/easymesh-build/easymesh-pkg"
BUNDLE="/home/zamimondol/easymesh-build/easymesh-pkg-2.4.1-r1.tar.gz"
SRC="/home/zamimondol/easymesh-build/src/luci-app-easymesh"
V="2.4.1-r1"
PASS=0
FAIL=0
check() {
local label="$1" result="$2"
if [ "$result" = "0" ]; then
echo " [PASS] $label"
PASS=$((PASS+1))
else
echo " [FAIL] $label"
FAIL=$((FAIL+1))
fi
}
section() { echo ""; echo "=== $1 ==="; }
TMP=$(mktemp -d)
trap "rm -rf $TMP" EXIT
# ============================================================
section "1. Source tree"
# ============================================================
[ -f "$SRC/Makefile" ]
check "Makefile exists" $?
[ -f "$SRC/luasrc/model/cbi/easymesh.lua" ]
check "CBI model exists" $?
[ -f "$SRC/luasrc/controller/easymesh.lua" ]
check "Controller exists" $?
[ -f "$SRC/root/etc/init.d/easymesh" ]
check "Init script exists" $?
[ -f "$SRC/root/etc/config/easymesh" ]
check "Config file exists" $?
[ -f "$SRC/root/etc/rc.wps/easymesh-pair" ]
check "WPS handler (rc.wps) exists" $?
[ ! -d "$SRC/root/etc/rc.button" ]
check "No rc.button dir (no conflict)" $?
[ -f "$SRC/root/etc/uci-defaults/luci-easymesh" ]
check "UCI-defaults exists" $?
grep -q "PKG_VERSION:=2.4.1" "$SRC/Makefile"
check "Version is 2.4.1" $?
grep -q "PKG_RELEASE:=1" "$SRC/Makefile"
check "Release is 1" $?
grep -q "LUCI_PKGARCH:=all" "$SRC/Makefile"
check "PKGARCH=all (universal)" $?
! grep -q "+wpad-mesh" "$SRC/Makefile"
check "No wpad dep in Makefile" $?
! grep -qE "uci set.*='.*'" "$SRC/root/etc/init.d/easymesh"
check "No escaped quotes in init script" $?
lua5.3 -e "assert(loadfile('$SRC/luasrc/model/cbi/easymesh.lua'))" 2>/dev/null
check "CBI Lua syntax valid" $?
sh -n "$SRC/root/etc/init.d/easymesh"
check "Init script syntax valid" $?
# ============================================================
section "2. IPK files"
# ============================================================
for p in luci-app-easymesh luci-app-easymesh-wpad-openssl \
luci-app-easymesh-wpad-wolfssl luci-app-easymesh-wpad-mbedtls \
luci-i18n-easymesh-zh-cn
do
F="$OUT/${p}_${V}_all.ipk"
[ -f "$F" ]
check "IPK present: $(basename $F)" $?
done
# Verify main IPK contents
D="$TMP/ipk"; mkdir -p "$D"; cd "$D"
if ar x "$OUT/luci-app-easymesh_${V}_all.ipk" 2>/dev/null; then
check "Main IPK is valid ar archive" 0
tar xzf control.tar.gz 2>/dev/null
grep -q "Package: luci-app-easymesh" control
check "Main IPK control: package name" $?
grep -q "Version: 2.4.1-r1" control
check "Main IPK control: version" $?
grep -q "Architecture: all" control
check "Main IPK control: arch=all" $?
grep -q "Depends:.*kmod-batman-adv" control
check "Main IPK control: has batman dep" $?
! grep -q "Depends:.*wpad-mesh" control
check "Main IPK control: no wpad dep" $?
tar tzf data.tar.gz | grep -q "etc/rc.wps/easymesh-pair"
check "Main IPK data: rc.wps handler present" $?
! tar tzf data.tar.gz | grep -q "etc/rc.button/wps"
check "Main IPK data: no rc.button conflict" $?
tar tzf data.tar.gz | grep -q "etc/init.d/easymesh"
check "Main IPK data: init.d present" $?
tar tzf data.tar.gz | grep -q "usr/lib/lua/luci/model/cbi/easymesh.lua"
check "Main IPK data: CBI present" $?
else
check "Main IPK is valid ar archive" 1
fi
cd "$TMP"
# Verify a meta IPK
D="$TMP/meta"; mkdir -p "$D"; cd "$D"
if ar x "$OUT/luci-app-easymesh-wpad-wolfssl_${V}_all.ipk" 2>/dev/null; then
tar xzf control.tar.gz 2>/dev/null
grep -q "Package: luci-app-easymesh-wpad-wolfssl" control
check "Wolfssl meta: correct name" $?
grep -q "Depends:.*wpad-mesh-wolfssl" control
check "Wolfssl meta: depends on wolfssl" $?
grep -q "Depends:.*luci-app-easymesh" control
check "Wolfssl meta: depends on main" $?
fi
cd "$TMP"
# ============================================================
section "3. APK files"
# ============================================================
for p in luci-app-easymesh luci-app-easymesh-wpad-openssl \
luci-app-easymesh-wpad-wolfssl luci-app-easymesh-wpad-mbedtls \
luci-i18n-easymesh-zh-cn
do
F="$OUT/${p}-${V}.apk"
[ -f "$F" ]
check "APK present: $(basename $F)" $?
if [ -f "$F" ]; then
MAGIC=$(head -c 4 "$F" 2>/dev/null | od -An -tx1 | tr -d ' \n')
[ "$MAGIC" = "41444264" ]
check " magic bytes ADBd: $(basename $F)" $?
fi
done
# ============================================================
section "4. Tarballs"
# ============================================================
for t in luci-app-easymesh-${V}-all.tar.gz \
luci-app-easymesh-${V}-full.tar.gz \
luci-i18n-easymesh-zh-cn-${V}-all.tar.gz
do
F="$OUT/$t"
[ -f "$F" ]
check "Tarball present: $t" $?
if [ -f "$F" ]; then
tar tzf "$F" >/dev/null 2>&1
check " tarball valid: $t" $?
fi
done
# Verify full tarball contains the right paths
tar tzf "$OUT/luci-app-easymesh-${V}-full.tar.gz" 2>/dev/null | grep -q "etc/rc.wps/easymesh-pair"
check "Full tarball: rc.wps present" $?
tar tzf "$OUT/luci-app-easymesh-${V}-full.tar.gz" 2>/dev/null | grep -q "etc/init.d/easymesh"
check "Full tarball: init.d present" $?
# ============================================================
section "5. Bundle folder"
# ============================================================
[ -d "$PKG" ]
check "Bundle folder exists" $?
[ -f "$PKG/MANIFEST.txt" ]
check "MANIFEST.txt present" $?
[ -f "$PKG/ipk/luci-app-easymesh_${V}_all.ipk" ]
check "Bundle has main IPK" $?
[ -f "$PKG/apk/luci-app-easymesh-${V}.apk" ]
check "Bundle has main APK" $?
[ -f "$PKG/meta-packages/luci-app-easymesh/Makefile" ]
check "Bundle has source" $?
[ -f "$PKG/meta-packages/wpad-openssl/Makefile" ]
check "Bundle has openssl meta Makefile" $?
[ -f "$PKG/meta-packages/wpad-wolfssl/Makefile" ]
check "Bundle has wolfssl meta Makefile" $?
[ -f "$PKG/meta-packages/wpad-mbedtls/Makefile" ]
check "Bundle has mbedtls meta Makefile" $?
[ -f "$BUNDLE" ]
check "Bundle tarball exists" $?
if [ -f "$BUNDLE" ]; then
tar tzf "$BUNDLE" >/dev/null 2>&1
check "Bundle tarball valid" $?
fi
# ============================================================
echo ""
echo "============================================================"
echo "RESULT: $PASS passed, $FAIL failed"
echo "============================================================"
[ $FAIL -eq 0 ] && exit 0 || exit 1