Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

Commit

Permalink
fix some autorun.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjm2473 committed Apr 5, 2019
1 parent 293ae3d commit 50c8ecd
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 87 deletions.
6 changes: 5 additions & 1 deletion docs/porting.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ UBus的监听地址跟官方Openwrt不一样, 官方的是普通命名方式(/va
len = SUN_LEN(&addr); // 计算长度
addr.sun_path[0] = 0; // 设置成抽象 unix 域套接字地址
```
...
...

NFSD 不能导出 /mnt, 可以导出其中的挂载点
VSFTPD 可以导出 /mnt, 不能导出其中的挂载点, 但可以访问
SAMBA4 可以导出 /mnt, 也能导出其中的挂载点, 但是客户端挂载 /mnt 访问不了其中的挂载点
1 change: 1 addition & 0 deletions root/etc/config/ucitrack
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ config tinyproxy
option init tinyproxy

config minidlna 'minidlna'
option init 'minidlna'

config transmission
option init 'transmission'
14 changes: 12 additions & 2 deletions root/etc/init.d/afpd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ config_instance()
local hostname
local path

config_get enabled $1 enabled
config_get hostname $1 hostname
config_get path $1 path

Expand All @@ -22,8 +21,14 @@ config_instance()
}

start_service() {
local enabled
config_load afpd
config_foreach config_instance afpd

config_get_bool enabled config 'enabled' '0'

[ "$enabled" -gt 0 ] || return 1

config_foreach config_instance netatalk

mkdir -p /var/netatalk/CNID/files

Expand All @@ -39,3 +44,8 @@ start_service() {
procd_close_instance
}

service_triggers() {
PROCD_RELOAD_DELAY=2000

procd_add_reload_trigger "afpd"
}
1 change: 1 addition & 0 deletions root/etc/rc.d/K10afpd
1 change: 1 addition & 0 deletions root/etc/rc.d/S80afpd
6 changes: 0 additions & 6 deletions root/etc/uci-defaults/luci-afpd
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@

if [ "`uci get afpd.config.enabled`" == "1" ] ; then
/etc/init.d/afpd enable
else
/etc/init.d/afpd enabled && {
/etc/init.d/afpd stop
/etc/init.d/afpd disable
}
fi

uci -q batch <<-EOF >/dev/null
Expand All @@ -29,5 +24,4 @@ uci -q batch <<-EOF >/dev/null
commit ucitrack
EOF

rm -f /tmp/luci-indexcache
exit 0
1 change: 0 additions & 1 deletion root/etc/uci-defaults/luci-forked-daapd
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ uci -q batch <<-EOF >/dev/null
commit ucitrack
EOF

rm -f /tmp/luci-indexcache
exit 0
1 change: 0 additions & 1 deletion root/etc/uci-defaults/luci-nfsd
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ uci -q batch <<-EOF >/dev/null
commit ucitrack
EOF

rm -f /tmp/luci-indexcache
exit 0
8 changes: 3 additions & 5 deletions root/etc/uci-defaults/luci-vsftpd
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/sh

/etc/init.d/vsftpd enabled && {
/etc/init.d/vsftpd stop
/etc/init.d/vsftpd disable
}
if [ "`uci get vsftpd.config.enabled`" == "1" ] ; then
/etc/init.d/vsftpd enable
fi

uci -q batch <<-EOF >/dev/null
delete ucitrack.vsftpd
Expand All @@ -12,5 +11,4 @@ uci -q batch <<-EOF >/dev/null
commit ucitrack
EOF

rm -f /tmp/luci-indexcache
exit 0
14 changes: 14 additions & 0 deletions root/etc/uci-defaults/minidlna
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

if [ "`uci get minidlna.config.enabled`" == "1" ] ; then
/etc/init.d/minidlna enable
fi

uci -q batch <<-EOF >/dev/null
delete ucitrack.minidlna
set ucitrack.minidlna=minidlna
set ucitrack.minidlna.init=minidlna
commit ucitrack
EOF

exit 0
15 changes: 0 additions & 15 deletions root/usr/lib/lua/luci/model/cbi/forked_daapd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@ s.anonymous = true
o = s:option(Flag, "enabled", translate("Enable"))
o.rmempty = false

function o.cfgvalue(self, section)
return luci.sys.init.enabled("forked-daapd") and self.enabled or self.disabled
end

function o.write(self, section, value)
if value == "1" then
luci.sys.init.enable("forked-daapd")
luci.sys.call("/etc/init.d/forked-daapd restart >/dev/null")
else
luci.sys.call("/etc/init.d/forked-daapd stop >/dev/null")
luci.sys.init.disable("forked-daapd")
end
return Flag.write(self, section, value)
end

servername = s:option(Value, "name", translate("Server Name"))
servername.rmempty = true
function servername.cfgvalue(self, section)
Expand Down
16 changes: 0 additions & 16 deletions root/usr/lib/lua/luci/model/cbi/minidlna.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,6 @@ s:tab("advanced", translate("Advanced Settings"))
o = s:taboption("general", Flag, "enabled", translate("Enable"))
o.rmempty = false

function o.cfgvalue(self, section)
return luci.sys.init.enabled("minidlna") and self.enabled or self.disabled
end

function o.write(self, section, value)
if value == "1" then
luci.sys.init.enable("minidlna")
luci.sys.call("/etc/init.d/minidlna start >/dev/null")
else
luci.sys.call("/etc/init.d/minidlna stop >/dev/null")
luci.sys.init.disable("minidlna")
end

return Flag.write(self, section, value)
end

o = s:taboption("general", Value, "port", translate("Port"),
translate("Port for HTTP (descriptions, SOAP, media transfer) traffic."))
o.datatype = "port"
Expand Down
19 changes: 0 additions & 19 deletions root/usr/lib/lua/luci/model/cbi/netatalk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@ s.anonymous = true
o = s:option(Flag, "enabled", translate("Enable"))
o.rmempty = false

function o.cfgvalue(self, section)
return luci.sys.init.enabled("afpd") and self.enabled or self.disabled
end

function o.write(self, section, value)
if value == "1" then
luci.sys.init.enable("afpd")
luci.sys.call("/etc/init.d/afpd start >/dev/null")
else
luci.sys.call("/etc/init.d/afpd stop >/dev/null")
luci.sys.init.disable("afpd")
end
return Flag.write(self, section, value)
end

servername = s:option(Value, "hostname", translate("Server Name"))
servername.rmempty = true
function servername.cfgvalue(self, section)
Expand Down Expand Up @@ -70,8 +55,4 @@ function path.write(self, section, value)
return Flag.write(self, section, value)
end

function m.on_commit(self,map)
require("luci.sys").call('/sbin/reload_config')
end

return m
19 changes: 1 addition & 18 deletions root/usr/lib/lua/luci/model/cbi/vsftpd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,9 @@ s:tab("anonymous",translate("Anonymous"))
s:tab("userlist",translate("User List"))
s:tab("template",translate("Template"))



enable=s:taboption("general",Flag,"enabled",translate("Enabled"))
enable.rmempty=false
function enable.cfgvalue(self,section)
return luci.sys.init.enabled("vsftpd") and self.enabled or self.disabled
end
function enable.write(self,section,value)
if value == "1" then
if running then
luci.sys.call("/etc/init.d/vsftpd stop >/dev/null")
end
luci.sys.call("/etc/init.d/vsftpd enable >/dev/null")
luci.sys.call("/etc/init.d/vsftpd start >/dev/null")
else
luci.sys.call("/etc/init.d/vsftpd stop >/dev/null")
luci.sys.call("/etc/init.d/vsftpd disable >/dev/null")
end
return Flag.write(self, section, value)
end

listen_ipv6=s:taboption("general",Flag,"listen_ipv6",translate("Allow IPv6"))
listen_ipv6.rmempty=false
banner=s:taboption("general",Value,"ftpd_banner",translate("FTP banner"))
Expand Down
4 changes: 1 addition & 3 deletions root/usr/local/sbin/nas-service
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ if echo "$SERVICES" | grep -q $1; then
enable)
/sbin/uci set $SERVICENAME.config.enabled=1
/sbin/uci commit $SERVICENAME
/etc/init.d/$SERVICENAME start
/etc/init.d/$SERVICENAME enable
/etc/init.d/$SERVICENAME restart
exit 0
;;

disable)
/sbin/uci set $SERVICENAME.config.enabled=0
/sbin/uci commit $SERVICENAME
/etc/init.d/$SERVICENAME stop
/etc/init.d/$SERVICENAME disable
exit 0
;;

Expand Down

0 comments on commit 50c8ecd

Please sign in to comment.