Merge code from BETA repo
This commit is contained in:
		
							parent
							
								
									b170dbf689
								
							
						
					
					
						commit
						e13ff2421d
					
				|  | @ -3,7 +3,7 @@ | ||||||
| # AutoBuild Module by Hyy2001 | # AutoBuild Module by Hyy2001 | ||||||
| # AutoUpdate | # AutoUpdate | ||||||
| 
 | 
 | ||||||
| Version=V3.3-BETA | Version=V3.4 | ||||||
| DEFAULT_DEVICE=d-team_newifi-d2 | DEFAULT_DEVICE=d-team_newifi-d2 | ||||||
| Github=https://github.com/Hyy2001X/AutoBuild-Actions | Github=https://github.com/Hyy2001X/AutoBuild-Actions | ||||||
| 
 | 
 | ||||||
|  | @ -23,18 +23,26 @@ if [[ ! $1 == "" ]];then | ||||||
| else | else | ||||||
| 	Upgrade_Option="-q" | 	Upgrade_Option="-q" | ||||||
| fi | fi | ||||||
| if [ "$CURRENT_VERSION" == "" ]; then | opkg list | awk  '{print $1}' > /tmp/Package_list | ||||||
|  | grep "curl" /tmp/Package_list > /dev/null 2>&1 | ||||||
|  | if [ ! $? -ne 0 ];then | ||||||
|  | 	Google_Check=`curl -I -s --connect-timeout 5 www.google.com -w %{http_code} | tail -n1` | ||||||
|  | 	[ ! "$Google_Check" == 200 ] && TIME && echo "Google 连接失败,可能导致固件下载速度缓慢!" | ||||||
|  | fi | ||||||
|  | grep "wget" /tmp/Package_list > /dev/null 2>&1 | ||||||
|  | [ $? -ne 0 ] && TIME && echo "未安装 wget!请先执行[opkg update && opkg install wget]" && exit | ||||||
|  | if [ "$CURRENT_VERSION" == "" ];then | ||||||
| 	echo -e "\n警告:当前固件版本获取失败!" | 	echo -e "\n警告:当前固件版本获取失败!" | ||||||
| 	CURRENT_VERSION=未知 | 	CURRENT_VERSION=未知 | ||||||
| fi | fi | ||||||
| if [ "$CURRENT_DEVICE" == "" ]; then | if [ "$CURRENT_DEVICE" == "" ];then | ||||||
| 	echo -e "\n警告:当前设备名称获取失败,使用预设名称[$DEFAULT_DEVICE]" | 	echo -e "\n警告:当前设备名称获取失败,使用预设名称[$DEFAULT_DEVICE]" | ||||||
| 	CURRENT_DEVICE=$DEFAULT_DEVICE | 	CURRENT_DEVICE=$DEFAULT_DEVICE | ||||||
| fi | fi | ||||||
| cd /tmp | cd /tmp | ||||||
| TIME && echo "正在获取云端固件版本..." | TIME && echo "正在获取云端固件版本..." | ||||||
| GET_Version=`wget -q $Github_Tags -O - | egrep -o 'R[0-9]+.[0-9]+.[0-9]+.[0-9]+' | awk 'NR==1'` | GET_Version=`wget -q $Github_Tags -O - | egrep -o 'R[0-9]+.[0-9]+.[0-9]+.[0-9]+' | awk 'NR==1'` | ||||||
| if [ "$GET_Version" == "" ]; then | if [ "$GET_Version" == "" ];then | ||||||
| 	TIME && echo "云端固件版本获取失败,请稍后重试!" | 	TIME && echo "云端固件版本获取失败,请稍后重试!" | ||||||
| 	exit | 	exit | ||||||
| fi | fi | ||||||
|  | @ -54,10 +62,6 @@ Firmware_Info="AutoBuild-${CURRENT_DEVICE}-Lede-${GET_Version}" | ||||||
| Firmware="${Firmware_Info}.bin" | Firmware="${Firmware_Info}.bin" | ||||||
| Firmware_Detail="${Firmware_Info}.detail" | Firmware_Detail="${Firmware_Info}.detail" | ||||||
| echo "云端固件名称:$Firmware" | echo "云端固件名称:$Firmware" | ||||||
| Google_Check=`curl -I -s --connect-timeout 5 www.google.com -w %{http_code} | tail -n1` |  | ||||||
| if [ ! "$Google_Check" == 200 ];then |  | ||||||
| 	TIME && echo "Google 连接失败,可能导致固件下载速度缓慢!" |  | ||||||
| fi |  | ||||||
| TIME && echo "正在下载固件,请耐心等待..." | TIME && echo "正在下载固件,请耐心等待..." | ||||||
| wget -q $Github_Download/$Firmware -O $Firmware | wget -q $Github_Download/$Firmware -O $Firmware | ||||||
| if [ ! "$?" == 0 ]; then | if [ ! "$?" == 0 ]; then | ||||||
|  | @ -80,10 +84,10 @@ if [ "$GET_MD5" == "" ] || [ "$CURRENT_MD5" == "" ];then | ||||||
| 	exit | 	exit | ||||||
| fi | fi | ||||||
| if [ ! "$GET_MD5" == "$CURRENT_MD5" ];then | if [ ! "$GET_MD5" == "$CURRENT_MD5" ];then | ||||||
| 	echo -e "\nMD5对比不通过,请检查网络后重试!" | 	echo -e "\nMD5对比失败,请检查网络后重试!" | ||||||
| 	exit | 	exit | ||||||
| fi | fi | ||||||
| TIME && echo "MD5对比通过,准备升级固件..." | TIME && echo "MD5对比通过!" | ||||||
| sleep 3 | sleep 3 | ||||||
| TIME && echo -e "开始升级固件,请耐心等待...\n" | TIME && echo -e "开始升级固件,请耐心等待...\n" | ||||||
| sysupgrade ${Upgrade_Option} $Firmware | sysupgrade ${Upgrade_Option} $Firmware | ||||||
|  | @ -0,0 +1,8 @@ | ||||||
|  |   _______                     ________        __ | ||||||
|  |  |       |.-----.-----.-----.|  |  |  |.----.|  |_ | ||||||
|  |  |   -   ||  _  |  -__|     ||  |  |  ||   _||   _| | ||||||
|  |  |_______||   __|_____|__|__||________||__|  |____| | ||||||
|  |           |__| W I R E L E S S   F R E E D O M | ||||||
|  |  ----------------------------------------------------- | ||||||
|  |       Openwrt | ||||||
|  |  ----------------------------------------------------- | ||||||
							
								
								
									
										32
									
								
								README.md
								
								
								
								
							
							
						
						
									
										32
									
								
								README.md
								
								
								
								
							|  | @ -1,6 +1,34 @@ | ||||||
