From 056fe3950a1c6848e59ec3eb5780cdc77e1a3498 Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Wed, 24 Mar 2021 20:50:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=20Immortalwrt,=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=83=A8=E5=88=86=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 注: INCLUDE_DRM_I915 仅适用于 Lean 源码 --- Customize/Depends/ImmortalWrt | 7 + Customize/{ => Depends}/banner | 0 Customize/{ => Depends}/config-5.4 | 0 Customize/Depends/coremark_ImmortalWrt.sh | 10 + .../{coremark.sh => Depends/coremark_lede.sh} | 0 Customize/{ => Depends}/cpuinfo_x86 | 0 Customize/system_common | 2 +- Scripts/AutoBuild_DiyScript.sh | 33 ++-- Scripts/AutoBuild_Function.sh | 172 +++++++++--------- 9 files changed, 121 insertions(+), 103 deletions(-) create mode 100644 Customize/Depends/ImmortalWrt rename Customize/{ => Depends}/banner (100%) mode change 100755 => 100644 rename Customize/{ => Depends}/config-5.4 (100%) mode change 100755 => 100644 create mode 100644 Customize/Depends/coremark_ImmortalWrt.sh rename Customize/{coremark.sh => Depends/coremark_lede.sh} (100%) mode change 100755 => 100644 rename Customize/{ => Depends}/cpuinfo_x86 (100%) mode change 100755 => 100644 diff --git a/Customize/Depends/ImmortalWrt b/Customize/Depends/ImmortalWrt new file mode 100644 index 0000000..6115520 --- /dev/null +++ b/Customize/Depends/ImmortalWrt @@ -0,0 +1,7 @@ +DISTRIB_ID='%D' +DISTRIB_RELEASE='%V' +DISTRIB_REVISION='' +DISTRIB_TARGET='%S' +DISTRIB_ARCH='%A' +DISTRIB_DESCRIPTION='ImmortalWrt Template' +DISTRIB_TAINTS='%t' \ No newline at end of file diff --git a/Customize/banner b/Customize/Depends/banner old mode 100755 new mode 100644 similarity index 100% rename from Customize/banner rename to Customize/Depends/banner diff --git a/Customize/config-5.4 b/Customize/Depends/config-5.4 old mode 100755 new mode 100644 similarity index 100% rename from Customize/config-5.4 rename to Customize/Depends/config-5.4 diff --git a/Customize/Depends/coremark_ImmortalWrt.sh b/Customize/Depends/coremark_ImmortalWrt.sh new file mode 100644 index 0000000..c631c1c --- /dev/null +++ b/Customize/Depends/coremark_ImmortalWrt.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo -e "\nRunning CoreMark test,please wait ..." + +Scores=$(cat /tmp/coremark.log 2> /dev/null | grep "CoreMark 1.0" | awk '{print $4}') +Processer=$(awk -F ':[ ]' '/model name/{printf ($2);exit}' /proc/cpuinfo) +Time=$(grep "Total time" /tmp/coremark.log | awk '{print $4}') +[[ -z "${Processer}" ]] && Processer=Unknown + +echo -e "\nProcesser: ${Processer}\nScore: ${Scores}\nTime costs: ${Time}" \ No newline at end of file diff --git a/Customize/coremark.sh b/Customize/Depends/coremark_lede.sh old mode 100755 new mode 100644 similarity index 100% rename from Customize/coremark.sh rename to Customize/Depends/coremark_lede.sh diff --git a/Customize/cpuinfo_x86 b/Customize/Depends/cpuinfo_x86 old mode 100755 new mode 100644 similarity index 100% rename from Customize/cpuinfo_x86 rename to Customize/Depends/cpuinfo_x86 diff --git a/Customize/system_common b/Customize/system_common index 0064b7c..8741583 100755 --- a/Customize/system_common +++ b/Customize/system_common @@ -13,4 +13,4 @@ config timeserver 'ntp' list server 'ntp1.aliyun.com' list server 'time1.cloud.tencent.com' list server 'time.ustc.edu.cn' - list server 'cn.pool.ntp.org' \ No newline at end of file + list server 'cn.pool.ntp.org' diff --git a/Scripts/AutoBuild_DiyScript.sh b/Scripts/AutoBuild_DiyScript.sh index 0599e34..e87d668 100755 --- a/Scripts/AutoBuild_DiyScript.sh +++ b/Scripts/AutoBuild_DiyScript.sh @@ -9,27 +9,17 @@ Diy_Core() { INCLUDE_AutoUpdate=true INCLUDE_AutoBuild_Tools=true - INCLUDE_mt7621_OC1000MHz=true INCLUDE_DRM_I915=true - - INCLUDE_SSR_Plus=true - INCLUDE_Passwall=true - INCLUDE_HelloWorld=false - INCLUDE_Bypass=false - INCLUDE_OpenClash=true - INCLUDE_OAF=false - INCLUDE_Argon=true } Diy-Part1() { Diy_Part1_Base - Replace_File Customize/mac80211.sh package/kernel/mac80211/files/lib/wifi - Replace_File Customize/coremark.sh package/lean/coremark - Replace_File Customize/cpuinfo_x86 package/lean/autocore/files/x86/sbin cpuinfo Update_Makefile xray-core package/lean/helloworld/xray-core Update_Makefile exfat package/kernel/exfat + ExtraPackages git other OpenClash https://github.com/vernesong master + ExtraPackages git other openwrt-passwall https://github.com/xiaorouji main ExtraPackages git other luci-app-argon-config https://github.com/jerrykuku ExtraPackages git other luci-app-adguardhome https://github.com/Hyy2001X ExtraPackages git other luci-app-shutdown https://github.com/Hyy2001X @@ -38,8 +28,8 @@ Diy-Part1() { ExtraPackages svn other luci-app-socat https://github.com/Lienol/openwrt-package/trunk ExtraPackages svn other luci-app-usb3disable https://github.com/immortalwrt/luci/trunk/applications ExtraPackages svn other luci-app-filebrowser https://github.com/immortalwrt/luci/trunk/applications - ExtraPackages svn other filebrowser https://github.com/immortalwrt/immortalwrt/trunk/package/ctcgfw - ExtraPackages svn lean luci-app-eqos https://github.com/immortalwrt/immortalwrt/trunk/package/ntlf9t + ExtraPackages svn other filebrowser https://github.com/immortalwrt/packages/trunk/utils + ExtraPackages svn other luci-app-eqos https://github.com/immortalwrt/immortalwrt/trunk/package/ntlf9t ExtraPackages git other luci-app-bearDropper https://github.com/NateLol ExtraPackages git other luci-app-onliner https://github.com/rufengsuixing } @@ -47,6 +37,21 @@ Diy-Part1() { Diy-Part2() { Diy_Part2_Base ExtraPackages svn other/../../feeds/packages/admin netdata https://github.com/openwrt/packages/trunk/admin + + Replace_File Customize/uhttpd.po feeds/luci/applications/luci-app-uhttpd/po/zh-cn + Replace_File Customize/webadmin.po package/lean/luci-app-webadmin/po/zh-cn + Replace_File Customize/mwan3.config package/feeds/packages/mwan3/files/etc/config mwan3 + + case ${TARGET_PROFILE} in + d-team_newifi-d2) + Replace_File Customize/mac80211.sh package/kernel/mac80211/files/lib/wifi + Replace_File Customize/system_newifi-d2 package/base-files/files/etc/config system + Replace_File Customize/102-mt7621-fix-cpu-clk-add-clkdev.patch target/linux/ramips/patches-5.4 + ;; + *) + Replace_File Customize/system_common package/base-files/files/etc/config system + ;; + esac } Diy-Part3() { diff --git a/Scripts/AutoBuild_Function.sh b/Scripts/AutoBuild_Function.sh index 65c8c04..acc962f 100755 --- a/Scripts/AutoBuild_Function.sh +++ b/Scripts/AutoBuild_Function.sh @@ -4,13 +4,28 @@ # AutoBuild Functions GET_TARGET_INFO() { + Diy_Core Home=${GITHUB_WORKSPACE}/openwrt - echo "Home Path: ${Home}" [ -f ${GITHUB_WORKSPACE}/Openwrt.info ] && . ${GITHUB_WORKSPACE}/Openwrt.info - Default_File="package/lean/default-settings/files/zzz-default-settings" - [ -f ${Default_File} ] && Lede_Version="$(egrep -o "R[0-9]+\.[0-9]+\.[0-9]+" ${Default_File})" - [[ -z ${Lede_Version} ]] && Lede_Version="Openwrt" - Openwrt_Version="${Lede_Version}-${Compile_Date}" + Owner_Repo="$(grep "https://github.com/[a-zA-Z0-9]" ${GITHUB_WORKSPACE}/.git/config | cut -c8-100)" + AB_Firmware_Info=${GITHUB_WORKSPACE}/openwrt/package/base-files/files/etc/openwrt_info + Source_Repo="$(grep "https://github.com/[a-zA-Z0-9]" ${Home}/.git/config | cut -c8-100)" + Source_Owner="$(echo "${Source_Repo}" | egrep -o "[a-z]+" | awk 'NR==4')" + case ${Source_Owner} in + coolsnowwolf) + Version_File="package/lean/default-settings/files/zzz-default-settings" + Old_Version="$(egrep -o "R[0-9]+\.[0-9]+\.[0-9]+" ${Version_File})" + Openwrt_Version="${Old_Version}-${Compile_Date}" + + ;; + immortalwrt) + Version_File="package/base-files/files/etc/openwrt_release" + Openwrt_Version="${Compile_Date}" + ;; + *) + Openwrt_Version=Unknown + ;; + esac x86_Test="$(egrep -o "CONFIG_TARGET.*DEVICE.*=y" .config | sed -r 's/CONFIG_TARGET_(.*)_DEVICE_(.*)=y/\1/')" if [[ "${x86_Test}" == "x86_64" ]];then TARGET_PROFILE="x86_64" @@ -18,131 +33,112 @@ GET_TARGET_INFO() { TARGET_PROFILE="$(egrep -o "CONFIG_TARGET.*DEVICE.*=y" .config | sed -r 's/.*DEVICE_(.*)=y/\1/')" fi [[ -z "${TARGET_PROFILE}" ]] && TARGET_PROFILE="${Default_Device}" - case "${TARGET_PROFILE}" in + case ${TARGET_PROFILE} in x86_64) grep "CONFIG_TARGET_IMAGES_GZIP=y" ${Home}/.config > /dev/null 2>&1 - if [[ ! $? -ne 0 ]];then - Firmware_sfx="img.gz" + if [[ ! "$?" -ne 0 ]];then + Firmware_Type="img.gz" else - Firmware_sfx="img" + Firmware_Type="img" fi ;; *) - Firmware_sfx="bin" + Firmware_Type="bin" ;; esac TARGET_BOARD="$(awk -F '[="]+' '/TARGET_BOARD/{print $2}' .config)" TARGET_SUBTARGET="$(awk -F '[="]+' '/TARGET_SUBTARGET/{print $2}' .config)" - Github_Repo="$(grep "https://github.com/[a-zA-Z0-9]" ${GITHUB_WORKSPACE}/.git/config | cut -c8-100)" - AutoBuild_Info=${GITHUB_WORKSPACE}/openwrt/package/base-files/files/etc/openwrt_info } Diy_Part1_Base() { Diy_Core - Mkdir package/lean - Replace_File Customize/banner package/base-files/files/etc - if [[ "${INCLUDE_SSR_Plus}" == "true" ]];then - ExtraPackages git lean helloworld https://github.com/fw876 master - #sed -i 's/143/143,25,5222,6969,1337,2710/' package/lean/helloworld/luci-app-ssr-plus/root/etc/init.d/shadowsocksr - sed -i 's/143/143,8080/' package/lean/helloworld/luci-app-ssr-plus/root/etc/init.d/shadowsocksr - fi - if [[ "${INCLUDE_HelloWorld}" == "true" ]];then - ExtraPackages git lean luci-app-vssr https://github.com/jerrykuku master - ExtraPackages git other lua-maxminddb https://github.com/jerrykuku master - PKG_Finder d package xray-core - [[ -z "${PKG_RESULT}" ]] && ExtraPackages svn other xray-core https://github.com/fw876/helloworld/trunk - fi - if [[ "${INCLUDE_Bypass}" == "true" ]];then - ExtraPackages git other luci-app-bypass https://github.com/garypang13 main - find package/*/ feeds/*/ -maxdepth 2 -path "*luci-app-bypass/Makefile" | xargs -i sed -i 's/shadowsocksr-libev-ssr-redir/shadowsocksr-libev-alt/g' {} - find package/*/ feeds/*/ -maxdepth 2 -path "*luci-app-bypass/Makefile" | xargs -i sed -i 's/shadowsocksr-libev-ssr-server/shadowsocksr-libev-server/g' {} - fi - if [[ "${INCLUDE_OpenClash}" == "true" ]];then - ExtraPackages git other OpenClash https://github.com/vernesong master + Replace_File Customize/Depends/banner package/base-files/files/etc + if [[ "${INCLUDE_AutoUpdate}" == "true" ]];then + ExtraPackages git lean luci-app-autoupdate https://github.com/Hyy2001X main + Replace_File Scripts/AutoUpdate.sh package/base-files/files/bin + AutoUpdate_Version=$(awk 'NR==6' package/base-files/files/bin/AutoUpdate.sh | awk -F '[="]+' '/Version/{print $2}') + sed -i "s?Openwrt?Openwrt ${Openwrt_Version} / AutoUpdate ${AutoUpdate_Version}?g" package/base-files/files/etc/banner + else + sed -i "s?Openwrt?Openwrt ${Openwrt_Version}?g" package/base-files/files/etc/banner fi if [[ "${INCLUDE_AutoBuild_Tools}" == "true" ]];then Replace_File Scripts/AutoBuild_Tools.sh package/base-files/files/bin fi - if [[ "${INCLUDE_Passwall}" == "true" ]];then - ExtraPackages git other openwrt-passwall https://github.com/xiaorouji main - fi - if [[ "${INCLUDE_mt7621_OC1000MHz}" == "true" ]];then - Replace_File Customize/102-mt7621-fix-cpu-clk-add-clkdev.patch target/linux/ramips/patches-5.4 - fi - if [[ "${INCLUDE_OAF}" == "true" ]];then - echo "Warning: OpenAppFilter may conflict with FLowoffload/SFE/Turbo ACC !" - ExtraPackages git other OpenAppFilter https://github.com/destan19 - fi } Diy_Part2_Base() { - Diy_Core GET_TARGET_INFO - Replace_File Customize/uhttpd.po feeds/luci/applications/luci-app-uhttpd/po/zh-cn - Replace_File Customize/webadmin.po package/lean/luci-app-webadmin/po/zh-cn - Replace_File Customize/mwan3.config package/feeds/packages/mwan3/files/etc/config mwan3 - if [[ "${INCLUDE_Argon}" == "true" ]];then - if [ -f "${Default_File}" ];then - ExtraPackages git lean luci-theme-argon https://github.com/jerrykuku 18.06 - else - ExtraPackages git other luci-theme-argon https://github.com/jerrykuku + + Replace_File Customize/Depends/cpuinfo_x86 package/lean/autocore/files/x86/sbin cpuinfo + case ${Source_Owner} in + coolsnowwolf) + ExtraPackages git lean luci-theme-argon https://github.com/jerrykuku 18.06 + ExtraPackages git lean helloworld https://github.com/fw876 master + Update_Makefile xray-core package/lean/helloworld/xray-core + sed -i 's/143/143,25,5222,6969,1337,2710/' package/lean/helloworld/luci-app-ssr-plus/root/etc/init.d/shadowsocksr + Replace_File Customize/Depends/coremark_lede.sh package/lean/coremark coremark.sh + ExtraPackages svn other/../../feeds/packages/admin netdata https://github.com/openwrt/packages/trunk/admin + + sed -i "s?iptables?#iptables?g" ${Version_File} > /dev/null 2>&1 + sed -i "s?${Old_Version}?${Old_Version} Compiled by ${Author} [${Display_Date}]?g" $Version_File + + if [[ "${INCLUDE_DRM_I915}" == "true" ]];then + Replace_File Customize/Depends/config-5.4 target/linux/x86 fi - fi - if [[ "${INCLUDE_DRM_I915}" == "true" ]];then - Replace_File Customize/config-5.4 target/linux/x86 - fi - case ${TARGET_PROFILE} in - d-team_newifi-d2) - Replace_File Customize/system_newifi-d2 package/base-files/files/etc/config system + ;; + immortalwrt) + sed -i 's/143/143,25,5222,6969,1337,2710/' package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr + Replace_File Customize/Depends/coremark_ImmortalWrt.sh package/base-files/files/etc coremark.sh + + Replace_File Customize/Depends/ImmortalWrt package/base-files/files/etc openwrt_release + sed -i "s?Template?Compiled by ${Author} [${Display_Date}]?g" $Version_File ;; *) - Replace_File Customize/system_common package/base-files/files/etc/config system + ExtraPackages git other luci-theme-argon https://github.com/jerrykuku ;; esac - [ -f "${Default_File}" ] && sed -i "s?iptables?#iptables?g" ${Default_File} > /dev/null 2>&1 - if [[ "${INCLUDE_AutoUpdate}" == "true" ]];then - ExtraPackages git lean luci-app-autoupdate https://github.com/Hyy2001X main - sed -i '/luci-app-autoupdate/d' .config > /dev/null 2>&1 - echo -e "\nCONFIG_PACKAGE_luci-app-autoupdate=y" >> .config - Replace_File Scripts/AutoUpdate.sh package/base-files/files/bin - AutoUpdate_Version=$(awk 'NR==6' package/base-files/files/bin/AutoUpdate.sh | awk -F '[="]+' '/Version/{print $2}') - [[ -z "${AutoUpdate_Version}" ]] && AutoUpdate_Version="Unknown" - sed -i "s?Openwrt?Openwrt ${Openwrt_Version} / AutoUpdate ${AutoUpdate_Version}?g" package/base-files/files/etc/banner - echo "AutoUpdate Version: ${AutoUpdate_Version}" - else - sed -i "s?Openwrt?Openwrt ${Openwrt_Version}?g" package/base-files/files/etc/banner - fi - [[ -z "${Author}" ]] && Author="Unknown" - [ -f "$Default_File" ] && sed -i "s?${Lede_Version}?${Lede_Version} Compiled by ${Author} [${Display_Date}]?g" $Default_File - echo "${Openwrt_Version}" > ${AutoBuild_Info} - echo "${Github_Repo}" >> ${AutoBuild_Info} - echo "${TARGET_PROFILE}" >> ${AutoBuild_Info} - echo "${Firmware_sfx}" >> ${AutoBuild_Info} + + echo "${Openwrt_Version}" > ${AB_Firmware_Info} + echo "${Owner_Repo}" >> ${AB_Firmware_Info} + echo "${TARGET_PROFILE}" >> ${AB_Firmware_Info} + echo "${Firmware_Type}" >> ${AB_Firmware_Info} echo "Author: ${Author}" - echo "Openwrt Version: ${Openwrt_Version}" + echo "Github: ${Owner_Repo}" echo "Router: ${TARGET_PROFILE}" - echo "Github: ${Github_Repo}" - echo "Firmware Type: ${Firmware_sfx}" + echo "Firmware Version: ${Openwrt_Version}" + echo "Firmware Type: ${Firmware_Type}" + echo "Source Github: ${Source_Repo}" } Diy_Part3_Base() { - Diy_Core GET_TARGET_INFO + case ${Source_Owner} in + immortalwrt) + _Firmware=immortalwrt + _Legacy_Firmware=combined-squashfs + _EFI_Firmware=uefi-gpt-squashfs + ;; + *) + _Firmware=openwrt + _Legacy_Firmware=generic-squashfs-combined + _EFI_Firmware=generic-squashfs-combined-efi + ;; + esac Firmware_Path="bin/targets/${TARGET_BOARD}/${TARGET_SUBTARGET}" Mkdir bin/Firmware case "${TARGET_PROFILE}" in x86_64) cd ${Firmware_Path} - Legacy_Firmware=openwrt-${TARGET_BOARD}-${TARGET_SUBTARGET}-generic-squashfs-combined.${Firmware_sfx} - EFI_Firmware=openwrt-${TARGET_BOARD}-${TARGET_SUBTARGET}-generic-squashfs-combined-efi.${Firmware_sfx} + Legacy_Firmware=${_Firmware}-${TARGET_BOARD}-${TARGET_SUBTARGET}-${_Legacy_Firmware}.${Firmware_Type} + EFI_Firmware=${_Firmware}-${TARGET_BOARD}-${TARGET_SUBTARGET}-${_EFI_Firmware}.${Firmware_Type} AutoBuild_Firmware="AutoBuild-${TARGET_PROFILE}-${Openwrt_Version}" if [ -f "${Legacy_Firmware}" ];then _MD5=$(md5sum ${Legacy_Firmware} | cut -d ' ' -f1) _SHA256=$(sha256sum ${Legacy_Firmware} | cut -d ' ' -f1) touch ${Home}/bin/Firmware/${AutoBuild_Firmware}.detail echo -e "\nMD5:${_MD5}\nSHA256:${_SHA256}" > ${Home}/bin/Firmware/${AutoBuild_Firmware}-Legacy.detail - mv -f ${Legacy_Firmware} ${Home}/bin/Firmware/${AutoBuild_Firmware}-Legacy.${Firmware_sfx} + mv -f ${Legacy_Firmware} ${Home}/bin/Firmware/${AutoBuild_Firmware}-Legacy.${Firmware_Type} echo "Legacy Firmware is detected !" fi if [ -f "${EFI_Firmware}" ];then @@ -150,14 +146,14 @@ Diy_Part3_Base() { _SHA256=$(sha256sum ${EFI_Firmware} | cut -d ' ' -f1) touch ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.detail echo -e "\nMD5:${_MD5}\nSHA256:${_SHA256}" > ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.detail - cp ${EFI_Firmware} ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.${Firmware_sfx} + cp ${EFI_Firmware} ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.${Firmware_Type} echo "UEFI Firmware is detected !" fi ;; *) cd ${Home} - Default_Firmware="openwrt-${TARGET_BOARD}-${TARGET_SUBTARGET}-${TARGET_PROFILE}-squashfs-sysupgrade.${Firmware_sfx}" - AutoBuild_Firmware="AutoBuild-${TARGET_PROFILE}-${Openwrt_Version}.${Firmware_sfx}" + Default_Firmware="${_Firmware}-${TARGET_BOARD}-${TARGET_SUBTARGET}-${TARGET_PROFILE}-squashfs-sysupgrade.${Firmware_Type}" + AutoBuild_Firmware="AutoBuild-${TARGET_PROFILE}-${Openwrt_Version}.${Firmware_Type}" AutoBuild_Detail="AutoBuild-${TARGET_PROFILE}-${Openwrt_Version}.detail" echo "Firmware: ${AutoBuild_Firmware}" mv -f ${Firmware_Path}/${Default_Firmware} bin/Firmware/${AutoBuild_Firmware}