Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
xydche committed Apr 24, 2024
1 parent 80cefec commit 6cbb286
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 110 deletions.
22 changes: 20 additions & 2 deletions .config
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ CONFIG_KERNEL_TRANSPARENT_HUGEPAGE=y
CONFIG_KERNEL_TRANSPARENT_HUGEPAGE_ALWAYS=y
CONFIG_PACKAGE_6in4=y
CONFIG_PACKAGE_adbyby=y
CONFIG_PACKAGE_alist=y
CONFIG_PACKAGE_aliyundrive-webdav=y
CONFIG_PACKAGE_attr=y
# CONFIG_PACKAGE_automount is not set
CONFIG_PACKAGE_autosamba=y
CONFIG_PACKAGE_avahi-dbus-daemon=y
CONFIG_PACKAGE_blkid=y
# CONFIG_PACKAGE_block-mount is not set
CONFIG_PACKAGE_btrfs-progs=y
CONFIG_PACKAGE_cgroupfs-mount=y
CONFIG_PACKAGE_chinadns-ng=y
Expand Down Expand Up @@ -133,6 +136,7 @@ CONFIG_PACKAGE_libuv=y
CONFIG_PACKAGE_libwebsockets-full=y
CONFIG_PACKAGE_lsblk=y
CONFIG_PACKAGE_luci-app-adbyby-plus=y
CONFIG_PACKAGE_luci-app-alist=y
CONFIG_PACKAGE_luci-app-aliyundrive-webdav=y
CONFIG_PACKAGE_luci-app-cifs-mount=y
CONFIG_PACKAGE_luci-app-diskman=y
Expand All @@ -141,6 +145,7 @@ CONFIG_PACKAGE_luci-app-diskman_INCLUDE_lsblk=y
CONFIG_PACKAGE_luci-app-dockerman=y
CONFIG_PACKAGE_luci-app-frpc=y
CONFIG_PACKAGE_luci-app-hd-idle=y
CONFIG_PACKAGE_luci-app-onliner=y
CONFIG_PACKAGE_luci-app-passwall=y
CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy=y
CONFIG_PACKAGE_luci-app-passwall_INCLUDE_SingBox=y
Expand All @@ -154,6 +159,7 @@ CONFIG_PACKAGE_luci-app-watchcat=y
# CONFIG_PACKAGE_luci-app-wol is not set
CONFIG_PACKAGE_luci-app-zerotier=y
CONFIG_PACKAGE_luci-i18n-adbyby-plus-zh-cn=y
CONFIG_PACKAGE_luci-i18n-alist-zh-cn=y
CONFIG_PACKAGE_luci-i18n-aliyundrive-webdav-zh-cn=y
CONFIG_PACKAGE_luci-i18n-cifs-mount-zh-cn=y
CONFIG_PACKAGE_luci-i18n-diskman-zh-cn=y
Expand All @@ -167,8 +173,8 @@ CONFIG_PACKAGE_luci-i18n-watchcat-zh-cn=y
CONFIG_PACKAGE_luci-i18n-zerotier-zh-cn=y
CONFIG_PACKAGE_luci-lib-docker=y
CONFIG_PACKAGE_luci-proto-ipv6=y
CONFIG_PACKAGE_luci-theme-argon=y
CONFIG_PACKAGE_luci-theme-design=y
CONFIG_PACKAGE_luci-theme-argon-mod=y
CONFIG_PACKAGE_luci-theme-material=y
CONFIG_PACKAGE_microsocks=y
CONFIG_PACKAGE_mount-utils=y
CONFIG_PACKAGE_odhcp6c=y
Expand Down Expand Up @@ -208,6 +214,18 @@ CONFIG_TARGET_KERNEL_PARTSIZE=32
CONFIG_TARGET_ROOTFS_PARTSIZE=600
# CONFIG_TARGET_ROOTFS_SQUASHFS is not set
# CONFIG_PACKAGE_boost is not set
CONFIG_PACKAGE_kmod-fs-exfat=y
CONFIG_PACKAGE_kmod-fs-ext4=y
CONFIG_PACKAGE_kmod-fs-ntfs3=y
CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-lib-crc16=y
CONFIG_PACKAGE_kmod-nls-cp437=y
CONFIG_PACKAGE_kmod-nls-iso8859-1=y
CONFIG_PACKAGE_kmod-scsi-core=y
CONFIG_PACKAGE_kmod-usb-core=y
CONFIG_PACKAGE_kmod-usb-storage=y
CONFIG_PACKAGE_kmod-usb-storage-extras=y
CONFIG_PACKAGE_kmod-usb-storage-uas=y
# CONFIG_PACKAGE_libcares is not set
# CONFIG_PACKAGE_libev is not set
# CONFIG_PACKAGE_libmbedtls is not set
Expand Down
120 changes: 42 additions & 78 deletions .github/workflows/build-openwrt.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
#
# Copyright (c) 2019-2020 P3TERX <https://p3terx.com>
# https://github.com/P3TERX/Actions-OpenWrt
#
# File: .github/workflows/openwrt-bulder.yml
# Description: Build OpenWrt using GitHub Actions
#
# Copyright (c) 2019-2024 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Build OpenWrt using GitHub Actions
#

