Skip to content
This repository was archived by the owner on Feb 19, 2024. It is now read-only.

Commit 6cd38f6

Browse files
committed
Use sparse checkout when clone
1 parent 6a5d0c0 commit 6cd38f6

File tree

2 files changed

+50
-41
lines changed

2 files changed

+50
-41
lines changed

diy-mini.sh

+22-16
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# 更改默认 Shell 为 zsh
77
# sed -i 's/\/bin\/ash/\/usr\/bin\/zsh/g' package/base-files/files/etc/passwd
88

9-
# TTYD 自动登录
9+
# TTYD 免登录
1010
# sed -i 's|/bin/login|/bin/login -f root|g' feeds/packages/utils/ttyd/files/ttyd.config
1111

1212
# 移除要替换的包
@@ -17,32 +17,40 @@ rm -rf feeds/luci/themes/luci-theme-argon
1717
rm -rf feeds/luci/applications/luci-app-mosdns
1818
rm -rf feeds/luci/applications/luci-app-netdata
1919

20+
# Git稀疏克隆,只克隆指定目录到本地
21+
function git_sparse_clone() {
22+
branch="$1" repourl="$2" && shift 2
23+
git clone --depth=1 -b $branch --single-branch --filter=blob:none --sparse $repourl
24+
repodir=$(echo $repourl | awk -F '/' '{print $(NF)}')
25+
cd $repodir && git sparse-checkout set $@
26+
mv -f $@ ../package
27+
cd .. && rm -rf $repodir
28+
}
29+
2030
# 添加额外插件
2131
git clone --depth=1 https://github.com/kongfl888/luci-app-adguardhome package/luci-app-adguardhome
2232
git clone --depth=1 https://github.com/Jason6111/luci-app-netdata package/luci-app-netdata
23-
# svn export https://github.com/syb999/openwrt-19.07.1/trunk/package/network/services/msd_lite package/msd_lite
33+
# git_sparse_clone master https://github.com/syb999/openwrt-19.07.1 package/network/services/msd_lite
2434

2535
# 科学上网插件
2636
git clone --depth=1 -b main https://github.com/fw876/helloworld package/luci-app-ssr-plus
27-
svn export https://github.com/haiibo/packages/trunk/luci-app-vssr package/luci-app-vssr
28-
git clone --depth=1 https://github.com/jerrykuku/lua-maxminddb package/lua-maxminddb
2937
git clone --depth=1 https://github.com/xiaorouji/openwrt-passwall-packages package/openwrt-passwall
30-
svn export https://github.com/xiaorouji/openwrt-passwall/trunk/luci-app-passwall package/luci-app-passwall
31-
svn export https://github.com/xiaorouji/openwrt-passwall2/trunk/luci-app-passwall2 package/luci-app-passwall2
32-
svn export https://github.com/vernesong/OpenClash/trunk/luci-app-openclash package/luci-app-openclash
38+
git clone --depth=1 https://github.com/xiaorouji/openwrt-passwall package/luci-app-passwall
39+
git clone --depth=1 https://github.com/xiaorouji/openwrt-passwall2 package/luci-app-passwall2
40+
git_sparse_clone master https://github.com/vernesong/OpenClash luci-app-openclash
3341

3442
# Themes
3543
git clone --depth=1 -b 18.06 https://github.com/kiddin9/luci-theme-edge package/luci-theme-edge
3644
git clone --depth=1 -b 18.06 https://github.com/jerrykuku/luci-theme-argon package/luci-theme-argon
3745
git clone --depth=1 https://github.com/jerrykuku/luci-app-argon-config package/luci-app-argon-config
3846
git clone --depth=1 https://github.com/xiaoqingfengATGH/luci-theme-infinityfreedom package/luci-theme-infinityfreedom
39-
svn export https://github.com/haiibo/packages/trunk/luci-theme-opentomcat package/luci-theme-opentomcat
47+
git_sparse_clone main https://github.com/haiibo/packages luci-theme-opentomcat
4048

4149
# 更改 Argon 主题背景
4250
cp -f $GITHUB_WORKSPACE/images/bg1.jpg package/luci-theme-argon/htdocs/luci-static/argon/img/bg1.jpg
4351

4452
# 晶晨宝盒
45-
svn export https://github.com/ophub/luci-app-amlogic/trunk/luci-app-amlogic package/luci-app-amlogic
53+
git_sparse_clone main https://github.com/ophub/luci-app-amlogic luci-app-amlogic
4654
sed -i "s|firmware_repo.*|firmware_repo 'https://github.com/haiibo/OpenWrt'|g" package/luci-app-amlogic/root/etc/config/amlogic
4755
# sed -i "s|kernel_path.*|kernel_path 'https://github.com/ophub/kernel'|g" package/luci-app-amlogic/root/etc/config/amlogic
4856
sed -i "s|ARMv8|ARMv8_MINI|g" package/luci-app-amlogic/root/etc/config/amlogic
@@ -56,19 +64,17 @@ git clone --depth=1 https://github.com/ximiTech/luci-app-msd_lite package/luci-a
5664
git clone --depth=1 https://github.com/ximiTech/msd_lite package/msd_lite
5765

5866
# MosDNS
59-
svn export https://github.com/sbwml/luci-app-mosdns/trunk/luci-app-mosdns package/luci-app-mosdns
60-
svn export https://github.com/sbwml/luci-app-mosdns/trunk/mosdns package/mosdns
67+
git clone --depth=1 https://github.com/sbwml/luci-app-mosdns package/luci-app-mosdns
6168

6269
# Alist
63-
svn export https://github.com/sbwml/luci-app-alist/trunk/luci-app-alist package/luci-app-alist
64-
svn export https://github.com/sbwml/luci-app-alist/trunk/alist package/alist
70+
git clone --depth=1 https://github.com/sbwml/luci-app-alist package/luci-app-alist
6571

6672
# iStore
67-
svn export https://github.com/linkease/istore-ui/trunk/app-store-ui package/app-store-ui
68-
svn export https://github.com/linkease/istore/trunk/luci package/luci-app-store
73+
git_sparse_clone main https://github.com/linkease/istore-ui app-store-ui
74+
git_sparse_clone main https://github.com/linkease/istore luci
6975

7076
# 在线用户
71-
svn export https://github.com/haiibo/packages/trunk/luci-app-onliner package/luci-app-onliner
77+
git_sparse_clone main https://github.com/haiibo/packages luci-app-onliner
7278
sed -i '$i uci set nlbwmon.@nlbwmon[0].refresh_interval=2s' package/lean/default-settings/files/zzz-default-settings
7379
sed -i '$i uci commit nlbwmon' package/lean/default-settings/files/zzz-default-settings
7480
chmod 755 package/luci-app-onliner/root/usr/share/onliner/setnlbw.sh

diy-script.sh

+28-25
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# 更改默认 Shell 为 zsh
77
# sed -i 's/\/bin\/ash/\/usr\/bin\/zsh/g' package/base-files/files/etc/passwd
88

9-
# TTYD 自动登录
9+
# TTYD 免登录
1010
# sed -i 's|/bin/login|/bin/login -f root|g' feeds/packages/utils/ttyd/files/ttyd.config
1111

1212
# 移除要替换的包
@@ -19,41 +19,46 @@ rm -rf feeds/luci/applications/luci-app-mosdns
1919
rm -rf feeds/luci/applications/luci-app-netdata
2020
rm -rf feeds/luci/applications/luci-app-serverchan
2121

22+
# Git稀疏克隆,只克隆指定目录到本地
23+
function git_sparse_clone() {
24+
branch="$1" repourl="$2" && shift 2
25+
git clone --depth=1 -b $branch --single-branch --filter=blob:none --sparse $repourl
26+
repodir=$(echo $repourl | awk -F '/' '{print $(NF)}')
27+
cd $repodir && git sparse-checkout set $@
28+
mv -f $@ ../package
29+
cd .. && rm -rf $repodir
30+
}
31+
2232
# 添加额外插件
2333
git clone --depth=1 https://github.com/kongfl888/luci-app-adguardhome package/luci-app-adguardhome
2434
git clone --depth=1 -b openwrt-18.06 https://github.com/tty228/luci-app-wechatpush package/luci-app-serverchan
2535
git clone --depth=1 https://github.com/ilxp/luci-app-ikoolproxy package/luci-app-ikoolproxy
2636
git clone --depth=1 https://github.com/esirplayground/luci-app-poweroff package/luci-app-poweroff
2737
git clone --depth=1 https://github.com/destan19/OpenAppFilter package/OpenAppFilter
2838
git clone --depth=1 https://github.com/Jason6111/luci-app-netdata package/luci-app-netdata
29-
svn export https://github.com/Lienol/openwrt-package/trunk/luci-app-filebrowser package/luci-app-filebrowser
30-
svn export https://github.com/Lienol/openwrt-package/trunk/luci-app-ssr-mudb-server package/luci-app-ssr-mudb-server
31-
svn export https://github.com/immortalwrt/luci/branches/openwrt-18.06/applications/luci-app-eqos package/luci-app-eqos
32-
# svn export https://github.com/syb999/openwrt-19.07.1/trunk/package/network/services/msd_lite package/msd_lite
39+
git_sparse_clone main https://github.com/Lienol/openwrt-package luci-app-filebrowser luci-app-ssr-mudb-server
40+
git_sparse_clone openwrt-18.06 https://github.com/immortalwrt/luci applications/luci-app-eqos
41+
# git_sparse_clone master https://github.com/syb999/openwrt-19.07.1 package/network/services/msd_lite
3342

