forked from breeze303/openwrt-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiy-script.sh
171 lines (132 loc) · 6.24 KB
/
diy-script.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/bash
# 修改默认IP
# sed -i 's/192.168.1.1/10.0.0.1/g' package/base-files/files/bin/config_generate
# TTYD 免登录
sed -i 's|/bin/login|/bin/login -f root|g' feeds/packages/utils/ttyd/files/ttyd.config
#安装和更新软件包
UPDATE_PACKAGE() {
local PKG_NAME=$1
local PKG_REPO=$2
local PKG_BRANCH=$3
local PKG_SPECIAL=${4:-}
rm -rf $(find feeds/luci/ feeds/packages/ -maxdepth 3 -type d -iname "*$PKG_NAME*" -prune)
if [[ $PKG_REPO == http* ]]; then
git clone --depth=1 --single-branch --branch $PKG_BRANCH "$PKG_REPO" package/$PKG_NAME
local REPO_NAME=$(echo $PKG_REPO | awk -F '/' '{gsub(/\.git$/, "", $NF); print $NF}')
else
git clone --depth=1 --single-branch --branch $PKG_BRANCH "https://github.com/$PKG_REPO.git" package/$PKG_NAME
local REPO_NAME=$(echo $PKG_REPO | cut -d '/' -f 2)
fi
if [[ $PKG_SPECIAL == "pkg" ]]; then
cp -rf $(find ./$REPO_NAME/*/ -maxdepth 3 -type d -iname "*$PKG_NAME*" -prune) ./
rm -rf ./$REPO_NAME/
elif [[ $PKG_SPECIAL == "name" ]]; then
mv -f $REPO_NAME $PKG_NAME
fi
}
#删掉垃圾源
sed -i "/kenzok8/d" "feeds.conf.default"
rm -rf package/feeds/small
rm -rf package/feeds/kenzo
# 添加额外插件
git clone --depth=1 https://github.com/esirplayground/luci-app-poweroff package/luci-app-poweroff
# 科学上网插件
UPDATE_PACKAGE "homeproxy" "https://github.com/VIKINGYFY/homeproxy.git" "main"
#UPDATE_PACKAGE "luci-app-adguardhome" "https://github.com/ysuolmai/luci-app-adguardhome.git" "master"
# Themes
#UPDATE_PACKAGE "argon" "sbwml/luci-theme-argon" "openwrt-24.10"
#DDNS-go
git clone https://github.com/sirpdboy/luci-app-ddns-go.git package/ddns-go
#luci-app-zerotier
git clone https://github.com/rufengsuixing/luci-app-zerotier.git package/luci-app-zerotier
#tailscale
#sed -i '/\/etc\/init\.d\/tailscale/d;/\/etc\/config\/tailscale/d;' feeds/packages/net/tailscale/Makefile
#git clone https://github.com/asvow/luci-app-tailscale package/luci-app-tailscale
#gecoosac
#git clone https://github.com/lwb1978/openwrt-gecoosac package/openwrt-gecoosac
#lucky
#git clone https://github.com/gdy666/luci-app-lucky.git package/lucky
#alist
UPDATE_PACKAGE "alist" "https://github.com/sbwml/luci-app-alist.git" "main"
#diskman
#UPDATE_PACKAGE "luci-app-diskman" "https://github.com/lisaac/luci-app-diskman.git" "master"
rm -rf $(find feeds/luci/ feeds/packages/ -maxdepth 3 -type d -iname luci-app-diskman -prune)
rm -rf $(find feeds/luci/ feeds/packages/ -maxdepth 3 -type d -iname parted -prune)
mkdir -p luci-app-diskman && \
wget https://raw.githubusercontent.com/lisaac/luci-app-diskman/master/applications/luci-app-diskman/Makefile -O luci-app-diskman/Makefile
mkdir -p parted && \
wget https://raw.githubusercontent.com/lisaac/luci-app-diskman/master/Parted.Makefile -O parted/Makefile
#speedtest
#UPDATE_PACKAGE "luci-app-netspeedtest" "https://github.com/sbwml/openwrt_pkgs.git" "main" "pkg"
UPDATE_PACKAGE "luci-app-adguardhome" "https://github.com/ysuolmai/luci-app-adguardhome.git" "master"
keywords_to_delete=(
"xiaomi_ax3600" "xiaomi_ax9000" "xiaomi_ax1800" "glinet" "jdcloud_ax6600"
"mr7350" "uugamebooster" "luci-app-wol" "luci-i18n-wol-zh-cn" "CONFIG_TARGET_INITRAMFS" "ddns" "LSUSB"
)
[[ $FIRMWARE_TAG == *"NOWIFI"* ]] && keywords_to_delete+=("usb" "wpad" "hostapd")
#[[ $FIRMWARE_TAG != *"EMMC"* ]] && keywords_to_delete+=("samba" "autosamba" "jdcloud_ax1800-pro" "redmi_ax5-jdcloud")
[[ $FIRMWARE_TAG != *"EMMC"* ]] && keywords_to_delete+=("samba" "autosamba" "disk")
[[ $FIRMWARE_TAG == *"EMMC"* ]] && keywords_to_delete+=("cmiot_ax18" "qihoo_v6" "redmi_ax5=y" "zn_m2")
for keyword in "${keywords_to_delete[@]}"; do
sed -i "/$keyword/d" ./.config
done
# Configuration lines to append to .config
provided_config_lines=(
"CONFIG_PACKAGE_luci-app-zerotier=y"
"CONFIG_PACKAGE_luci-i18n-zerotier-zh-cn=y"
"CONFIG_PACKAGE_luci-app-adguardhome=y"
"CONFIG_PACKAGE_luci-i18n-adguardhome-zh-cn=y"
"CONFIG_PACKAGE_luci-app-poweroff=y"
"CONFIG_PACKAGE_luci-i18n-poweroff-zh-cn=y"
"CONFIG_PACKAGE_cpufreq=y"
"CONFIG_PACKAGE_luci-app-cpufreq=y"
"CONFIG_PACKAGE_luci-i18n-cpufreq-zh-cn=y"
"CONFIG_PACKAGE_luci-app-ttyd=y"
"CONFIG_PACKAGE_luci-i18n-ttyd-zh-cn=y"
"CONFIG_PACKAGE_ttyd=y"
"CONFIG_PACKAGE_luci-app-homeproxy=y"
"CONFIG_PACKAGE_luci-i18n-homeproxy-zh-cn=y"
"CONFIG_PACKAGE_luci-app-ddns-go=y"
"CONFIG_PACKAGE_luci-i18n-ddns-go-zh-cn=y"
"CONFIG_PACKAGE_luci-app-argon-config=y"
"CONFIG_PACKAGE_nano=y"
"CONFIG_BUSYBOX_CONFIG_LSUSB=n"
)
if [[ $FIRMWARE_TAG == *"NOWIFI"* ]]; then
provided_config_lines+=(
"CONFIG_PACKAGE_hostapd-common=n"
"CONFIG_PACKAGE_wpad-openssl=n"
)
else
provided_config_lines+=(
"CONFIG_PACKAGE_kmod-usb-net=y"
"CONFIG_PACKAGE_kmod-usb-net-rndis=y"
"CONFIG_PACKAGE_kmod-usb-net-cdc-ether=y"
"CONFIG_PACKAGE_usbutils=y"
)
fi
[[ $FIRMWARE_TAG == *"EMMC"* ]] && provided_config_lines+=(
"CONFIG_PACKAGE_luci-app-diskman=y"
"CONFIG_PACKAGE_luci-i18n-diskman-zh-cn=y"
"CONFIG_PACKAGE_luci-app-docker=y"
"CONFIG_PACKAGE_luci-i18n-docker-zh-cn=y"
"CONFIG_PACKAGE_luci-app-dockerman=y"
"CONFIG_PACKAGE_luci-i18n-dockerman-zh-cn=y"
"CONFIG_PACKAGE_luci-app-alist=y"
"CONFIG_PACKAGE_luci-i18n-alist-zh-cn=y"
"CONFIG_PACKAGE_fdisk=y"
"CONFIG_PACKAGE_parted=y"
)
# Append configuration lines to .config
for line in "${provided_config_lines[@]}"; do
echo "$line" >> .config
done
./scripts/feeds update -a
./scripts/feeds install -a
#修复文件
find ./ -name "getifaddr.c" -exec sed -i 's/return 1;/return 0;/g' {} \;
sed -i '/\/usr\/bin\/zsh/d' package/base-files/files/etc/profile
#find ./ -path "*/usbutils/Makefile" -exec sed -i '/$(INSTALL_BIN) $(PKG_INSTALL_DIR)\/usr\/bin\/lsusb $(1)\/usr\/bin\//i rm -f $(1)/usr/bin/lsusb' {} \;
#find ./ -path "*/usbutils/Makefile" -exec sed -i '/$(INSTALL_BIN) $(PKG_INSTALL_DIR)\/usr\/bin\/lsusb $(1)\/usr\/bin\//i \\ rm -f $(1)/usr/bin/lsusb' {} \;
#find ./ -path "*/usbutils/Makefile" -exec sed -i 's|$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lsusb $(1)/usr/bin/|$(INSTALL_BIN) -o $(PKG_INSTALL_DIR)/usr/bin/lsusb $(1)/usr/bin/|g' {} \;
install -Dm755 "${GITHUB_WORKSPACE}/scripts/99_set_argon_primary.sh" "package/base-files/files/etc/uci-defaults/99_set_argon_primary"