mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-26 20:52:52 +08:00
🐤 Sync 2026-08-25 20:39:13
This commit is contained in:
1 parent
5d66ecc543
commit
d0d3c135a8
8 files changed
+66
-28
No files matched your search
@@ -2,8 +2,8 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=1.2.0-r1
|
||||
PKG_RELEASE:=5
|
||||
PKG_VERSION:=1.3.0-r1
|
||||
PKG_RELEASE:=6
|
||||
|
||||
LUCI_TITLE:=LuCI support for shadowrt
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@@ -88,6 +88,9 @@ end
|
||||
o = s:option(Flag, "mnt", translate("Share /mnt"), translate("Share host's /mnt directory"))
|
||||
o.default = 0
|
||||
|
||||
o = s:option(Flag, "dind", translate("Enable Docker-in-Docker"), translate("Enable Docker in this instance"))
|
||||
o.default = 0
|
||||
|
||||
o = s:option(ListValue, "proto", translate("IP Protocol"), translate("Select how this instance gets its IP address"))
|
||||
o:value("static", translate("Static address"))
|
||||
o:value("dhcp", translate("DHCP client"))
|
||||
|
||||
@@ -29,15 +29,15 @@ msgstr ""
|
||||
msgid "Copy/Edit"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:109
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:112
|
||||
msgid "DHCP Server"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:93
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
||||
msgid "DHCP client"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:105
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:108
|
||||
msgid "DNS Servers"
|
||||
msgstr ""
|
||||
|
||||
@@ -55,29 +55,37 @@ msgid ""
|
||||
"ID in the same data directory will use this data)"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:109
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:112
|
||||
msgid "Enable DHCP server on this instance"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||
msgid "Enable Docker in this instance"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||
msgid "Enable Docker-in-Docker"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/view/shadowrt/status.htm:7
|
||||
msgid ""
|
||||
"Executing a shutdown within the clone will restart the clone. To shut down, "
|
||||
"use the \"Stop\" button below."
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:99
|
||||
msgid "Format: xxx.xxx.xxx.xxx/xx"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:101
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:104
|
||||
msgid "Gateway"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:99
|
||||
msgid "IP Address"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:94
|
||||
msgid "IP Protocol"
|
||||
msgstr ""
|
||||
|
||||
@@ -97,7 +105,7 @@ msgstr ""
|
||||
msgid "Loading view…"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:105
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:108
|
||||
msgid ""
|
||||
"Multiple DNS servers can be separated by spaces, e.g., '8.8.8.8 8.8.4.4'"
|
||||
msgstr ""
|
||||
@@ -136,7 +144,7 @@ msgstr ""
|
||||
msgid "Running"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:94
|
||||
msgid "Select how this instance gets its IP address"
|
||||
msgstr ""
|
||||
|
||||
@@ -181,7 +189,7 @@ msgstr ""
|
||||
msgid "Starting"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:92
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:95
|
||||
msgid "Static address"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -32,15 +32,15 @@ msgstr "配置"
|
||||
msgid "Copy/Edit"
|
||||
msgstr "复制/编辑"
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:109
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:112
|
||||
msgid "DHCP Server"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:93
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
||||
msgid "DHCP client"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:105
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:108
|
||||
msgid "DNS Servers"
|
||||
msgstr ""
|
||||
|
||||
@@ -60,29 +60,37 @@ msgstr ""
|
||||
"是否同时删除实例数据?(若保留,未来相同数据目录下创建相同 ID 的实例将会使用"
|
||||
"此数据)"
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:109
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:112
|
||||
msgid "Enable DHCP server on this instance"
|
||||
msgstr "这个实例提供 DHCP 服务"
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||
msgid "Enable Docker in this instance"
|
||||
msgstr "在这个实例启用 Docker"
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||
msgid "Enable Docker-in-Docker"
|
||||
msgstr "启用 Docker-in-Docker"
|
||||
|
||||
#: luasrc/view/shadowrt/status.htm:7
|
||||
msgid ""
|
||||
"Executing a shutdown within the clone will restart the clone. To shut down, "
|
||||
"use the \"Stop\" button below."
|
||||
msgstr "分身内执行关机会重启分身,如果要关机,使用下面的“停止”按钮。"
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:99
|
||||
msgid "Format: xxx.xxx.xxx.xxx/xx"
|
||||
msgstr "格式:xxx.xxx.xxx.xxx/xx"
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:101
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:104
|
||||
msgid "Gateway"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:99
|
||||
msgid "IP Address"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:94
|
||||
msgid "IP Protocol"
|
||||
msgstr ""
|
||||
|
||||
@@ -102,7 +110,7 @@ msgstr "操作说明"
|
||||
msgid "Loading view…"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:105
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:108
|
||||
msgid ""
|
||||
"Multiple DNS servers can be separated by spaces, e.g., '8.8.8.8 8.8.4.4'"
|
||||
msgstr "多个 DNS 可以用空格隔开,例如‘8.8.8.8 8.8.4.4’"
|
||||
@@ -141,7 +149,7 @@ msgstr "重启中"
|
||||
msgid "Running"
|
||||
msgstr ""
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:94
|
||||
msgid "Select how this instance gets its IP address"
|
||||
msgstr "实例如何获取自身 IP 地址"
|
||||
|
||||
@@ -191,7 +199,7 @@ msgstr ""
|
||||
msgid "Starting"
|
||||
msgstr "启动中"
|
||||
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:92
|
||||
#: luasrc/model/cbi/shadowrt/config.lua:95
|
||||
msgid "Static address"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ config instance
|
||||
option 'id' 'shadowrt0'
|
||||
# option 'data' '/mnt/data/shadowrt'
|
||||
option 'mnt' '0'
|
||||
option 'dind' '0'
|
||||
option 'proto' 'static'
|
||||
option 'address' '192.168.100.2/24'
|
||||
option 'gateway' '192.168.100.1'
|
||||
|
||||
@@ -8,6 +8,7 @@ do_install() {
|
||||
local id="`uci get shadowrt.@instance[0].id 2>/dev/null`"
|
||||
local data="`uci get shadowrt.@instance[0].data 2>/dev/null`"
|
||||
local mnt="`uci get shadowrt.@instance[0].mnt 2>/dev/null`"
|
||||
local dind="`uci get shadowrt.@instance[0].dind 2>/dev/null`"
|
||||
local proto=`uci get shadowrt.@instance[0].proto 2>/dev/null`
|
||||
local address=`uci get shadowrt.@instance[0].address 2>/dev/null`
|
||||
local gateway=`uci get shadowrt.@instance[0].gateway 2>/dev/null`
|
||||
@@ -47,7 +48,7 @@ do_install() {
|
||||
echo "WARNING: $data/$id already exists, may use old data." >&2
|
||||
fi
|
||||
|
||||
local config="{\"id\":\"$id\",\"data\":\"$data\",\"mnt\":\"$mnt\",\"proto\":\"$proto\",\"address\":\"$address\",\"gateway\":\"$gateway\",\"dns\":\"$dns\",\"dhcp_server\":\"$dhcp_server\",\"ports\":\"$ports\"}"
|
||||
local config="{\"id\":\"$id\",\"data\":\"$data\",\"mnt\":\"$mnt\",\"dind\":\"$dind\",\"proto\":\"$proto\",\"address\":\"$address\",\"gateway\":\"$gateway\",\"dns\":\"$dns\",\"dhcp_server\":\"$dhcp_server\",\"ports\":\"$ports\"}"
|
||||
|
||||
local cmd="docker run --restart=unless-stopped -d \
|
||||
--stop-signal SIGINT \
|
||||
@@ -56,7 +57,6 @@ do_install() {
|
||||
--security-opt apparmor=unconfined \
|
||||
--cap-add=SYS_ADMIN \
|
||||
--cap-add=SYS_CHROOT \
|
||||
--cap-drop=MKNOD \
|
||||
--cap-add=LEASE \
|
||||
--cap-add=SETGID \
|
||||
--cap-add=SETUID \
|
||||
@@ -75,6 +75,12 @@ do_install() {
|
||||
--label 'com.shadowrt.config=$config' \
|
||||
-v '$data/$id/overlay:/overlay:rw' "
|
||||
|
||||
if [ "$dind" = "1" -o "$dind" = "on" ]; then
|
||||
cmd="$cmd -e DIND=on"
|
||||
else
|
||||
cmd="$cmd --cap-drop=MKNOD"
|
||||
fi
|
||||
|
||||
[ -n "$proto" ] && cmd="$cmd -e IP_PROTO=$proto"
|
||||
if [ "$proto" = "static" ]; then
|
||||
[ -n "$address" ] && cmd="$cmd -e IP_ADDRESS=$address"
|
||||
@@ -143,6 +149,7 @@ do_clone() {
|
||||
echo "$config_json" | jsonfilter -e 'id=$.id' \
|
||||
-e 'data=$.data' \
|
||||
-e 'mnt=$.mnt' \
|
||||
-e 'dind=$.dind' \
|
||||
-e 'proto=$.proto' \
|
||||
-e 'address=$.address' \
|
||||
-e 'gateway=$.gateway' \
|
||||
@@ -182,11 +189,12 @@ do_reset_network() {
|
||||
/bin/config_generate
|
||||
/bin/sh -c ". /rom/etc/uci-defaults/zzz-dockerenv"
|
||||
/bin/sh -c '. /rom/etc/uci-defaults/12_network-generate-ula'
|
||||
/bin/sh -c '. /rom/etc/uci-defaults/14_network-generate-duid'
|
||||
/etc/init.d/network restart
|
||||
sleep 2
|
||||
EOF
|
||||
else
|
||||
echo 'rm -f etc/uci-defaults/zzz-dockerenv etc/uci-defaults/12_network-generate-ula'
|
||||
echo 'rm -f etc/uci-defaults/zzz-dockerenv etc/uci-defaults/12_network-generate-ula etc/uci-defaults/14_network-generate-duid'
|
||||
fi
|
||||
} | sh -c "$shell"
|
||||
}
|
||||
|
||||
@@ -2,10 +2,15 @@
|
||||
|
||||
mkdir -p /var/lock
|
||||
|
||||
for service in adb-enablemodem appfilter dockerd gpio_switch hd-idle \
|
||||
ADD_SERVICES=
|
||||
|
||||
[ "on" = "$DIND" ] || ADD_SERVICES="$ADD_SERVICES dockerd"
|
||||
|
||||
for service in adb-enablemodem appfilter gpio_switch hd-idle \
|
||||
kmods kmods-unload lcdsimple led lm-sensors luci-fan \
|
||||
mdadm modemmanager odhcpd smartd sysfixtime sysfsutils sysntpd \
|
||||
tuning_net umount usbmode usbmuxd wan_drop zprintk zram \
|
||||
$ADD_SERVICES \
|
||||
log
|
||||
do
|
||||
[ -x /etc/init.d/$service ] && /etc/init.d/$service disable
|
||||
|
||||
@@ -15,6 +15,8 @@ mount --make-private /overlay
|
||||
mount -t tmpfs -o ro,relatime tmpfs /sys/block
|
||||
mount -t tmpfs -o size=1M tmpfs /tmp
|
||||
|
||||
[ "on" = "$DIND" ] && mount -o rw,remount /sys/fs/cgroup
|
||||
|
||||
# make all private except /mnt
|
||||
mkdir -p $PATCHROM
|
||||
mount --bind / $PATCHROM
|
||||
@@ -66,6 +68,9 @@ umount $PATCHROM/tmp/shadowrt
|
||||
umount $PATCHROM/tmp
|
||||
rm -rf /tmp/tmp
|
||||
|
||||
export -n DIND
|
||||
unset DIND
|
||||
|
||||
set_default_ip()
|
||||
{
|
||||
local ip=$1
|
||||
|
||||
Reference in new issue
Block a user