diff --git a/.github/workflows/sync_to_gitee.yaml b/.github/workflows/sync_to_gitee.yaml deleted file mode 100644 index ab28adf..0000000 --- a/.github/workflows/sync_to_gitee.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: 同步到 Gitee -on: [push, workflow_dispatch] -jobs: - sync: - name: 同步到 Gitee - if: ${{ github.repository == 'bin456789/reinstall' }} - runs-on: ubuntu-latest - steps: - - uses: Yikun/hub-mirror-action@v1.4 - with: - src: github/bin456789 - dst: gitee/bin456789 - static_list: "reinstall" - force_update: true - dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} - dst_token: ${{ secrets.GITEE_TOKEN }} diff --git a/.github/workflows/sync_to_jihulab.yml b/.github/workflows/sync_to_jihulab.yml new file mode 100644 index 0000000..cd21b94 --- /dev/null +++ b/.github/workflows/sync_to_jihulab.yml @@ -0,0 +1,17 @@ +name: 同步到极狐 +on: + workflow_dispatch: + push: +jobs: + run: + name: 同步到极狐 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: yesolutions/mirror-action@master + with: + REMOTE: https://jihulab.com/bin456789/reinstall.git + GIT_USERNAME: username + GIT_PASSWORD: ${{ secrets.JIHULAB_TOKEN }} diff --git a/README.en.md b/README.en.md index 1c5330c..40f1dec 100644 --- a/README.en.md +++ b/README.en.md @@ -72,7 +72,7 @@ curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh For server inside China: ```bash -curl -O https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh +curl -O https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.sh ``` ## Download (Current system is Windows) @@ -114,7 +114,7 @@ certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinsta For server inside China: ```batch -certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat +certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.bat ``` ## Usage diff --git a/README.md b/README.md index dbf876f..7909db9 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh 国内服务器: ```bash -curl -O https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh +curl -O https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.sh ``` ## 下载(当前系统是 Windows) @@ -114,7 +114,7 @@ certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinsta 国内服务器: ```batch -certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat +certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.bat ``` ## 使用 diff --git a/reinstall.bat b/reinstall.bat index 6702736..6f5f097 100644 --- a/reinstall.bat +++ b/reinstall.bat @@ -3,7 +3,8 @@ mode con cp select=437 >nul setlocal EnableDelayedExpansion set confhome=https://raw.githubusercontent.com/bin456789/reinstall/main -set github_proxy=https://mirror.ghproxy.com/https://raw.githubusercontent.com +set confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/main +rem set confhome_cn=https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main rem 65001 代码页会乱码 @@ -45,8 +46,9 @@ findstr /c:"loc=CN" %tmp%\geoip >nul if not errorlevel 1 ( rem mirrors.tuna.tsinghua.edu.cn 会强制跳转 https set mirror=http://mirror.nju.edu.cn - - if defined github_proxy ( + if defined confhome_cn ( + set confhome=!confhome_cn! + ) else if defined github_proxy ( echo !confhome! | findstr /c:"://raw.githubusercontent.com/" >nul if not errorlevel 1 ( set confhome=!confhome:http://=https://! diff --git a/reinstall.sh b/reinstall.sh index 466e85f..18ed177 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -3,7 +3,8 @@ set -eE confhome=https://raw.githubusercontent.com/bin456789/reinstall/main -github_proxy=https://mirror.ghproxy.com/https://raw.githubusercontent.com +confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/main +# confhome_cn=https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main # https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html export LC_ALL=C @@ -2904,25 +2905,27 @@ arm* | aarch64) *) error_and_exit "Unsupported arch: $basearch" ;; esac +# 未测试 +if false && [[ "$confhome" = http*://raw.githubusercontent.com/* ]]; then + repo=$(echo $confhome | cut -d/ -f4,5) + branch=$(echo $confhome | cut -d/ -f6) + # 避免脚本更新时,文件不同步造成错误 + if [ -z "$commit" ]; then + commit=$(curl -L https://api.github.com/repos/$repo/git/refs/heads/$branch | + grep '"sha"' | grep -Eo '[0-9a-f]{40}') + fi + # shellcheck disable=SC2001 + confhome=$(echo "$confhome" | sed "s/main$/$commit/") +fi + # 设置国内代理 # gitee 不支持ipv6 # jsdelivr 有12小时缓存 # https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#L31 -if [ -n "$github_proxy" ] && [[ "$confhome" = http*://raw.githubusercontent.com/* ]]; then - # 未测试 - if false; then - repo=$(echo $confhome | cut -d/ -f4,5) - branch=$(echo $confhome | cut -d/ -f6) - # 避免脚本更新时,文件不同步造成错误 - if [ -z "$commit" ]; then - commit=$(curl -L https://api.github.com/repos/$repo/git/refs/heads/$branch | - grep '"sha"' | grep -Eo '[0-9a-f]{40}') - fi - # shellcheck disable=SC2001 - confhome=$(echo "$confhome" | sed "s/main$/$commit/") - fi - - if is_in_china; then +if is_in_china; then + if [ -n "$confhome_cn" ]; then + confhome=$confhome_cn + elif [ -n "$github_proxy" ] && [[ "$confhome" = http*://raw.githubusercontent.com/* ]]; then confhome=${confhome/http:\/\//https:\/\/} confhome=${confhome/https:\/\/raw.githubusercontent.com/$github_proxy} fi