if there's no /etc/bat-hosts, make a symlink pointing to autogenerated tmp file
This commit is contained in:
parent
b44df15f0f
commit
9ef0c0caa0
2 changed files with 6 additions and 2 deletions
|
@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk
|
||||||
#
|
#
|
||||||
PKG_NAME:=alfred
|
PKG_NAME:=alfred
|
||||||
PKG_VERSION:=2013.3.0
|
PKG_VERSION:=2013.3.0
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
PKG_MD5SUM:=018ef6262cdd11e900af31d71a864b13
|
PKG_MD5SUM:=018ef6262cdd11e900af31d71a864b13
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
|
|
@ -65,7 +65,7 @@ local function publish_bat_hosts()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function write_bat_hosts(rows)
|
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
|
-- merge the chunks from all nodes, de-escaping newlines
|
||||||
for _, row in ipairs(rows) do
|
for _, row in ipairs(rows) do
|
||||||
|
@ -80,6 +80,10 @@ local function write_bat_hosts(rows)
|
||||||
fd:write(table.concat(content))
|
fd:write(table.concat(content))
|
||||||
fd:close()
|
fd:close()
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
local function receive_bat_hosts()
|
local function receive_bat_hosts()
|
||||||
|
|
Loading…
Reference in a new issue