This commit is contained in:
parent
bc0f759850
commit
4f545783ac
19
src/ckg.lua
19
src/ckg.lua
|
@ -85,7 +85,14 @@ local function install_single(name, list, installed)
|
||||||
if installed[name] then return end
|
if installed[name] then return end
|
||||||
local pkg = list[name]
|
local pkg = list[name]
|
||||||
if not pkg then
|
if not pkg then
|
||||||
error("Package not found: " .. name)
|
local cfg = load_config()
|
||||||
|
print("Package not found. Updating repositories...")
|
||||||
|
CKG.update()
|
||||||
|
list = fetch_package_lists(cfg)
|
||||||
|
pkg = list[name]
|
||||||
|
if not pkg then
|
||||||
|
error("Package still not found: " .. name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if pkg.dependencies then
|
if pkg.dependencies then
|
||||||
|
@ -129,7 +136,13 @@ function CKG.fetch(name)
|
||||||
local list = fetch_package_lists(cfg)
|
local list = fetch_package_lists(cfg)
|
||||||
local pkg = list[name]
|
local pkg = list[name]
|
||||||
if not pkg then
|
if not pkg then
|
||||||
error("Package not found: " .. name)
|
print("Package not found. Updating repositories...")
|
||||||
|
CKG.update()
|
||||||
|
list = fetch_package_lists(cfg)
|
||||||
|
pkg = list[name]
|
||||||
|
if not pkg then
|
||||||
|
error("Package still not found: " .. name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if not fs.exists(CACHE_DIR) then fs.makeDir(CACHE_DIR) end
|
if not fs.exists(CACHE_DIR) then fs.makeDir(CACHE_DIR) end
|
||||||
local cache_path = fs.combine(CACHE_DIR, name)
|
local cache_path = fs.combine(CACHE_DIR, name)
|
||||||
|
@ -253,4 +266,4 @@ Usage:
|
||||||
ckg clear-repos Reset repositories to default
|
ckg clear-repos Reset repositories to default
|
||||||
ckg update Refresh package indexes
|
ckg update Refresh package indexes
|
||||||
]])
|
]])
|
||||||
end
|
end
|
Loading…
Reference in New Issue