mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-01 07:23:56 +08:00
🌈 Sync 2026-07-31 08:33:38
This commit is contained in:
1 parent
b44a4364c4
commit
d1ded93052
23 files changed
+263
-274
No files matched your search
@@ -1,3 +1,3 @@
|
||||
config ghttpd
|
||||
option 'enabled' '0'
|
||||
option port '8333'
|
||||
option 'enabled' '1'
|
||||
option port '80'
|
||||
@@ -4,14 +4,23 @@ START=93
|
||||
USE_PROCD=1
|
||||
|
||||
get_config() {
|
||||
config_get enabled $1 enabled "0"
|
||||
config_get port $1 port "8333"
|
||||
config_get enabled $1 enabled "1"
|
||||
config_get port $1 port "80"
|
||||
}
|
||||
|
||||
stop_default_httpd_services() {
|
||||
[ "$port" = "80" ] || return 0
|
||||
|
||||
for service in uhttpd nginx; do
|
||||
[ -x "/etc/init.d/$service" ] && "/etc/init.d/$service" stop >/dev/null 2>&1
|
||||
done
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load ghttpd
|
||||
config_foreach get_config ghttpd
|
||||
[ $enabled != 1 ] && return 1
|
||||
[ "$enabled" != 1 ] && return 1
|
||||
stop_default_httpd_services
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/sbin/ghttpd openwrt
|
||||
if [ -n "$port" ]; then
|
||||
@@ -24,4 +33,4 @@ start_service() {
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "ghttpd"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,19 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-ghttpd.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-ghttpd.json << EEOF
|
||||
{
|
||||
"config": "ghttpd",
|
||||
"init": "ghttpd"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@ghttpd[-1]
|
||||
add ucitrack ghttpd
|
||||
set ucitrack.@ghttpd[-1].init=ghttpd
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
/etc/init.d/ghttpd enable
|
||||
/etc/init.d/ghttpd start
|
||||
|
||||
Reference in new issue
Block a user