mirror of https://github.com/aredn/aredn.git
Automatically update package dependencies if package install fails (#300)
This commit is contained in:
parent
f9b787c604
commit
57f81e48cc
|
@ -567,11 +567,20 @@ if nixio.fs.stat("/etc/permpkg") then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local meshpkgs = capture("grep -q \".local.mesh\" /etc/opkg/distfeeds.conf"):chomp()
|
||||||
|
|
||||||
-- 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")
|
||||||
os.execute("/usr/local/bin/uploadctlservices opkginstall > /dev/null 2>&1")
|
os.execute("/usr/local/bin/uploadctlservices opkginstall > /dev/null 2>&1")
|
||||||
pkgout(capture("opkg -force-overwrite install /tmp/web/upload/newpkg.ipk 2>&1"))
|
local result = capture("opkg -force-overwrite install /tmp/web/upload/newpkg.ipk 2>&1")
|
||||||
|
if result:match("satisfy_dependencies_for:") then
|
||||||
|
-- dependency failure - silently update dependencies and try again
|
||||||
|
os.execute("opkg update > /dev/null 2>&1")
|
||||||
|
os.execute("opkg list | grep -v '^ ' | cut -f1,3 -d' ' | gzip -c > /etc/opkg.list.gz")
|
||||||
|
result = capture("opkg -force-overwrite install /tmp/web/upload/newpkg.ipk 2>&1")
|
||||||
|
end
|
||||||
|
pkgout(result)
|
||||||
os.execute("rm -rf /tmp/opkg-*")
|
os.execute("rm -rf /tmp/opkg-*")
|
||||||
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
|
||||||
|
@ -580,7 +589,6 @@ if parms.button_ul_pkg and nixio.fs.stat("/tmp/web/upload/file") then
|
||||||
end
|
end
|
||||||
|
|
||||||
-- download package
|
-- download package
|
||||||
local meshpkgs = capture("grep -q \".local.mesh\" /etc/opkg/distfeeds.conf"):chomp()
|
|
||||||
if parms.button_dl_pkg and parms.dl_pkg ~= "default" then
|
if parms.button_dl_pkg and parms.dl_pkg ~= "default" then
|
||||||
if get_default_gw() ~= "none" or meshpkgs ~= "" then
|
if get_default_gw() ~= "none" or meshpkgs ~= "" then
|
||||||
os.execute("/usr/local/bin/uploadctlservices opkginstall > /dev/null 2>&1")
|
os.execute("/usr/local/bin/uploadctlservices opkginstall > /dev/null 2>&1")
|
||||||
|
|
Loading…
Reference in New Issue