name: Build OpenWrt
name: OpenWrt Builder

on:
repository_dispatch:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'

env:
REPO_URL: https://github.com/coolsnowwolf/lede
Expand All @@ -26,42 +23,41 @@ env:
CONFIG_FILE: .config
DIY_P1_SH: diy-part1.sh
DIY_P2_SH: diy-part2.sh
UPLOAD_BIN_DIR: false
GEN_BURN_IMG_SH: gen_burn_img.sh
UPLOAD_FIRMWARE: true
UPLOAD_COWTRANSFER: false
UPLOAD_WETRANSFER: false
UPLOAD_RELEASE: true
TZ: Asia/Shanghai

jobs:
build:
runs-on: ubuntu-22.04
if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }}

steps:
- name: 释放磁盘空间
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@main

- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi `docker images -q`
[[ -n "${AGENT_TOOLSDIRECTORY}" ]] && sudo rm -rf "${AGENT_TOOLSDIRECTORY}"
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /etc/mysql /etc/php /opt/hostedtoolcache/CodeQL
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo -E apt-mark hold grub-efi-amd64-signed
sudo sed -i 's/azure\.//' /etc/apt/sources.list
sudo -E apt-get -qq update
sudo -E apt-get -y purge azure-cli* docker* ghc* zulu* hhvm* llvm* firefox* google* dotnet* aspnetcore* powershell* openjdk* adoptopenjdk* mysql* php* mongodb* moby* snap* || true
sudo -E apt-get -y full-upgrade
sudo -E apt-get -qq install $(cat dependson)
sudo -E systemctl daemon-reload
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
echo "================================================="
echo "文件系统 类型 容量 已用 可用 使用% 挂载点"
df -hT $PWD
sudo timedatectl set-timezone "$TZ"
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
Expand All @@ -83,12 +79,6 @@ jobs:
- name: Update feeds
run: cd openwrt && ./scripts/feeds update -a

- name: DIY
run: |
chmod +x diy.sh
cd openwrt
$GITHUB_WORKSPACE/diy.sh
- name: Install feeds
run: cd openwrt && ./scripts/feeds install -a

Expand All @@ -100,19 +90,12 @@ jobs:
cd openwrt
$GITHUB_WORKSPACE/$DIY_P2_SH
- name: SSH connection to Actions
uses: P3TERX/[email protected]
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh')
env:
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}

- name: Download package
id: package
run: |
cd openwrt
make defconfig
make download -j16
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
Expand All @@ -122,30 +105,30 @@ jobs:
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
echo "status=success" >> ${GITHUB_OUTPUT}
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: steps.compile.outputs.status == 'success'
run: |
chmod +x $GEN_BURN_IMG_SH
chmod +x AmlImg
$GITHUB_WORKSPACE/$GEN_BURN_IMG_SH
- name: Check space usage
if: (!cancelled())
run: df -hT

