feat(build): Add support for luci-theme-* packages in local-build.sh
Extended the local build script to support both luci-app-* and luci-theme-* package patterns, enabling builds of theme packages like luci-theme-secubox. Changes: - Updated validate_makefiles() to validate both package types - Extended copy_packages() to copy both luci-app-* and luci-theme-* packages - Modified configure_packages() to enable both package types in .config - Updated build_packages() to build both package types - Enhanced collect_artifacts() to find and collect theme packages - Added luci-theme-* pattern support in argument parsing - Updated firmware build to copy both package types to OpenWrt Tested with: ./local-build.sh build luci-theme-secubox Result: Successfully built luci-theme-secubox-0.4.0-r1.apk 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a6477b8710
commit
3e1da58d73
@ -153,6 +153,7 @@ validate_makefiles() {
|
|||||||
|
|
||||||
local errors=0
|
local errors=0
|
||||||
|
|
||||||
|
# Validate luci-app-* packages
|
||||||
for makefile in ../luci-app-*/Makefile; do
|
for makefile in ../luci-app-*/Makefile; do
|
||||||
if [[ -f "$makefile" ]]; then
|
if [[ -f "$makefile" ]]; then
|
||||||
local pkg=$(dirname "$makefile" | xargs basename)
|
local pkg=$(dirname "$makefile" | xargs basename)
|
||||||
@ -176,6 +177,30 @@ validate_makefiles() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Validate luci-theme-* packages
|
||||||
|
for makefile in ../luci-theme-*/Makefile; do
|
||||||
|
if [[ -f "$makefile" ]]; then
|
||||||
|
local pkg=$(dirname "$makefile" | xargs basename)
|
||||||
|
echo " 🔍 Checking $pkg..."
|
||||||
|
|
||||||
|
# Required fields
|
||||||
|
local required_fields=("PKG_NAME" "PKG_VERSION" "PKG_RELEASE" "PKG_LICENSE")
|
||||||
|
|
||||||
|
for field in "${required_fields[@]}"; do
|
||||||
|
if ! grep -q "^${field}:=" "$makefile"; then
|
||||||
|
print_error "Missing: $field in $pkg"
|
||||||
|
errors=$((errors + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check for include statements
|
||||||
|
if ! grep -q "include.*luci.mk\|include.*package.mk" "$makefile"; then
|
||||||
|
print_error "Missing include statement in $pkg"
|
||||||
|
errors=$((errors + 1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [[ $errors -gt 0 ]]; then
|
if [[ $errors -gt 0 ]]; then
|
||||||
print_error "Found $errors Makefile errors"
|
print_error "Found $errors Makefile errors"
|
||||||
return 1
|
return 1
|
||||||
@ -543,6 +568,7 @@ copy_packages() {
|
|||||||
else
|
else
|
||||||
print_info "Copying all packages"
|
print_info "Copying all packages"
|
||||||
|
|
||||||
|
# Copy luci-app-* packages
|
||||||
for pkg in ../../luci-app-*/; do
|
for pkg in ../../luci-app-*/; do
|
||||||
if [[ -d "$pkg" && -f "${pkg}Makefile" ]]; then
|
if [[ -d "$pkg" && -f "${pkg}Makefile" ]]; then
|
||||||
local pkg_name=$(basename "$pkg")
|
local pkg_name=$(basename "$pkg")
|
||||||
@ -554,11 +580,25 @@ copy_packages() {
|
|||||||
echo " ✓ Fixed Makefile include path"
|
echo " ✓ Fixed Makefile include path"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Copy luci-theme-* packages
|
||||||
|
for pkg in ../../luci-theme-*/; do
|
||||||
|
if [[ -d "$pkg" && -f "${pkg}Makefile" ]]; then
|
||||||
|
local pkg_name=$(basename "$pkg")
|
||||||
|
echo " 📁 $pkg_name"
|
||||||
|
cp -r "$pkg" "$feed_dir/"
|
||||||
|
|
||||||
|
# Fix Makefile include path for feed structure
|
||||||
|
sed -i 's|include.*luci\.mk|include $(TOPDIR)/feeds/luci/luci.mk|' "$feed_dir/$pkg_name/Makefile"
|
||||||
|
echo " ✓ Fixed Makefile include path"
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
print_info "Packages in feed:"
|
print_info "Packages in feed:"
|
||||||
ls -d "$feed_dir/luci-app-"*/ 2>/dev/null || echo "None"
|
ls -d "$feed_dir/luci-app-"*/ 2>/dev/null || true
|
||||||
|
ls -d "$feed_dir/luci-theme-"*/ 2>/dev/null || true
|
||||||
|
|
||||||
# Update the secubox feed
|
# Update the secubox feed
|
||||||
echo ""
|
echo ""
|
||||||
@ -572,6 +612,7 @@ copy_packages() {
|
|||||||
echo " Installing $single_package..."
|
echo " Installing $single_package..."
|
||||||
./scripts/feeds install "$single_package"
|
./scripts/feeds install "$single_package"
|
||||||
else
|
else
|
||||||
|
# Install luci-app-* packages
|
||||||
for pkg in "$feed_dir"/luci-app-*/; do
|
for pkg in "$feed_dir"/luci-app-*/; do
|
||||||
if [[ -d "$pkg" ]]; then
|
if [[ -d "$pkg" ]]; then
|
||||||
local pkg_name=$(basename "$pkg")
|
local pkg_name=$(basename "$pkg")
|
||||||
@ -579,6 +620,15 @@ copy_packages() {
|
|||||||
./scripts/feeds install "$pkg_name" 2>&1 | grep -v "WARNING:" || true
|
./scripts/feeds install "$pkg_name" 2>&1 | grep -v "WARNING:" || true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Install luci-theme-* packages
|
||||||
|
for pkg in "$feed_dir"/luci-theme-*/; do
|
||||||
|
if [[ -d "$pkg" ]]; then
|
||||||
|
local pkg_name=$(basename "$pkg")
|
||||||
|
echo " Installing $pkg_name..."
|
||||||
|
./scripts/feeds install "$pkg_name" 2>&1 | grep -v "WARNING:" || true
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd - > /dev/null
|
cd - > /dev/null
|
||||||
@ -608,7 +658,7 @@ configure_packages() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Enable all SecuBox packages from feed
|
# Enable all SecuBox packages from feed (luci-app-*)
|
||||||
for pkg in feeds/secubox/luci-app-*/; do
|
for pkg in feeds/secubox/luci-app-*/; do
|
||||||
if [[ -d "$pkg" ]]; then
|
if [[ -d "$pkg" ]]; then
|
||||||
local pkg_name=$(basename "$pkg")
|
local pkg_name=$(basename "$pkg")
|
||||||
@ -616,6 +666,15 @@ configure_packages() {
|
|||||||
print_success "$pkg_name enabled"
|
print_success "$pkg_name enabled"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Enable all SecuBox theme packages from feed (luci-theme-*)
|
||||||
|
for pkg in feeds/secubox/luci-theme-*/; do
|
||||||
|
if [[ -d "$pkg" ]]; then
|
||||||
|
local pkg_name=$(basename "$pkg")
|
||||||
|
echo "CONFIG_PACKAGE_${pkg_name}=m" >> .config
|
||||||
|
print_success "$pkg_name enabled"
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable problematic packages that fail to compile in SDK
|
# Disable problematic packages that fail to compile in SDK
|
||||||
@ -678,9 +737,15 @@ build_packages() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
# Build luci-app-* packages
|
||||||
for pkg in feeds/secubox/luci-app-*/; do
|
for pkg in feeds/secubox/luci-app-*/; do
|
||||||
[[ -d "$pkg" ]] && packages_to_build+=("$(basename "$pkg")")
|
[[ -d "$pkg" ]] && packages_to_build+=("$(basename "$pkg")")
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Build luci-theme-* packages
|
||||||
|
for pkg in feeds/secubox/luci-theme-*/; do
|
||||||
|
[[ -d "$pkg" ]] && packages_to_build+=("$(basename "$pkg")")
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build packages
|
# Build packages
|
||||||
@ -757,6 +822,7 @@ collect_artifacts() {
|
|||||||
|
|
||||||
# Find and copy package files (.apk or .ipk)
|
# Find and copy package files (.apk or .ipk)
|
||||||
find "$SDK_DIR/bin" -name "luci-app-*.${pkg_ext}" -exec cp {} "$BUILD_DIR/$ARCH/" \; 2>/dev/null || true
|
find "$SDK_DIR/bin" -name "luci-app-*.${pkg_ext}" -exec cp {} "$BUILD_DIR/$ARCH/" \; 2>/dev/null || true
|
||||||
|
find "$SDK_DIR/bin" -name "luci-theme-*.${pkg_ext}" -exec cp {} "$BUILD_DIR/$ARCH/" \; 2>/dev/null || true
|
||||||
|
|
||||||
# Also collect any SecuBox related packages
|
# Also collect any SecuBox related packages
|
||||||
find "$SDK_DIR/bin" -name "*secubox*.${pkg_ext}" -exec cp {} "$BUILD_DIR/$ARCH/" \; 2>/dev/null || true
|
find "$SDK_DIR/bin" -name "*secubox*.${pkg_ext}" -exec cp {} "$BUILD_DIR/$ARCH/" \; 2>/dev/null || true
|
||||||
@ -929,6 +995,8 @@ copy_secubox_to_openwrt() {
|
|||||||
mkdir -p package/secubox
|
mkdir -p package/secubox
|
||||||
|
|
||||||
local pkg_count=0
|
local pkg_count=0
|
||||||
|
|
||||||
|
# Copy luci-app-* packages
|
||||||
for pkg in ../../luci-app-*/; do
|
for pkg in ../../luci-app-*/; do
|
||||||
if [[ -d "$pkg" ]]; then
|
if [[ -d "$pkg" ]]; then
|
||||||
local pkg_name=$(basename "$pkg")
|
local pkg_name=$(basename "$pkg")
|
||||||
@ -945,6 +1013,23 @@ copy_secubox_to_openwrt() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Copy luci-theme-* packages
|
||||||
|
for pkg in ../../luci-theme-*/; do
|
||||||
|
if [[ -d "$pkg" ]]; then
|
||||||
|
local pkg_name=$(basename "$pkg")
|
||||||
|
echo " ✅ $pkg_name"
|
||||||
|
cp -r "$pkg" package/secubox/
|
||||||
|
|
||||||
|
# Fix Makefile include path
|
||||||
|
if [[ -f "package/secubox/$pkg_name/Makefile" ]]; then
|
||||||
|
sed -i 's|include.*luci\.mk|include $(TOPDIR)/feeds/luci/luci.mk|' \
|
||||||
|
"package/secubox/$pkg_name/Makefile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pkg_count=$((pkg_count + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
cd - > /dev/null
|
cd - > /dev/null
|
||||||
|
|
||||||
print_success "Copied $pkg_count SecuBox packages"
|
print_success "Copied $pkg_count SecuBox packages"
|
||||||
@ -1494,7 +1579,7 @@ main() {
|
|||||||
arch_specified=true
|
arch_specified=true
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
luci-app-*)
|
luci-app-*|luci-theme-*)
|
||||||
single_package="$1"
|
single_package="$1"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user