添加 .github/diy/sync.sh

Signed-off-by: zhao <zj18139624826@gmail.com>
This commit is contained in:
2026-01-16 21:08:17 +08:00
parent 7e3ab9bca6
commit 29f8384712

31
.github/diy/sync.sh vendored Normal file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
# Git 稀疏克隆 OpenWrt rockchip 内容到【当前目录】
git_sparse_clone() {
branch="$1"
repourl="$2"
sparse_path="$3"
git clone \
--depth=1 \
-b "$branch" \
--single-branch \
--filter=blob:none \
--sparse \
"$repourl"
repodir="$(basename "$repourl" .git)"
cd "$repodir" || exit 1
git sparse-checkout set "$sparse_path"
# 把 rockchip 目录里的内容直接移到外面的当前目录
mv "$sparse_path"/* ../
mv "$sparse_path"/.[!.]* ../ 2>/dev/null || true
mv "$sparse_path"/..?* ../ 2>/dev/null || true
cd ..
rm -rf "$repodir"
}
git_sparse_clone openwrt-25.12 https://github.com/openwrt/openwrt.git target/linux/x86