- name: Upload bin directory
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
with:
name: OpenWrt_bin${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
path: openwrt/bin


- name: Organize files
id: organize
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
run: |
cd openwrt/bin/targets/*/*
rm -rf packages
rm -rf packages feeds.buildinfo version.buildinfo sha256sums profiles.json
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "status=success" >> ${GITHUB_OUTPUT}
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload firmware directory
uses: actions/upload-artifact@main
Expand All @@ -154,37 +137,18 @@ jobs:
name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
path: ${{ env.FIRMWARE }}

- name: Upload firmware to cowtransfer
id: cowtransfer
if: steps.organize.outputs.status == 'success' && env.UPLOAD_COWTRANSFER == 'true' && !cancelled()
run: |
curl -fsSL git.io/file-transfer | sh
./transfer cow --block 2621440 -s -p 64 --no-progress ${FIRMWARE} 2>&1 | tee cowtransfer.log
echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)"
echo "url=$(cat cowtransfer.log | grep https | cut -f3 -d" ")" >> ${GITHUB_OUTPUT}
- name: Upload firmware to WeTransfer
id: wetransfer
if: steps.organize.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled()
run: |
curl -fsSL git.io/file-transfer | sh
./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)"
echo "url=$(cat wetransfer.log | grep https | cut -f3 -d" ")" >> ${GITHUB_OUTPUT}
- name: Generate release tag
id: tag
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
run: |
echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> ${GITHUB_OUTPUT}
echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_OUTPUT
touch release.txt
[ $UPLOAD_COWTRANSFER = true ] && echo "🔗 [Cowtransfer](${{ steps.cowtransfer.outputs.url }})" >> release.txt
[ $UPLOAD_WETRANSFER = true ] && echo "🔗 [WeTransfer](${{ steps.wetransfer.outputs.url }})" >> release.txt
echo "status=success" >> ${GITHUB_OUTPUT}
[ ${UPLOAD_GOFILE} = true && ${{ steps.gofile.outputs.url }} ] && echo "🔗 [GoFile](${{ steps.gofile.outputs.url }})" >> release.txt
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload firmware to release
uses: softprops/action-gh-release@v1
if: steps.tag.outputs.status == 'success' && !cancelled() && steps.compile.outputs.status == 'success'
uses: softprops/action-gh-release@master
if: steps.tag.outputs.status == 'success' && !cancelled()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -193,13 +157,13 @@ jobs:
files: ${{ env.FIRMWARE }}/*

- name: Delete workflow runs
uses: GitRML/delete-workflow-runs@main
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 3
retain_days: 0
keep_minimum_runs: 2

- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@v0.1.0
uses: dev-drprasad/delete-older-releases@master
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 3
Expand Down
9 changes: 3 additions & 6 deletions diy-part1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
#sed -i 's/^#\(.*helloworld\)/\1/' feeds.conf.default

# Add a feed source
#echo 'src-git helloworld https://github.com/fw876/helloworld' >>feeds.conf.default
echo "src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall-packages.git;main" >> "feeds.conf.default"
echo "src-git passwall https://github.com/xiaorouji/openwrt-passwall.git;main" >> "feeds.conf.default"
echo "src-git passwall2 https://github.com/xiaorouji/openwrt-passwall2.git;main" >> "feeds.conf.default"
git clone https://github.com/xydche/luci-theme-design.git package/luci-theme-design
git clone https://github.com/kenzok78/luci-app-adguardhome.git package/luci-app-adguardhome
# git clone https://github.com/sbwml/luci-app-mosdns.git -b v5 package/mosdns
# git clone https://github.com/sbwml/v2ray-geodata package/v2ray-geodata

git clone https://github.com/sbwml/luci-app-alist package/alist
git clone https://github.com/rufengsuixing/luci-app-onliner package/onliner
23 changes: 10 additions & 13 deletions diy-part2.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
#!/bin/bash
#
# Copyright (c) 2019-2020 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/P3TERX/Actions-OpenWrt
# File name: diy-part2.sh
# Description: OpenWrt DIY script part 2 (After Update feeds)
#
# Copyright (c) 2019-2024 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#

# Modify default IP
#sed -i 's/192.168.1.1/192.168.50.5/g' package/base-files/files/bin/config_generate
sed -i 's/192.168.1.1/192.168.2.2/g' package/base-files/files/bin/config_generate

sed -i '/KERNEL_PATCHVER/c KERNEL_PATCHVER:=5.15' target/linux/x86/Makefile
# Modify default theme
#sed -i 's/luci-theme-bootstrap/luci-theme-argon/g' feeds/luci/collections/luci/Makefile

wget -O tmp/adg.tar.gz https://github.com/AdguardTeam/AdGuardHome/releases/latest/download/AdGuardHome_linux_amd64.tar.gz
tar -zxvf tmp/adg.tar.gz -C tmp/
mkdir -p files/usr/bin
mv tmp/AdGuardHome/AdGuardHome files/usr/bin/
chmod +x files/usr/bin/AdGuardHome
ls files/usr/bin/
# Modify hostname
sed -i 's/OpenWrt/OneCloud/g' package/base-files/files/bin/config_generate
9 changes: 0 additions & 9 deletions diy.sh

This file was deleted.

5 changes: 3 additions & 2 deletions get_burn_img.sh → gen_burn_img.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

./AmlImg unpack ./uboot.img burn/
gunzip openwrt/bin/targets/*/*/*.gz
gzip -dk openwrt/bin/targets/*/*/*.gz

# 定义变量以增加代码的可读性和可维护性
diskimg_path="openwrt/bin/targets/*/*/*.img"
Expand Down Expand Up @@ -73,4 +73,5 @@ printf "PARTITION:boot:sparse:boot.simg\nPARTITION:rootfs:sparse:rootfs.simg\n"
sha256sum "${burnimg_name}" > "${burnimg_name}.sha"
xz -9 --threads=0 --compress "${burnimg_name}"
rm -rf burn
echo "Script execution completed."
rm ${diskimg_path}
echo "Script execution completed."

0 comments on commit 6cbb286

Please sign in to comment.