Merge code from BETA repo
This commit is contained in:
parent
44de4530d9
commit
c2e17543cd
|
@ -28,9 +28,11 @@ env:
|
|||
CONFIG_FILE: .config
|
||||
FEEDS_CONF_DEFAULT: ./Customize/feeds.conf.default
|
||||
MAC80211: ./Customize/mac80211.sh
|
||||
AUTOUPDATE: ./Customize/AutoUpdate.sh
|
||||
MWAN3: ./Customize/mwan3
|
||||
CUSTOM_SCRIPT: ./Scripts/diy-script.sh
|
||||
TZ: Asia/Shanghai
|
||||
UPLOAD_RELEASE: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -40,14 +42,14 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@main
|
||||
|
||||
- name: Initialization environment
|
||||
- name: Initialization Environment
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
sudo -E apt-get update
|
||||
sudo -E apt-get install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget curl swig rsync
|
||||
|
||||
- name: Clone OpenWRT source code
|
||||
- name: Clone Openwrt source code
|
||||
run: |
|
||||
git clone -b $REPO_BRANCH $REPO_URL openwrt
|
||||
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
|
||||
|
@ -69,18 +71,20 @@ jobs:
|
|||
run: |
|
||||
[ -e $MAC80211 ] && mv $MAC80211 openwrt/package/kernel/mac80211/files/lib/wifi/mac80211.sh
|
||||
[ -e $MWAN3 ] && mv $MWAN3 openwrt/package/feeds/packages/mwan3/files/etc/config/mwan3
|
||||
[ -e $AUTOUPDATE ] && mv $AUTOUPDATE openwrt/package/base-files/files/bin/AutoUpdate.sh
|
||||
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
|
||||
cd openwrt
|
||||
source $GITHUB_WORKSPACE/$CUSTOM_SCRIPT && Diy_Core && Diy-Part2
|
||||
|
||||
- name: Download package
|
||||
- name: Download Package
|
||||
run: |
|
||||
cd openwrt
|
||||
make defconfig
|
||||
make download -j$(nproc)
|
||||
find dl -size -1024c -exec ls -l {} \;
|
||||
find dl -size -1024c -exec rm -f {} \;
|
||||
|
||||
- name: Compile the firmware
|
||||
- name: Compile the Firmware
|
||||
run: |
|
||||
cd openwrt
|
||||
make -j$(nproc) V=s
|
||||
|
@ -90,8 +94,26 @@ jobs:
|
|||
cd openwrt
|
||||
source $GITHUB_WORKSPACE/$CUSTOM_SCRIPT && Diy_Core && Diy-Part3
|
||||
|
||||
- name: Upload Firmware to Artifact
|
||||
- name: Upload Firmware to Artifacts
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
name: OpenWrt
|
||||
path: openwrt/bin/Firmware
|
||||
|
||||
- name: Generate Tag
|
||||
id: tag
|
||||
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
|
||||
run: |
|
||||
echo " - $(date +"%Y%m%d")-AutoUpdate" > update_log.txt
|
||||
echo "::set-env name=FIRMWARE::openwrt/bin/Firmware"
|
||||
echo "::set-output name=status::success"
|
||||
|
||||
- name: Upload Firmware to Github Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: steps.tag.outputs.status == 'success' && !cancelled()
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
with:
|
||||
tag_name: AutoUpdate
|
||||
body_path: update_log.txt
|
||||
files: ${{ env.FIRMWARE }}/*
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
#!/bin/bash
|
||||
# https://github.com/Hyy2001X/AutoBuild-Actions
|
||||
# AutoBuild Module by Hyy2001
|
||||
# AutoUpdate
|
||||
|
||||
Author=Hyy2001
|
||||
Version=V2.7-BETA
|
||||
Updated=2020.09.19
|
||||
|
||||
Github=https://github.com/Hyy2001X/AutoBuild-Actions
|
||||
Github_Tags=$Github/releases/tag/AutoUpdate
|
||||
Github_Download=$Github/releases/download/AutoUpdate
|
||||
TARGET_PROFILE=d-team_newifi-d2
|
||||
|
||||
clear
|
||||
echo -e "Auto-Update Script $Version by $Author\n"
|
||||
cd /etc
|
||||
CURRENT_VERSION=`cat ./openwrt_date` > /dev/null 2>&1
|
||||
if [ "$CURRENT_VERSION" == "" ]; then
|
||||
echo -e "警告:当前固件版本获取失败!\n"
|
||||
CURRENT_VERSION=未知
|
||||
fi
|
||||
CURRENT_DEVICE=`cat ./openwrt_device` > /dev/null 2>&1
|
||||
if [ "$CURRENT_DEVICE" == "" ]; then
|
||||
echo -e "警告:当前设备名称获取失败,使用预设设备名称[$TARGET_PROFILE]!\n"
|
||||
CURRENT_DEVICE=$TARGET_PROFILE
|
||||
fi
|
||||
cd /tmp
|
||||
echo "正在获取云端固件版本..."
|
||||
Check_Version=`wget --no-check-certificate -q $Github_Tags -O - | egrep -o 'R[0-9]+.[0-9]+.[0-9]+.[0-9]+.bin' | awk 'NR==1'`
|
||||
if [ "$Check_Version" == "" ]; then
|
||||
echo -e "\n...未获取到任何信息,请稍后重试!"
|
||||
exit
|
||||
fi
|
||||
GET_Version=`wget --no-check-certificate -q $Github_Tags -O - | egrep -o 'R[0-9]+.[0-9]+.[0-9]+.[0-9]+' | awk 'NR==1'`
|
||||
if [ "$GET_Version" == "" ]; then
|
||||
echo -e "\n...云端固件版本获取失败!"
|
||||
exit
|
||||
fi
|
||||
echo -e "\n当前固件版本:$CURRENT_VERSION"
|
||||
echo -e "云端固件版本:$GET_Version\n"
|
||||
if [ $CURRENT_VERSION == $GET_Version ];then
|
||||
read -p "已是最新版本,是否强制更新固件?[Y/N]:" Choose
|
||||
case $Choose in
|
||||
Y)
|
||||
echo -e "\n开始强制更新固件...\n"
|
||||
;;
|
||||
y)
|
||||
echo -e "\n开始强制更新固件...\n"
|
||||
;;
|
||||
*)
|
||||
echo -e "\n用户已取消强制更新,即将退出更新程序..."
|
||||
sleep 2
|
||||
exit
|
||||
esac
|
||||
fi
|
||||
Firmware_Info=AutoBuild-$CURRENT_DEVICE-Lede-$GET_Version
|
||||
Firmware=${Firmware_Info}.bin
|
||||
Firmware_Detail=${Firmware_Info}.detail
|
||||
echo "云端固件名称:$Firmware"
|
||||
NETWORK=`curl -I -s --connect-timeout 5 www.google.com -w %{http_code} | tail -n1`
|
||||
if [ ! "$NETWORK" == 200 ];then
|
||||
echo -e "\nGoogle 连接失败,可能导致固件下载速度缓慢!"
|
||||
fi
|
||||
echo -e "\n正在下载固件,请耐心等待..."
|
||||
wget --no-check-certificate -q $Github_Download/$Firmware -O $Firmware
|
||||
if [ ! "$?" == 0 ]; then
|
||||
echo "...下载失败,请检查网络后重试!"
|
||||
exit
|
||||
fi
|
||||
echo "...下载成功!"
|
||||
echo "固件大小:$(du -h $Firmware | awk '{print $1}')"
|
||||
echo -e "\n正在下载固件详细信息..."
|
||||
wget --no-check-certificate -q $Github_Download/$Firmware_Detail -O $Firmware_Detail
|
||||
if [ ! "$?" == 0 ]; then
|
||||
echo "...下载失败,请检查网络后重试!"
|
||||
exit
|
||||
fi
|
||||
echo "...下载成功!"
|
||||
GET_MD5=`awk -F'[ :]' '/MD5/ {print $2;exit}' $Firmware_Detail`
|
||||
CURRENT_MD5=`md5sum $Firmware | cut -d ' ' -f1`
|
||||
echo -e "\n当前文件MD5:$CURRENT_MD5"
|
||||
echo -e "云端文件MD5:$GET_MD5\n"
|
||||
if [ "$GET_MD5" == "" ] || [ "$CURRENT_MD5" == "" ];then
|
||||
echo "MD5获取失败!"
|
||||
exit
|
||||
fi
|
||||
if [ ! "$GET_MD5" == "$CURRENT_MD5" ];then
|
||||
echo "MD5对比不通过,请检查网络后重试!"
|
||||
exit
|
||||
fi
|
||||
echo "MD5对比通过,准备升级固件..."
|
||||
sleep 3
|
||||
echo -e "\n开始升级固件,请耐心等待...\n"
|
||||
sysupgrade $Firmware
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
config globals 'globals'
|
||||
option mmx_mask '0x3F00'
|
||||
option rtmon_interval '5'
|
||||
|
||||
config member 'wan_m1_w3'
|
||||
option interface 'wan'
|
||||
option metric '1'
|
||||
option weight '3'
|
||||
|
||||
config policy 'balanced'
|
||||
option last_resort 'unreachable'
|
||||
list use_member 'wan_m1_w3'
|
||||
|
||||
config rule 'https'
|
||||
option sticky '1'
|
||||
option dest_port '443'
|
||||
option proto 'tcp'
|
||||
option use_policy 'balanced'
|
||||
|
||||
config rule 'default_rule'
|
||||
option dest_ip '0.0.0.0/0'
|
||||
option use_policy 'balanced'
|
|
@ -5,19 +5,20 @@
|
|||
|
||||
Diy_Core() {
|
||||
Author=Hyy2001
|
||||
Github=https://github.com/Hyy2001X
|
||||
AutoUpdate_Github=https://github.com/Hyy2001X/Openwrt-AutoUpdate
|
||||
Default_File=./package/lean/default-settings/files/zzz-default-settings
|
||||
TARGET_BOARD=ramips
|
||||
TARGET_SUBTARGET=mt7621
|
||||
TARGET_PROFILE=d-team_newifi-d2
|
||||
TARGET_ROOTFS=squashfs-sysupgrade.bin
|
||||
|
||||
Version=`egrep -o "R[0-9]+\.[0-9]+\.[0-9]+" $Default_File`
|
||||
Default_File=./package/lean/default-settings/files/zzz-default-settings
|
||||
FIRMWARE_SUFFIX=squashfs-sysupgrade.bin
|
||||
Lede_Version=`egrep -o "R[0-9]+\.[0-9]+\.[0-9]+" $Default_File`
|
||||
Compile_Date=`date +'%Y/%m/%d'`
|
||||
Compile_Time=`date +'%Y-%m-%d %H:%M:%S'`
|
||||
}
|
||||
|
||||
GET_TARGET_INFO() {
|
||||
TARGET_BOARD=`awk -F'[="]+' '/TARGET_BOARD/{print $2}' .config`
|
||||
TARGET_SUBTARGET=`awk -F'[="]+' '/TARGET_SUBTARGET/{print $2}' .config`
|
||||
TARGET_PROFILE=`grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/'`
|
||||
}
|
||||
|
||||
ExtraPackages() {
|
||||
[ -d ./package/lean/$2 ] && rm -rf ./package/lean/$2
|
||||
[ -d ./$2 ] && rm -rf ./$2
|
||||
|
@ -33,8 +34,6 @@ do
|
|||
echo "[$(date "+%H:%M:%S")] Package $2 detected!"
|
||||
if [ $2 == OpenClash ];then
|
||||
mv $2/luci-app-openclash ./package/lean
|
||||
elif [ $2 == Openwrt-AutoUpdate ];then
|
||||
mv $2/AutoUpdate.sh ./package/base-files/files/bin
|
||||
else
|
||||
mv $2 ./package/lean
|
||||
fi
|
||||
|
@ -56,22 +55,23 @@ ExtraPackages svn luci-app-adguardhome https://github.com/Lienol/openwrt/trunk/p
|
|||
ExtraPackages svn luci-app-smartdns https://github.com/project-openwrt/openwrt/trunk/package/ntlf9t
|
||||
ExtraPackages svn smartdns https://github.com/project-openwrt/openwrt/trunk/package/ntlf9t
|
||||
ExtraPackages git OpenClash https://github.com/vernesong master
|
||||
ExtraPackages git Openwrt-AutoUpdate https://github.com/Hyy2001X master
|
||||
}
|
||||
|
||||
Diy-Part2() {
|
||||
echo "[$(date "+%H:%M:%S")] Current Openwrt version: $Version-`date +%Y%m%d`"
|
||||
echo "[$(date "+%H:%M:%S")] Current Openwrt version: $Lede_Version-`date +%Y%m%d`"
|
||||
if [ ! $(grep -o "Compiled by $Author" $Default_File | wc -l) = "1" ];then
|
||||
sed -i "s?$Version?$Version Compiled by $Author [$Compile_Date]?g" $Default_File
|
||||
sed -i "s?$Lede_Version?$Lede_Version Compiled by $Author [$Compile_Date]?g" $Default_File
|
||||
fi
|
||||
echo "$Version-`date +%Y%m%d`" > ./package/base-files/files/etc/openwrt_date
|
||||
echo "[$(date "+%H:%M:%S")] Writing $Version-`date +%Y%m%d` to ./package/base-files/files/etc/openwrt_date ..."
|
||||
echo "$Lede_Version-`date +%Y%m%d`" > ./package/base-files/files/etc/openwrt_date
|
||||
echo "[$(date "+%H:%M:%S")] Writing $Lede_Version-`date +%Y%m%d` to ./package/base-files/files/etc/openwrt_date ..."
|
||||
echo "[$(date "+%H:%M:%S")] Writing $TARGET_PROFILE to ./package/base-files/files/etc/openwrt_device ..."
|
||||
}
|
||||
|
||||
Diy-Part3() {
|
||||
Default_Firmware=openwrt-$TARGET_BOARD-$TARGET_SUBTARGET-$TARGET_PROFILE-$TARGET_ROOTFS
|
||||
AutoBuild_Firmware=AutoBuild-$TARGET_PROFILE-Lede-$Version`(date +-%Y%m%d.bin)`
|
||||
AutoBuild_Detail=AutoBuild-$TARGET_PROFILE-Lede-$Version`(date +-%Y%m%d.detail)`
|
||||
GET_TARGET_INFO
|
||||
Default_Firmware=openwrt-$TARGET_BOARD-$TARGET_SUBTARGET-$TARGET_PROFILE-$FIRMWARE_SUFFIX
|
||||
AutoBuild_Firmware=AutoBuild-$TARGET_PROFILE-Lede-$Lede_Version`(date +-%Y%m%d.bin)`
|
||||
AutoBuild_Detail=AutoBuild-$TARGET_PROFILE-Lede-$Lede_Version`(date +-%Y%m%d.detail)`
|
||||
mkdir -p ./bin/Firmware
|
||||
mv ./bin/targets/$TARGET_BOARD/$TARGET_SUBTARGET/$Default_Firmware ./bin/Firmware/$AutoBuild_Firmware
|
||||
cd ./bin/Firmware
|
||||
|
|
Loading…
Reference in New Issue