3443
# 科学上网插件
3544
git clone --depth=1 -b main https://github.com/fw876/helloworld package/luci-app-ssr-plus
36-
svn export https://github.com/haiibo/packages/trunk/luci-app-vssr package/luci-app-vssr
37-
git clone --depth=1 https://github.com/jerrykuku/lua-maxminddb package/lua-maxminddb
3845
git clone --depth=1 https://github.com/xiaorouji/openwrt-passwall-packages package/openwrt-passwall
39-
svn export https://github.com/xiaorouji/openwrt-passwall/trunk/luci-app-passwall package/luci-app-passwall
40-
svn export https://github.com/xiaorouji/openwrt-passwall2/trunk/luci-app-passwall2 package/luci-app-passwall2
41-
svn export https://github.com/vernesong/OpenClash/trunk/luci-app-openclash package/luci-app-openclash
46+
git clone --depth=1 https://github.com/xiaorouji/openwrt-passwall package/luci-app-passwall
47+
git clone --depth=1 https://github.com/xiaorouji/openwrt-passwall2 package/luci-app-passwall2
48+
git_sparse_clone master https://github.com/vernesong/OpenClash luci-app-openclash
4249

4350
# Themes
4451
git clone --depth=1 -b 18.06 https://github.com/kiddin9/luci-theme-edge package/luci-theme-edge
4552
git clone --depth=1 -b 18.06 https://github.com/jerrykuku/luci-theme-argon package/luci-theme-argon
4653
git clone --depth=1 https://github.com/jerrykuku/luci-app-argon-config package/luci-app-argon-config
4754
git clone --depth=1 https://github.com/xiaoqingfengATGH/luci-theme-infinityfreedom package/luci-theme-infinityfreedom
48-
svn export https://github.com/haiibo/packages/trunk/luci-theme-atmaterial package/luci-theme-atmaterial
49-
svn export https://github.com/haiibo/packages/trunk/luci-theme-opentomcat package/luci-theme-opentomcat
50-
svn export https://github.com/haiibo/packages/trunk/luci-theme-netgear package/luci-theme-netgear
55+
git_sparse_clone main https://github.com/haiibo/packages luci-theme-atmaterial luci-theme-opentomcat luci-theme-netgear
5156

5257
# 更改 Argon 主题背景
5358
cp -f $GITHUB_WORKSPACE/images/bg1.jpg package/luci-theme-argon/htdocs/luci-static/argon/img/bg1.jpg
5459

5560
# 晶晨宝盒
56-
svn export https://github.com/ophub/luci-app-amlogic/trunk/luci-app-amlogic package/luci-app-amlogic
61+
git_sparse_clone main https://github.com/ophub/luci-app-amlogic luci-app-amlogic
5762
sed -i "s|firmware_repo.*|firmware_repo 'https://github.com/haiibo/OpenWrt'|g" package/luci-app-amlogic/root/etc/config/amlogic
5863
# sed -i "s|kernel_path.*|kernel_path 'https://github.com/ophub/kernel'|g" package/luci-app-amlogic/root/etc/config/amlogic
5964
sed -i "s|ARMv8|ARMv8_PLUS|g" package/luci-app-amlogic/root/etc/config/amlogic
@@ -67,23 +72,21 @@ git clone --depth=1 https://github.com/ximiTech/luci-app-msd_lite package/luci-a
6772
git clone --depth=1 https://github.com/ximiTech/msd_lite package/msd_lite
6873

6974
# MosDNS
70-
svn export https://github.com/sbwml/luci-app-mosdns/trunk/luci-app-mosdns package/luci-app-mosdns
71-
svn export https://github.com/sbwml/luci-app-mosdns/trunk/mosdns package/mosdns
72-
73-
# DDNS.to
74-
svn export https://github.com/linkease/nas-packages-luci/trunk/luci/luci-app-ddnsto package/luci-app-ddnsto
75-
svn export https://github.com/linkease/nas-packages/trunk/network/services/ddnsto package/ddnsto
75+
git clone --depth=1 https://github.com/sbwml/luci-app-mosdns package/luci-app-mosdns
7676

7777
# Alist
78-
svn export https://github.com/sbwml/luci-app-alist/trunk/luci-app-alist package/luci-app-alist
79-
svn export https://github.com/sbwml/luci-app-alist/trunk/alist package/alist
78+
git clone --depth=1 https://github.com/sbwml/luci-app-alist package/luci-app-alist
79+
80+
# DDNS.to
81+
git_sparse_clone main https://github.com/linkease/nas-packages-luci luci/luci-app-ddnsto
82+
git_sparse_clone master https://github.com/linkease/nas-packages network/services/ddnsto
8083

8184
# iStore
82-
svn export https://github.com/linkease/istore-ui/trunk/app-store-ui package/app-store-ui
83-
svn export https://github.com/linkease/istore/trunk/luci package/luci-app-store
85+
git_sparse_clone main https://github.com/linkease/istore-ui app-store-ui
86+
git_sparse_clone main https://github.com/linkease/istore luci
8487

8588
# 在线用户
86-
svn export https://github.com/haiibo/packages/trunk/luci-app-onliner package/luci-app-onliner
89+
git_sparse_clone main https://github.com/haiibo/packages luci-app-onliner
8790
sed -i '$i uci set nlbwmon.@nlbwmon[0].refresh_interval=2s' package/lean/default-settings/files/zzz-default-settings
8891
sed -i '$i uci commit nlbwmon' package/lean/default-settings/files/zzz-default-settings
8992
chmod 755 package/luci-app-onliner/root/usr/share/onliner/setnlbw.sh

0 commit comments

Comments
 (0)