diff --git a/.github/workflows/d-team_newifi-d2.yml b/.github/workflows/d-team_newifi-d2.yml index 5f4187d..b11d03a 100644 --- a/.github/workflows/d-team_newifi-d2.yml +++ b/.github/workflows/d-team_newifi-d2.yml @@ -144,7 +144,7 @@ jobs: uses: softprops/action-gh-release@v1 if: env.UPLOAD_RELEASE == 'true' && !cancelled() env: - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: AutoUpdate body_path: update_log.txt diff --git a/.github/workflows/x86_64.yml b/.github/workflows/x86_64.yml index 6e79311..87af5e7 100644 --- a/.github/workflows/x86_64.yml +++ b/.github/workflows/x86_64.yml @@ -144,7 +144,7 @@ jobs: uses: softprops/action-gh-release@v1 if: env.UPLOAD_RELEASE == 'true' && !cancelled() env: - GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: AutoUpdate body_path: update_log.txt diff --git a/README.md b/README.md index 7ff2af9..61f3d9d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ 4. 点击上方菜单中的`Settings`,依次点击`Secrets`-`New repository secret` - 其中`Name`项填写`RELEASE_TOKEN`,然后将你的 **Token** 粘贴到`Value`项,完成后点击`Add secert` + 其中`Name`项填写`GITHUB_TOKEN`,然后将你的 **Token** 粘贴到`Value`项,完成后点击`Add secert` **Github Actions 部署只需操作一次** @@ -31,10 +31,10 @@ 3. 编辑`.github/workflows/*.yml`文件,修改`第 29 行 CONFIG_FILE:`为你上传的 '.config' 名称 - **定时编译** 先删除`第 20-21 行 #`注释,然后按需修改 cron 参数,[使用方法](https://www.runoob.com/w3cnote/linux-crontab-tasks.html) - - **一键编译** 先删除`第 23-24 行 #`注释,单击右上角 **Star** 重新点亮 **Star** 即可一键编译 - + **定时编译** 先删除`第 20-21 行 #`注释,然后按需修改相关参数,[使用方法](https://www.runoob.com/w3cnote/linux-crontab-tasks.html) + + **一键编译** 先删除`第 23-24 行 #`注释,单(双)击右上角 **Star** 重新点亮 **Star** 即可一键编译 + 4. 按照需求编辑`Scripts/AutoBuild_DiyScript.sh`文件的 **Firmware-Diy() 函数** **Diy_Core() 函数中的赋值解释:** @@ -48,6 +48,8 @@ INCLUDE_AutoBuild_Tools 添加 AutoBuild_Tools.sh 到固件 INCLUDE_DRM_I915 添加 Intel Graphics 驱动(仅 lede 源码以及部分核显可用) + + INCLUDE_Translation_Converter 添加 [zh-cn to zh_Hans] 转换脚本并执行 ``` **其他指令:** 编辑`Scripts/AutoBuild_DiyScript.sh`,参照下方语法: ``` @@ -69,7 +71,7 @@ 更多使用方法: `bash /bin/AutoUpdate.sh -help` **注意: 一键更新固件需要在 Diy-Core() 函数中启用`INCLUDE_AutoUpdate`** - + ## 使用一键扩展内部空间\挂载 Samba 共享脚本: 同上方操作,打开`TTYD 终端`,输入`bash /bin/AutoBuild_Tools.sh` @@ -78,12 +80,14 @@ ## 鸣谢 - - [Lean's Openwrt](https://github.com/coolsnowwolf/lede) + - [Lean's Openwrt Source code](https://github.com/coolsnowwolf/lede) + + - [P3TERX's Actions-OpenWrt Project](https://github.com/P3TERX/Actions-OpenWrt) - - [P3TERX's Project](https://github.com/P3TERX/Actions-OpenWrt) - - [P3TERX's Blog](https://p3terx.com/archives/build-openwrt-with-github-actions.html) + - [ImmortalWrt](https://github.com/immortalwrt) + - [eSir's workflow](https://github.com/esirplayground/AutoBuild-OpenWrt/blob/master/.github/workflows/Build_OP_x86_64.yml) - - - 测试/建议: [CurssedCoffin](https://github.com/CurssedCoffin) [Licsber](https://github.com/Licsber) [sirliu](https://github.com/sirliu?tab=repositories) + + - 测试/建议: [CurssedCoffin](https://github.com/CurssedCoffin) [Licsber](https://github.com/Licsber) [sirliu](https://github.com/sirliu) [teasiu](https://github.com/teasiu) \ No newline at end of file diff --git a/Scripts/AutoBuild_DiyScript.sh b/Scripts/AutoBuild_DiyScript.sh index c25139b..f01033e 100755 --- a/Scripts/AutoBuild_DiyScript.sh +++ b/Scripts/AutoBuild_DiyScript.sh @@ -10,6 +10,7 @@ Diy_Core() { INCLUDE_AutoUpdate=true INCLUDE_AutoBuild_Tools=true INCLUDE_DRM_I915=true + INCLUDE_Translation_Converter=true } Firmware-Diy() { diff --git a/Scripts/AutoBuild_Function.sh b/Scripts/AutoBuild_Function.sh index 03f2de1..3394ae8 100755 --- a/Scripts/AutoBuild_Function.sh +++ b/Scripts/AutoBuild_Function.sh @@ -107,6 +107,14 @@ Firmware-Diy_Base() { ;; esac + if [[ "${INCLUDE_Translation_Converter}" == "true" ]];then + echo "Start to convert zh-cn translation files to zh_Hans ..." + Replace_File Scripts/Convert_Translation.sh package + cd ./package + bash ./Convert_Translation.sh + cd .. + fi + echo "${Openwrt_Version}" > ${AB_Firmware_Info} echo "${Owner_Repo}" >> ${AB_Firmware_Info} echo "${TARGET_PROFILE}" >> ${AB_Firmware_Info} diff --git a/Scripts/Convert_Translation.sh b/Scripts/Convert_Translation.sh new file mode 100644 index 0000000..5e8315c --- /dev/null +++ b/Scripts/Convert_Translation.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# [CTCGFW]Project-OpenWrt +# Use it under GPLv3, please. +# -------------------------------------------------------- +# Convert translation files zh-cn to zh_Hans +# The script is still in testing, welcome to report bugs. + +po_file="$({ find |grep -E "[a-z0-9]+\.zh\-cn.+po"; } 2>"/dev/null")" +for a in ${po_file} +do + [ -n "$(grep "Language: zh_CN" "$a")" ] && sed -i "s/Language: zh_CN/Language: zh_Hans/g" "$a" + po_new_file="$(echo -e "$a"|sed "s/zh-cn/zh_Hans/g")" + mv "$a" "${po_new_file}" 2>"/dev/null" +done + +po_file2="$({ find |grep "/zh-cn/" |grep "\.po"; } 2>"/dev/null")" +for b in ${po_file2} +do + [ -n "$(grep "Language: zh_CN" "$b")" ] && sed -i "s/Language: zh_CN/Language: zh_Hans/g" "$b" + po_new_file2="$(echo -e "$b"|sed "s/zh-cn/zh_Hans/g")" + mv "$b" "${po_new_file2}" 2>"/dev/null" +done + +lmo_file="$({ find |grep -E "[a-z0-9]+\.zh_Hans.+lmo"; } 2>"/dev/null")" +for c in ${lmo_file} +do + lmo_new_file="$(echo -e "$c"|sed "s/zh_Hans/zh-cn/g")" + mv "$c" "${lmo_new_file}" 2>"/dev/null" +done + +lmo_file2="$({ find |grep "/zh_Hans/" |grep "\.lmo"; } 2>"/dev/null")" +for d in ${lmo_file2} +do + lmo_new_file2="$(echo -e "$d"|sed "s/zh_Hans/zh-cn/g")" + mv "$d" "${lmo_new_file2}" 2>"/dev/null" +done + +po_dir="$({ find |grep "/zh-cn" |sed "/\.po/d" |sed "/\.lmo/d"; } 2>"/dev/null")" +for e in ${po_dir} +do + po_new_dir="$(echo -e "$e"|sed "s/zh-cn/zh_Hans/g")" + mv "$e" "${po_new_dir}" 2>"/dev/null" +done + +makefile_file="$({ find|grep Makefile |sed "/Makefile./d"; } 2>"/dev/null")" +for f in ${makefile_file} +do + [ -n "$(grep "zh-cn" "$f")" ] && sed -i "s/zh-cn/zh_Hans/g" "$f" + [ -n "$(grep "zh_Hans.lmo" "$f")" ] && sed -i "s/zh_Hans.lmo/zh-cn.lmo/g" "$f" +done +exit 0 \ No newline at end of file