| # AutoBuild-Actions | # AutoBuild-Actions | ||||||
|  | 
 | ||||||
| Actions for Building OpenWRT | Actions for Building OpenWRT | ||||||
| 
 | 
 | ||||||
| Supported Devices: `d-team_newifi-d2` | 测试通过的设备: **!x86**、`d-team_newifi-d2`、`phicomm_k2p` | ||||||
| 
 | 
 | ||||||
| 使用方法参考 CurssedCoffin老哥 的 [AutoBuild-Actions](https://github.com/CurssedCoffin/AutoBuild-Actions) | 使用方法/Usage: | ||||||
|  | ------ | ||||||
|  | 
 | ||||||
|  | 1. 首先需要获取[Github Token](https://github.com/settings/tokens/new),`Note`项随意填写,`Select scopes`项如果不懂就全部打勾,完成后点击`Generate token` | ||||||
|  | 
 | ||||||
|  | 2. 复制获取到的Token值,**一定要保存到本地,Token值只会显示一次!** | ||||||
|  | 
 | ||||||
|  | 3. `Fork`此仓库,然后进入到你的`AutoBuild-Actions`仓库 | ||||||
|  | 
 | ||||||
|  | 4. 点击右上方菜单中的`Settings`,点击`Secrets`-`New Secrets`,`Name`项填写`RELEASE_TOKEN`,`Value`项填写你在第 1 步中获取到的Token | ||||||
|  | 
 | ||||||
|  | 客制化固件: | ||||||
|  | ------ | ||||||
|  | 
 | ||||||
|  | 1. 进入到你的`AutoBuild-Actions`仓库 | ||||||
|  | 
 | ||||||
|  | 2. 编辑`/Customize/AutoUpdate.sh`文件,修改`第 7 行`为你要编译的设备名称,修改`第 8 行`为你的 Github 地址 | ||||||
|  | 
 | ||||||
|  | 3. 编辑`/Sctipts/diy-script.sh`文件,修改`第 7 行`为作者,作者将在路由器后台显示`Compiled by Hyy2001` | ||||||
|  | 
 | ||||||
|  | 4. **添加额外的软件包:** 编辑`Scrips/diy-script.sh`中的 `Diy-Part1()` 函数,参照下方语法添加第三方包到源码 | ||||||
|  | ``` | ||||||
|  |    [git clone]     ExtraPackages git Github仓库 远程分支 | ||||||
|  |      | ||||||
|  |    [svn checkout]  ExtraPackages svn Github仓库/trunk | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | 5. **添加自定义文件:** 首先上传自定义文件到`/Customize`,然后编辑 `Diy-Part1()` 函数,参照参照现有 `mv2` 语法添加自定义文件到源码 | ||||||
|  |  | ||||||
|  | @ -8,9 +8,11 @@ Author=Hyy2001 | ||||||
| 
 | 
 | ||||||
| Default_File=./package/lean/default-settings/files/zzz-default-settings | Default_File=./package/lean/default-settings/files/zzz-default-settings | ||||||
| Lede_Version=`egrep -o "R[0-9]+\.[0-9]+\.[0-9]+" $Default_File` | Lede_Version=`egrep -o "R[0-9]+\.[0-9]+\.[0-9]+" $Default_File` | ||||||
|  | Openwrt_Version="$Lede_Version-`date +%Y%m%d`" | ||||||
|  | AutoUpdate_Version=`awk 'NR==6' ./package/base-files/files/bin/AutoUpdate.sh | awk -F'[="]+' '/Version/{print $2}'` | ||||||
| Compile_Date=`date +'%Y/%m/%d'` | Compile_Date=`date +'%Y/%m/%d'` | ||||||
| Compile_Time=`date +'%Y-%m-%d %H:%M:%S'` | Compile_Time=`date +'%Y-%m-%d %H:%M:%S'` | ||||||
| TARGET_PROFILE=`egrep -o "CONFIG_TARGET.*DEVICE.*=y" .config | sed -r 's/.*DEVICE_(.*)=y/\1/'` | TARGET_PROFILE=`grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' | awk 'NR==1'` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| GET_TARGET_INFO() { | GET_TARGET_INFO() { | ||||||
|  | @ -69,6 +71,7 @@ mv2 system package/base-files/files/etc/config | ||||||
| mv2 mwan3 package/base-files/files/etc/config | mv2 mwan3 package/base-files/files/etc/config | ||||||
| mv2 AutoUpdate.sh package/base-files/files/bin | mv2 AutoUpdate.sh package/base-files/files/bin | ||||||
| mv2 firewall.config package/network/config/firewall/files | mv2 firewall.config package/network/config/firewall/files | ||||||
|  | mv2 banner package/base-files/files/etc | ||||||
| 
 | 
 | ||||||
| ExtraPackages git luci-theme-argon https://github.com/jerrykuku 18.06 | ExtraPackages git luci-theme-argon https://github.com/jerrykuku 18.06 | ||||||
| ExtraPackages svn luci-app-adguardhome https://github.com/Lienol/openwrt/trunk/package/diy | ExtraPackages svn luci-app-adguardhome https://github.com/Lienol/openwrt/trunk/package/diy | ||||||
|  | @ -81,17 +84,19 @@ ExtraPackages svn luci-app-socat https://github.com/xiaorouji/openwrt-package/tr | ||||||
| 
 | 
 | ||||||
| Diy-Part2() { | Diy-Part2() { | ||||||
| echo "Author: $Author" | echo "Author: $Author" | ||||||
| echo "Current Openwrt version: $Lede_Version-`date +%Y%m%d`" | echo "Current Openwrt Version: $Openwrt_Version" | ||||||
|  | echo "Current AutoUpdate Version: $AutoUpdate_Version" | ||||||
| echo "Current Device: $TARGET_PROFILE" | echo "Current Device: $TARGET_PROFILE" | ||||||
| sed -i "s?$Lede_Version?$Lede_Version Compiled by $Author [$Compile_Date]?g" $Default_File | sed -i "s?$Lede_Version?$Lede_Version Compiled by $Author [$Compile_Date]?g" $Default_File | ||||||
| echo "$Lede_Version-`date +%Y%m%d`" > ./package/base-files/files/etc/openwrt_info | echo "$Openwrt_Version" > ./package/base-files/files/etc/openwrt_info | ||||||
|  | sed -i "s?Openwrt?Openwrt $Openwrt_Version / AutoUpdate $AutoUpdate_Version?g" ./package/base-files/files/etc/banner | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Diy-Part3() { | Diy-Part3() { | ||||||
| GET_TARGET_INFO | GET_TARGET_INFO | ||||||
| Default_Firmware=openwrt-$TARGET_BOARD-$TARGET_SUBTARGET-$TARGET_PROFILE-squashfs-sysupgrade.bin | Default_Firmware=openwrt-$TARGET_BOARD-$TARGET_SUBTARGET-$TARGET_PROFILE-squashfs-sysupgrade.bin | ||||||
| AutoBuild_Firmware=AutoBuild-$TARGET_PROFILE-Lede-$Lede_Version`(date +-%Y%m%d.bin)` | AutoBuild_Firmware=AutoBuild-$TARGET_PROFILE-Lede-${Openwrt_Version}.bin | ||||||
| AutoBuild_Detail=AutoBuild-$TARGET_PROFILE-Lede-$Lede_Version`(date +-%Y%m%d.detail)` | AutoBuild_Detail=AutoBuild-$TARGET_PROFILE-Lede-${Openwrt_Version}.detail | ||||||
| mkdir -p ./bin/Firmware | mkdir -p ./bin/Firmware | ||||||
| echo "[$(date "+%H:%M:%S")] Moving $Default_Firmware to /bin/Firmware/$AutoBuild_Firmware ..." | echo "[$(date "+%H:%M:%S")] Moving $Default_Firmware to /bin/Firmware/$AutoBuild_Firmware ..." | ||||||
| mv ./bin/targets/$TARGET_BOARD/$TARGET_SUBTARGET/$Default_Firmware ./bin/Firmware/$AutoBuild_Firmware | mv ./bin/targets/$TARGET_BOARD/$TARGET_SUBTARGET/$Default_Firmware ./bin/Firmware/$AutoBuild_Firmware | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue