if there's no /etc/bat-hosts, make a symlink pointing to autogenerated tmp file

This commit is contained in:
Gui Iribarren 2013-09-22 18:50:24 -03:00
parent b44df15f0f
commit 9ef0c0caa0
2 changed files with 6 additions and 2 deletions

View file

@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk
#
PKG_NAME:=alfred
PKG_VERSION:=2013.3.0
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_MD5SUM:=018ef6262cdd11e900af31d71a864b13
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

View file

@ -65,7 +65,7 @@ local function publish_bat_hosts()
end
local function write_bat_hosts(rows)
local content = { "### File generated by alfred-mod-bat-hosts\n" }
local content = { "### File generated by alfred-bat-hosts\n" }
-- merge the chunks from all nodes, de-escaping newlines
for _, row in ipairs(rows) do
@ -80,6 +80,10 @@ local function write_bat_hosts(rows)
fd:write(table.concat(content))
fd:close()
end
-- try to make a symlink in /etc pointing to /tmp,
-- if it exists, ln will do nothing.
os.execute("ln -ns /tmp/bat-hosts /etc/bat-hosts")
end
local function receive_bat_hosts()