core: 使用极狐 Gitlab

This commit is contained in:
bin456789 2024-07-20 21:14:03 +08:00
parent cbe1502835
commit c9b8738bdb
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
6 changed files with 45 additions and 39 deletions

View File

@ -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 }}

17
.github/workflows/sync_to_jihulab.yml vendored Normal file
View File

@ -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 }}

View File

@ -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 <img width="20" height="20" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> 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

View File

@ -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
```
## 下载(当前系统是 <img width="20" height="20" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> 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
```
## 使用

View File

@ -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://!

View File

@ -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