ipk #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ipk | |
on: | |
schedule: | |
- cron: 0 20 * * * | |
repository_dispatch: | |
workflow_dispatch: | |
env: | |
DIY_P1_SH: sh/op.sh | |
jobs: | |
build_firmware: | |
name: 编译固件 | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
repo_info: | |
- {branch: "openwrt-23.05"} | |
steps: | |
- name: 检查分支 | |
uses: actions/checkout@v4 | |
- name: 释放磁盘空间 | |
run: | | |
sudo rm -rf /etc/apt/sources.list.d | |
sudo swapoff -a | |
sudo rm -f /swapfile /mnt/swapfile | |
sudo docker image prune -a -f | |
sudo systemctl stop docker | |
sudo snap set system refresh.retain=2 | |
sudo apt-get -y purge firefox clang* ghc* google* llvm* mono* mongo* mysql* php* | |
sudo apt-get -y autoremove --purge | |
sudo apt-get clean | |
sudo rm -rf /etc/mysql /etc/php /usr/lib/jvm /usr/libexec/docker /usr/local /usr/src/* /var/lib/docker /var/lib/gems /var/lib/mysql /var/lib/snapd /etc/skel /opt/{microsoft,az,hostedtoolcache,cni,mssql-tools,pipx} /usr/share/{az*,dotnet,swift,miniconda,gradle*,java,kotlinc,ri,sbt} /root/{.sbt,.local,.npm} | |
sudo sed -i '/NVM_DIR/d;/skel/d' /root/{.bashrc,.profile} | |
rm -rf ~/{.cargo,.dotnet,.rustup} | |
df -Th | |
- name: 编译环境 | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y img2simg build-essential flex bison cmake g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev rename qemu-utils | |
sudo apt-get clean | |
git config --global user.name 'GitHub Actions' && git config --global user.email 'noreply@github.com' | |
sudo timedatectl set-timezone 'Asia/Shanghai' | |
sudo mkdir -p /workdir | |
sudo chown $USER:$GROUPS /workdir | |
df -Th | |
- name: 设置环境变量 | |
run: | | |
TAG="$(date +'%Y%m%d')-$(openssl rand -hex 3)" | |
echo "tag=$TAG" >> $GITHUB_ENV | |
echo "REPO_URL=https://github.com/openwrt/openwrt" >> $GITHUB_ENV | |
echo "REPO_BRANCH=${{ matrix.repo_info.branch }}" >> $GITHUB_ENV | |
- name: 克隆源代码 | |
working-directory: /workdir | |
run: | | |
df -hT $PWD | |
git clone $REPO_URL openwrt | |
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt | |
- name: 切换23.05 | |
working-directory: ./openwrt | |
id: var | |
run: | | |
case $REPO_BRANCH in | |
openwrt-23.05) | |
_release_tag=$(git tag --sort=taggerdate --list 'v23.*' | tail -1) | |
git checkout $_release_tag | |
_prerelease=false | |
;; | |
*) | |
echo "Can't get local/upstream's branch/tags" | |
;; | |
esac | |
echo "release_tag=$_release_tag" >> $GITHUB_ENV | |
git clone -b 23.05 --depth 1 --single-branch https://github.com/shiyu1314/openwrt-onecloud staging_dir | |
- name: 添加6.11内核 | |
run: | | |
rm -rf openwrt/package/kernel/linux/modules/[a-z]*.mk | |
[ -e patch ] && cp -rf patch/modules/*.mk openwrt/package/kernel/linux/modules | |
[ -e tags ] && cp -rf tags/kernel-6.11 openwrt/include | |
rm -rf openwrt/target/linux/generic | |
git clone https://shiyu1314:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/shiyu1314/target_linux_generic -b 6.11 openwrt/target/linux/generic | |
cd openwrt | |
./scripts/feeds update -a | |
cd .. | |
[ -e patch ] && cp -rf patch/luci/*.patch openwrt/feeds/luci | |
[ -e patch ] && cp -rf patch/nginx/nginx-util/*.patch openwrt/feeds/packages | |
[ -e patch ] && cp -rf patch/openssl/quic/*.patch openwrt/package/libs/openssl/patches | |
[ -e patch ] && cp -rf patch/generic/*.patch openwrt | |
mkdir -p openwrt/package/utils/util-linux/patches | |
[ -e patch ] && cp -rf patch/util-linux/201-util-linux_ntfs3.patch openwrt/package/utils/util-linux/patches | |
[ -e patch ] && cp -rf patch/fstools/Makefile openwrt/package/system/fstools | |
sed -i 's|$(PROJECT_GIT)/project|https://github.com/openwrt|g' openwrt/package/system/fstools/Makefile | |
mkdir -p openwrt/package/system/fstools/patches | |
[ -e patch ] && cp -rf patch/fstools/*.patch openwrt/package/system/fstools/patches | |
[ -e patch ] && cp -rf patch/luci/dhcp/dhcp.js openwrt/feeds/luci/modules/luci-mod-network/htdocs/luci-static/resources/view/network | |
[ -e patch ] && cp -rf patch/luci/dhcp/dnsmasq.init openwrt/package/network/services/dnsmasq/files | |
# odhcpd RFC-9096 | |
mkdir -p openwrt/package/network/services/odhcpd/patches | |
[ -e patch ] && cp -rf patch/odhcpd/*.patch openwrt/package/network/services/odhcpd/patches | |
ls openwrt/target/linux/generic | |
- name: 加载自定义脚本 | |
run: | | |
chmod +x $DIY_P1_SH | |
cd openwrt | |
$GITHUB_WORKSPACE/$DIY_P1_SH | |
cd .. | |
[ -e patch ] && cp -rf patch/nginx/luci.locations openwrt/feeds/packages/net/nginx/files-luci-support | |
[ -e patch ] && cp -rf patch/nginx/uci.conf.template openwrt/feeds/packages/net/nginx-util/files | |
[ -e patch ] && cp -rf patch/kernel-6.11/bbr3/*.patch openwrt/target/linux/generic/backport-6.11 | |
[ -e patch ] && cp -rf patch/kernel-6.11/btf/*.patch openwrt/target/linux/generic/hack-6.11 | |
- name: 添加玩客云 | |
run: | | |
git clone https://shiyu1314:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/shiyu1314/s805 -b 6.11 openwrt/target/linux/amlogic | |
- name: 加载自定义配置 | |
run: | | |
[ -e files ] && mv files openwrt/files | |
cat <<EOF >>openwrt/.config | |
CONFIG_TARGET_amlogic=y | |
CONFIG_TARGET_amlogic_meson8b=y | |
CONFIG_TARGET_amlogic_meson8b_DEVICE_thunder-onecloud=y | |
CONFIG_TARGET_KERNEL_PARTSIZE=32 | |
CONFIG_TARGET_ROOTFS_PARTSIZE=700 | |
CONFIG_KERNEL_EXT4_FS_SECURITY=m | |
# CONFIG_TARGET_ROOTFS_SQUASHFS is not set | |
CONFIG_PACKAGE_dnsmasq-full=m | |
CONFIG_PACKAGE_dnsmasq_full_ipset=m | |
# CONFIG_PACKAGE_dnsmasq_full_broken_rtc is not set | |
# CONFIG_PACKAGE_dnsmasq is not set | |
CONFIG_PACKAGE_luci-app-firewall=m | |
CONFIG_PACKAGE_bash=m | |
CONFIG_PACKAGE_bash-completion=m | |
CONFIG_PACKAGE_fuse-utils=m | |
CONFIG_PACKAGE_ethtool=m | |
CONFIG_PACKAGE_automount=m | |
CONFIG_PACKAGE_autocore-arm=m | |
CONFIG_PACKAGE_autosamba=m | |
CONFIG_PACKAGE_my-default-settings=m | |
### Luci | |
CONFIG_PACKAGE_ariang-nginx=m | |
### Kernel Modules | |
CONFIG_PACKAGE_kmod-nft-socket=m | |
CONFIG_PACKAGE_kmod-usb-net-rndis=m | |
CONFIG_PACKAGE_kmod-usb-net=m | |
CONFIG_PACKAGE_kmod-usb-net-cdc-ether=m | |
CONFIG_PACKAGE_kmod-tcp-brutal=m | |
CONFIG_PACKAGE_kmod-tcp-bbr3=m | |
CONFIG_PACKAGE_kmod-usb2=m | |
### Zram | |
CONFIG_PACKAGE_zram-swap=m | |
CONFIG_PACKAGE_kmod-lib-lz4=m | |
CONFIG_PACKAGE_kmod-lib-lzo=m | |
CONFIG_PACKAGE_kmod-lib-zstd=m | |
### Utilities | |
CONFIG_PACKAGE_fdisk=m | |
CONFIG_PACKAGE_htop=m | |
CONFIG_PACKAGE_iperf3=m | |
CONFIG_PACKAGE_iputils-ping=m | |
CONFIG_PACKAGE_less=m | |
CONFIG_PACKAGE_lsblk=m | |
CONFIG_PACKAGE_lscpu=m | |
CONFIG_PACKAGE_lsof=m | |
CONFIG_PACKAGE_openssh-sftp-server=m | |
CONFIG_PACKAGE_pciutils=m | |
CONFIG_PACKAGE_rename=m | |
CONFIG_PACKAGE_rsync=m | |
CONFIG_PACKAGE_sed=m | |
CONFIG_PACKAGE_unzip=m | |
CONFIG_PACKAGE_usbutils=m | |
CONFIG_PACKAGE_vim=m | |
CONFIG_PACKAGE_wget-ssl=m | |
CONFIG_PACKAGE_wpad-openssl=m | |
### OpenSSL | |
CONFIG_OPENSSL_ENGINE=m | |
CONFIG_OPENSSL_OPTIMIZE_SPEED=m | |
CONFIG_OPENSSL_WITH_ASM=m | |
CONFIG_PACKAGE_libopenssl-afalg=m | |
CONFIG_PACKAGE_libopenssl-conf=m | |
CONFIG_PACKAGE_libopenssl-devcrypto=m | |
CONFIG_PACKAGE_libopenssl-legacy=m | |
CONFIG_PACKAGE_openssl-util=m | |
# CONFIG_PACKAGE_libopenssl-padlock is not set | |
# CONFIG_OPENSSL_WITH_ERROR_MESSAGES is not set | |
### nginx | |
CONFIG_PACKAGE_luci-nginx=m | |
CONFIG_PACKAGE_nginx-all-module=m | |
CONFIG_PACKAGE_nginx-ssl=m | |
CONFIG_PACKAGE_nginx-mod-brotli=m | |
CONFIG_PACKAGE_nginx-mod-luci=m | |
CONFIG_PACKAGE_nginx-mod-rtmp=m | |
CONFIG_PACKAGE_nginx-mod-stream=m | |
CONFIG_PACKAGE_nginx-mod-ubus=m | |
CONFIG_PACKAGE_nginx-mod-zstd=m | |
CONFIG_PACKAGE_nginx-ssl-util=m | |
CONFIG_NGINX_DAV=m | |
CONFIG_NGINX_HTTP_AUTH_BASIC=m | |
CONFIG_NGINX_HTTP_QUIC=m | |
CONFIG_NGINX_HTTP_REAL_IP=m | |
CONFIG_NGINX_HTTP_SUB=m | |
CONFIG_NGINX_STREAM_REAL_IP=m | |
### Curl | |
CONFIG_PACKAGE_curl=m | |
CONFIG_PACKAGE_libcurl=m | |
CONFIG_LIBCURL_NGHTTP3=m | |
CONFIG_LIBCURL_NGTCP2=m | |
CONFIG_LIBCURL_OPENSSL=m | |
# CONFIG_LIBCURL_GNUTLS is not set | |
# CONFIG_LIBCURL_MBEDTLS is not set | |
# CONFIG_LIBCURL_NOSSL is not set | |
# CONFIG_LIBCURL_WOLFSSL is not set | |
### Busybox | |
CONFIG_BUSYBOX_CUSTOM=m | |
CONFIG_BUSYBOX_CONFIG_ASH_HELP=m | |
CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_HISTORY=1024 | |
CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVEHISTORY=m | |
CONFIG_BUSYBOX_CONFIG_FEATURE_PREFER_IPV4_ADDRESS=m | |
CONFIG_BUSYBOX_CONFIG_FEATURE_SH_HISTFILESIZE=m | |
CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG_INFO=m | |
### Firewall | |
CONFIG_PACKAGE_nat6=m | |
CONFIG_PACKAGE_ip6tables-nft=m | |
CONFIG_PACKAGE_ip6tables-mod-nat=m | |
CONFIG_PACKAGE_iptables-mod-conntrack-extra=m | |
CONFIG_PACKAGE_iptables-mod-iprange=m | |
CONFIG_PACKAGE_iptables-mod-nat-extra=m | |
CONFIG_PACKAGE_iptables-mod-socket=m | |
CONFIG_PACKAGE_iptables-mod-tproxy=m | |
CONFIG_PACKAGE_iptables-nft=m | |
CONFIG_PACKAGE_libip4tc=m | |
CONFIG_PACKAGE_libip6tc=m | |
CONFIG_PACKAGE_xtables-nft=m | |
# CONFIG_PACKAGE_iptables-legacy is not set | |
### app | |
CONFIG_PACKAGE_luci-app-dockerman=m | |
CONFIG_PACKAGE_luci-theme-argon=m | |
CONFIG_PACKAGE_luci-app-argon-config=m | |
CONFIG_PACKAGE_luci-app-ttyd=m | |
CONFIG_PACKAGE_luci-app-diskman=m | |
CONFIG_PACKAGE_luci-app-hd-idle=m | |
CONFIG_PACKAGE_luci-app-mihomo=m | |
CONFIG_PACKAGE_luci-app-samba4=m | |
CONFIG_PACKAGE_luci-app-emby=m | |
CONFIG_PACKAGE_luci-app-aria2=m | |
CONFIG_PACKAGE_luci-app-alist=m | |
CONFIG_PACKAGE_luci-app-adguardhome=m | |
CONFIG_PACKAGE_luci-app-usb-printer=m | |
CONFIG_PACKAGE_luci-app-mosdns=m | |
CONFIG_PACKAGE_luci-app-openclash=m | |
CONFIG_PACKAGE_luci-app-passwall=m | |
CONFIG_PACKAGE_luci-app-passwall_INCLUDE_SingBox=m | |
CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Geodata=m | |
CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Xray=m | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Xray_Plugin is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Hysteria is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_NaiveProxy is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Client is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Client is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Server is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Server is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_tuic_client is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Trojan_GO is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Trojan_Plus is not set | |
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Plugin is not set | |
CONFIG_PACKAGE_luci-app-filebrowser-go=m | |
CONFIG_PACKAGE_luci-app-frpc=m | |
CONFIG_PACKAGE_luci-app-frps=m | |
CONFIG_PACKAGE_luci-app-gost=m | |
CONFIG_PACKAGE_luci-app-gowebdav=m | |
CONFIG_PACKAGE_luci-app-ksmbd=m | |
CONFIG_PACKAGE_luci-app-nlbwmon=m | |
CONFIG_PACKAGE_luci-app-qbittorrent=m | |
CONFIG_PACKAGE_luci-app-vlmcsd=m | |
CONFIG_PACKAGE_luci-app-zerotier=m | |
CONFIG_PACKAGE_luci-app-netdata=m | |
CONFIG_PACKAGE_luci-app-homeproxy=m | |
CONFIG_PACKAGE_luci-app-upnp=m | |
CONFIG_PACKAGE_luci-app-wolplus=m | |
CONFIG_PACKAGE_luci-app-smartdns=m | |
CONFIG_PACKAGE_luci-app-cifs-mount=m | |
CONFIG_PACKAGE_luci-app-autoreboot=m | |
EOF | |
- name: 下载编译依赖 | |
id: package | |
run: | | |
cd openwrt | |
make defconfig | |
make download -j8 | |
find dl -size -1024c -exec ls -l {} \; | |
find dl -size -1024c -exec rm -f {} \; | |
- name: 编译源码 | |
id: compile | |
run: | | |
cd openwrt | |
echo -e "$(nproc) thread compile" | |
make -j$(nproc) || make -j1 || make -j1 V=s | |
echo "status=success" >> $GITHUB_OUTPUT | |
grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME | |
[ -s DEVICE_NAME ] && echo "DEVICE_NAME=_$(cat DEVICE_NAME)" >> $GITHUB_ENV | |
echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV | |
- name: 查看磁盘使用情况 | |
if: (!cancelled()) | |
run: df -hT | |
- name: 整理文件 | |
id: organize | |
run: | | |
[ -e patch ] && cp -rf patch/index.html openwrt/bin/packages | |
mkdir -p openwrt/bin/packages/arm_cortex-a5_neon-vfpv4/kmod | |
cp -rf openwrt/bin/targets/*/*/*/* openwrt/bin/packages/arm_cortex-a5_neon-vfpv4/kmod | |
rm -rf openwrt/bin/targets/*/*/*.img | |
rm -rf openwrt/bin/targets/*/*/*.gz | |
rm -rf openwrt/bin/packages/*/routing | |
rm -rf openwrt/bin/packages/*/telephony | |
cd openwrt/bin/targets/*/* | |
rm -rf packages | |
rm -rf *.buildinfo | |
rm -rf profiles.json | |
rm -rf *.manifest | |
rm -rf *.sha | |
rm -rf sha256sums | |
echo "FIRMWARE=$PWD" >> $GITHUB_ENV | |
- name: 上传ipk | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: | | |
cd openwrt/bin/packages | |
git init | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "${{ env.tag }}" | |
git branch -M main | |
git remote add origin https://github-action:$GITHUB_TOKEN@github.com/shiyu1314/openwrt-onecloud-ipk.git | |
git push -u origin main --force |