This commit is contained in:
biss committed 2026-09-08 20:01:03 +08:00
commit 645c461d2a
12 files changed
+886

No files matched your search

+160
View File
@@ -0,0 +1,160 @@
name: Build OpenWrt packages
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- openwrt: "25.12.0"
format: "apk"
sdk_file: "openwrt-sdk-25.12.0-x86-64_gcc-14.3.0_musl.Linux-x86_64.tar.zst"
sdk_sha256: "9f371906ce6d2f95418f69fac06df58bf9df0ffc4abed6206c30f1b547fcfc12"
sdk_url: "https://downloads.openwrt.org/releases/25.12.0/targets/x86/64/openwrt-sdk-25.12.0-x86-64_gcc-14.3.0_musl.Linux-x86_64.tar.zst"
- openwrt: "24.10.8"
format: "ipk"
sdk_file: "openwrt-sdk-24.10.8-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst"
sdk_sha256: "ac4a0405d2eea821b06f93c14ba13ffa90ad0457648903df7dde02570027ab21"
sdk_url: "https://downloads.openwrt.org/releases/24.10.8/targets/x86/64/openwrt-sdk-24.10.8-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst"
- openwrt: "23.05.5"
format: "ipk"
sdk_file: "openwrt-sdk-23.05.5-x86-64_gcc-12.3.0_musl.Linux-x86_64.tar.xz"
sdk_sha256: "9e5b6813a3f810123391f5f3ea10dfd1c14be1a880f410c70ec4424bbd1573d2"
sdk_url: "https://downloads.openwrt.org/releases/23.05.5/targets/x86/64/openwrt-sdk-23.05.5-x86-64_gcc-12.3.0_musl.Linux-x86_64.tar.xz"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install build dependencies
shell: bash
run: |
set -eux
if command -v sudo >/dev/null 2>&1; then
SUDO=sudo
else
SUDO=
fi
$SUDO apt-get update
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
clang \
flex \
bison \
gawk \
gettext \
git \
libncurses-dev \
libssl-dev \
python3 \
python3-pyelftools \
python3-setuptools \
rsync \
swig \
unzip \
wget \
xz-utils \
zlib1g-dev \
zstd
- name: Download and verify SDK
shell: bash
run: |
set -eux
wget -O "${{ matrix.sdk_file }}" "${{ matrix.sdk_url }}"
echo "${{ matrix.sdk_sha256 }} ${{ matrix.sdk_file }}" | sha256sum -c -
- name: Extract SDK
shell: bash
run: |
set -eux
rm -rf _sdk
mkdir _sdk
case "${{ matrix.sdk_file }}" in
*.tar.zst)
tar --zstd -xf "${{ matrix.sdk_file }}" --strip-components=1 -C _sdk
;;
*.tar.xz)
tar -xJf "${{ matrix.sdk_file }}" --strip-components=1 -C _sdk
;;
*)
echo "Unsupported SDK archive"
exit 1
;;
esac
- name: Prepare LuCI feed
shell: bash
working-directory: _sdk
run: |
set -eux
./scripts/feeds update luci
./scripts/feeds install luci-base
- name: Add package source
shell: bash
run: |
set -eux
PKG="_sdk/package/luci-app-led-scheduler"
rm -rf "$PKG"
mkdir -p "$PKG"
cp -a \
Makefile \
LICENSE \
README.md \
htdocs \
root \
"$PKG/"
- name: Configure SDK
shell: bash
working-directory: _sdk
run: |
set -eux
make defconfig
- name: Build
shell: bash
working-directory: _sdk
run: |
set -eux
make -j"$(nproc)" package/luci-app-led-scheduler/compile V=s
- name: Collect package
shell: bash
run: |
set -eux
mkdir -p artifacts
find _sdk/bin -type f \
-name "luci-app-led-scheduler*.${{ matrix.format }}" \
-exec cp -v {} artifacts/ \;
test -n "$(find artifacts -type f -name "luci-app-led-scheduler*.${{ matrix.format }}" -print -quit)"
echo "Built for OpenWrt ${{ matrix.openwrt }}:"
ls -lh artifacts/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: luci-app-led-scheduler-openwrt-${{ matrix.openwrt }}-${{ matrix.format }}
path: artifacts/*
if-no-files-found: error
+17
View File
@@ -0,0 +1,17 @@
MIT License
Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+71
View File
@@ -0,0 +1,71 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-led-scheduler
PKG_VERSION:=0.3.0
PKG_RELEASE:=1
PKG_LICENSE:=MIT
LUCI_TITLE:=LuCI support for LED Scheduler
LUCI_DESCRIPTION:=Schedule LEDs configured by OpenWrt system LED settings.
LUCI_DEPENDS:=+luci-base +rpcd-mod-file
LUCI_PKGARCH:=all
define Package/$(PKG_NAME)/postinst
#!/bin/sh
# Support both old opkg/IPK staging and new apk staging variables.
[ -n "$${IPKG_INSTROOT}$${PKG_INSTROOT}" ] && exit 0
rm -f /tmp/luci-indexcache.*
rm -rf /tmp/luci-modulecache/
chmod 0755 \
/etc/init.d/led-scheduler \
/usr/bin/led-control \
/etc/hotplug.d/ntp/90-led-scheduler \
2>/dev/null || true
# OpenWrt 23.05 uses /etc/config/ucitrack, while 24.10+ uses
# /usr/share/ucitrack/*.json. Install the legacy trigger dynamically only
# when the old ucitrack configuration exists.
if [ -f /etc/config/ucitrack ]; then
uci -q delete ucitrack.led_scheduler >/dev/null 2>&1 || true
uci -q set ucitrack.led_scheduler='led-scheduler'
uci -q set ucitrack.led_scheduler.init='led-scheduler'
uci -q commit ucitrack
fi
/etc/init.d/led-scheduler enable 2>/dev/null || true
/etc/init.d/ucitrack restart 2>/dev/null || true
/etc/init.d/rpcd reload 2>/dev/null || true
/etc/init.d/led-scheduler restart 2>/dev/null || true
exit 0
endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
[ -n "$${IPKG_INSTROOT}$${PKG_INSTROOT}" ] && exit 0
chmod 0755 \
/etc/init.d/led-scheduler \
/usr/bin/led-control \
/etc/hotplug.d/ntp/90-led-scheduler \
2>/dev/null || true
/usr/bin/led-control clear-cron >/dev/null 2>&1 || true
/usr/bin/led-control on >/dev/null 2>&1 || true
/etc/init.d/led-scheduler disable >/dev/null 2>&1 || true
# Remove the legacy OpenWrt 23.05 ucitrack entry on uninstall.
if [ -f /etc/config/ucitrack ]; then
uci -q delete ucitrack.led_scheduler >/dev/null 2>&1 || true
uci -q commit ucitrack
/etc/init.d/ucitrack restart >/dev/null 2>&1 || true
fi
exit 0
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
Loaded 3 of 12 files, more files were not shown because too many files have changed in this diff. Show more