mirror of https://github.com/aredn/aredn.git
Immediatley run service check code when installing/removing package
This commit is contained in:
parent
d16e9e4f90
commit
1e78f85edc
|
@ -567,6 +567,14 @@ end
|
||||||
|
|
||||||
local meshpkgs = capture("grep -q \".local.mesh\" /etc/opkg/distfeeds.conf"):chomp()
|
local meshpkgs = capture("grep -q \".local.mesh\" /etc/opkg/distfeeds.conf"):chomp()
|
||||||
|
|
||||||
|
function update_advertised_services()
|
||||||
|
local script = "/etc/cron.hourly/check-services"
|
||||||
|
local stat = nixio.fs.stat(script)
|
||||||
|
if stat.type == "reg" and nixio.bit.band(tonumber(stat.modedec, 8), tonumber(111, 8)) ~= 0 then
|
||||||
|
os.execute("(cd /tmp;" .. script .. " 2>&1 | logger -p daemon.debug -t " .. script .. ")&")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- upload package
|
-- upload package
|
||||||
if parms.button_ul_pkg and nixio.fs.stat("/tmp/web/upload/file") then
|
if parms.button_ul_pkg and nixio.fs.stat("/tmp/web/upload/file") then
|
||||||
os.execute("mv -f /tmp/web/upload/file /tmp/web/upload/newpkg.ipk")
|
os.execute("mv -f /tmp/web/upload/file /tmp/web/upload/newpkg.ipk")
|
||||||
|
@ -583,6 +591,8 @@ if parms.button_ul_pkg and nixio.fs.stat("/tmp/web/upload/file") then
|
||||||
nixio.fs.remove("/tmp/web/upload/newpkg.ipk")
|
nixio.fs.remove("/tmp/web/upload/newpkg.ipk")
|
||||||
if os.execute("/usr/local/bin/uploadctlservices restore > /dev/null 2>&1") ~= 0 then
|
if os.execute("/usr/local/bin/uploadctlservices restore > /dev/null 2>&1") ~= 0 then
|
||||||
pkgout("Failed to restart all services, please reboot this node.")
|
pkgout("Failed to restart all services, please reboot this node.")
|
||||||
|
else
|
||||||
|
update_advertised_services()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -600,6 +610,8 @@ if parms.button_dl_pkg and parms.dl_pkg ~= "default" then
|
||||||
pkgout(result)
|
pkgout(result)
|
||||||
if os.execute("/usr/local/bin/uploadctlservices restore > /dev/null 2>&1") ~= 0 then
|
if os.execute("/usr/local/bin/uploadctlservices restore > /dev/null 2>&1") ~= 0 then
|
||||||
pkgout("Failed to restart all services, please reboot this node.")
|
pkgout("Failed to restart all services, please reboot this node.")
|
||||||
|
else
|
||||||
|
update_advertised_services()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
pkgout("Error: no route to Host")
|
pkgout("Error: no route to Host")
|
||||||
|
@ -622,6 +634,7 @@ if parms.button_rm_pkg and parms.rm_pkg ~= "default" and not permpkg[parms.rm_pk
|
||||||
pkgout(output)
|
pkgout(output)
|
||||||
if not output:match("No packages removed") then
|
if not output:match("No packages removed") then
|
||||||
pkgout("Package removed successfully")
|
pkgout("Package removed successfully")
|
||||||
|
update_advertised_services()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue