From 35a44e1ec6ad20e4698a142cb4b47a5045494767 Mon Sep 17 00:00:00 2001 From: Hyy2001X <1804430051@qq.com> Date: Thu, 4 Mar 2021 21:50:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BB=E9=A1=B5=20CPU=20?= =?UTF-8?q?=E6=B8=A9=E5=BA=A6=E6=98=BE=E7=A4=BA(x86);=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?coremark.sh;=E8=B0=83=E6=95=B4=E4=B8=8E=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Customize/coremark.sh | 17 +++++++++++++++++ Customize/cpuinfo_x86 | 5 +++++ Scripts/AutoBuild_DiyScript.sh | 17 ++++++++--------- Scripts/AutoBuild_Function.sh | 7 ++----- 4 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 Customize/coremark.sh create mode 100644 Customize/cpuinfo_x86 diff --git a/Customize/coremark.sh b/Customize/coremark.sh new file mode 100644 index 0000000..ab6f9b2 --- /dev/null +++ b/Customize/coremark.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo -e "\nRunning CoreMark test,please wait ..." +/bin/coremark > /tmp/coremark.log + +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}" +echo "(CPU Mark: ${Scores} Scores)" > /etc/bench.log + +if [ -f "/etc/bench.log" ]; then + sed -i '/coremark/d' /etc/crontabs/root + crontab /etc/crontabs/root +fi \ No newline at end of file diff --git a/Customize/cpuinfo_x86 b/Customize/cpuinfo_x86 new file mode 100644 index 0000000..28c68b9 --- /dev/null +++ b/Customize/cpuinfo_x86 @@ -0,0 +1,5 @@ +#!/bin/sh + +MHz=$(grep 'MHz' /proc/cpuinfo | awk '{print $4}' | awk 'NR==1') +TEMP=$(sensors 2>/dev/null | grep 'Package id' | awk '{print $4}') +echo "$MHz MHz $TEMP " \ No newline at end of file diff --git a/Scripts/AutoBuild_DiyScript.sh b/Scripts/AutoBuild_DiyScript.sh index dcdf948..e4c04dc 100755 --- a/Scripts/AutoBuild_DiyScript.sh +++ b/Scripts/AutoBuild_DiyScript.sh @@ -24,13 +24,17 @@ 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 lean luci-theme-argon https://github.com/jerrykuku 18.06 - ExtraPackages git other luci-app-argon-config https://github.com/jerrykuku master - ExtraPackages git other luci-app-adguardhome https://github.com/Hyy2001X master - ExtraPackages git other luci-app-shutdown https://github.com/Hyy2001X master + 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 ExtraPackages svn other luci-app-smartdns https://github.com/immortalwrt/immortalwrt/trunk/package/ntlf9t - ExtraPackages git other luci-app-serverchan https://github.com/tty228 master + ExtraPackages git other luci-app-serverchan https://github.com/tty228 ExtraPackages svn other luci-app-socat https://github.com/Lienol/openwrt-package/trunk ExtraPackages svn other luci-app-usb3disable https://github.com/immortalwrt/immortalwrt/trunk/package/ctcgfw ExtraPackages svn lean luci-app-kodexplorer https://github.com/immortalwrt/immortalwrt/trunk/package/lean @@ -39,16 +43,11 @@ Diy-Part1() { ExtraPackages svn lean luci-app-eqos https://github.com/immortalwrt/immortalwrt/trunk/package/ntlf9t ExtraPackages svn other luci-app-mentohust https://github.com/immortalwrt/immortalwrt/trunk/package/ctcgfw ExtraPackages svn other mentohust https://github.com/immortalwrt/immortalwrt/trunk/package/ctcgfw - # ExtraPackages svn lean luci-app-qbittorrent https://github.com/immortalwrt/immortalwrt/trunk/package/lean - # ExtraPackages svn lean libtorrent-rasterbar https://github.com/immortalwrt/packages/trunk/libs - # rm -rf package/lean/qBittorrent - # ExtraPackages svn lean qBittorrent-Enhanced-Edition https://github.com/garypang13/openwrt-static-qb/trunk } Diy-Part2() { Diy_Part2_Base ExtraPackages svn other/../../feeds/packages/admin netdata https://github.com/openwrt/packages/trunk/admin - # ExtraPackages svn other/../../feeds/packages/net zerotier https://github.com/openwrt/packages/trunk/net } Diy-Part3() { diff --git a/Scripts/AutoBuild_Function.sh b/Scripts/AutoBuild_Function.sh index f78cf71..32763bc 100755 --- a/Scripts/AutoBuild_Function.sh +++ b/Scripts/AutoBuild_Function.sh @@ -72,8 +72,6 @@ Diy_Part1_Base() { echo "Warning: OpenAppFilter may conflict with FLowoffload/SFE !" ExtraPackages git other OpenAppFilter https://github.com/destan19 fi - Update_Makefile xray-core package/lean/helloworld/xray-core - Update_Makefile exfat package/kernel/exfat } Diy_Part2_Base() { @@ -111,12 +109,11 @@ Diy_Part2_Base() { echo "Openwrt Version: ${Openwrt_Version}" echo "Router: ${TARGET_PROFILE}" echo "Github: ${Github_Repo}" + echo "Firmware Type: ${Firmware_sfx}" [ -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 Type: ${Firmware_sfx}" - echo "Writting Type: ${Firmware_sfx} to ${AutoBuild_Info} ..." echo "${Firmware_sfx}" >> ${AutoBuild_Info} } @@ -227,7 +224,7 @@ Replace_File() { Mkdir ${PATCH_DIR} [ -f "${GITHUB_WORKSPACE}/${FILE_NAME}" ] && _TYPE1="f" && _TYPE2="File" [ -d "${GITHUB_WORKSPACE}/${FILE_NAME}" ] && _TYPE1="d" && _TYPE2="Folder" - if [ -f "${GITHUB_WORKSPACE}/${FILE_NAME}" ];then + if [ -${_TYPE1} "${GITHUB_WORKSPACE}/${FILE_NAME}" ];then [[ ! -z "${FILE_RENAME}" ]] && _RENAME="${FILE_RENAME}" || _RENAME="" if [ -${_TYPE1} "${GITHUB_WORKSPACE}/${FILE_NAME}" ];then echo "[$(date "+%H:%M:%S")] Moving [${_TYPE2}] ${FILE_NAME} to ${2}/${FILE_RENAME} ..."