Skip to content

Commit

Permalink
drop lime-init framework; relocate scripts into /etc/firewall.user.d/…
Browse files Browse the repository at this point in the history
… and /etc/rc.local.d/
  • Loading branch information
altergui committed Jul 16, 2014
1 parent c415a32 commit 854c937
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 34 deletions.
5 changes: 4 additions & 1 deletion packages/lime-proto-anygw/src/anygw.lua
Expand Up @@ -53,10 +53,13 @@ function anygw.configure(args)
uci:set("network", pfr.."anygw_route4", "table", "170")
uci:save("network")

fs.mkdir("/etc/firewall.user.d")
fs.writefile(
"/etc/lime-init.d/20-anygw-ebtables.start",
"/etc/firewall.user.d/20-anygw-ebtables",
"\n" ..
"ebtables -D FORWARD -j DROP -d " .. anygw_mac .. "\n" ..
"ebtables -A FORWARD -j DROP -d " .. anygw_mac .. "\n" ..
"ebtables -t nat -D POSTROUTING -o bat0 -j DROP -s " .. anygw_mac .. "\n" ..
"ebtables -t nat -A POSTROUTING -o bat0 -j DROP -s " .. anygw_mac .. "\n"
)

Expand Down
3 changes: 2 additions & 1 deletion packages/lime-proto-bmx6/src/bmx6.lua
Expand Up @@ -109,8 +109,9 @@ function bmx6.configure(args)

-- BEGIN
-- Workaround to http://www.libre-mesh.org/issues/28
fs.mkdir("/etc/rc.local.d")
fs.writefile(
"/etc/lime-init.d/65-bmx6_dumb_workaround.start",
"/etc/rc.local.d/65-bmx6_dumb_workaround",
"((sleep 45s && /etc/init.d/bmx6 restart)&)\n")
-- END

Expand Down
26 changes: 0 additions & 26 deletions packages/lime-system/files/etc/init.d/lime-init

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/lime-system/files/etc/lime-init.d/00-example.stop

This file was deleted.

This file was deleted.

15 changes: 15 additions & 0 deletions packages/lime-system/files/usr/lib/lua/lime/firewall.lua
@@ -1,5 +1,7 @@
#!/usr/bin/lua

local fs = require("nixio.fs")

firewall = {}

function firewall.clean()
Expand Down Expand Up @@ -41,6 +43,19 @@ function firewall.configure()
uci:set("firewall", "bmxtun", "family", "ipv4")

uci:save("firewall")

fs.writefile(
"/etc/firewall.user",
"# Put your custom iptables rules in a new file in /etc/firewall.user.d/\n" ..
"# they will be executed with each firewall (re-)start.\n" ..
"# They are interpreted as shell script.\n" ..
"for hook in /etc/firewall.user.d/* ; do\n" ..
"\t[ -s \"$hook\" ] && /bin/sh \"$hook\"\n" ..
"done\n" ..
"exit 0\n"
)


end

return firewall
11 changes: 11 additions & 0 deletions packages/lime-system/files/usr/lib/lua/lime/system.lua
Expand Up @@ -31,6 +31,17 @@ function system.configure()
uci:set("uhttpd", "main", "listen_http", "80")
uci:set("uhttpd", "main", "listen_https", "443")
uci:save("uhttpd")

fs.writefile(
"/etc/rc.local",
"# Put your custom commands in a new file in /etc/rc.local.d/\n" ..
"# that should be executed once the system init finished.\n" ..
"for hook in /etc/rc.local.d/* ; do\n" ..
"\t[ -s \"$hook\" ] && /bin/sh \"$hook\"\n" ..
"done\n" ..
"exit 0\n"
)

end

function system.apply()
Expand Down

0 comments on commit 854c937

Please sign in to comment.