Compare commits
No commits in common. "4f545783ac28ea66489c22eabbffb25e44eb5cdb" and "d46c11b3a8b05aac1c4b2e75a1d9d468faa22d82" have entirely different histories.
4f545783ac
...
d46c11b3a8
23
src/ckg.lua
23
src/ckg.lua
|
@ -3,14 +3,14 @@
|
|||
Supports multiple repositories, dependency resolution, index and package caching.
|
||||
]]
|
||||
|
||||
local CKG = {}
|
||||
local PKG = {}
|
||||
|
||||
local INSTALL_DIR = "/ckg"
|
||||
local CACHE_DIR = fs.combine(INSTALL_DIR, "cache")
|
||||
local REPO_CACHE_DIR = fs.combine(CACHE_DIR, "repos")
|
||||
local CONFIG_FILE = fs.combine(INSTALL_DIR, "config.txt")
|
||||
local DEFAULT_REPOS = {
|
||||
"http://193.23.220.51:3000/p2vman/cpkg/raw/branch/main/packages.json"
|
||||
"https://example.com/repo/packages.json"
|
||||
}
|
||||
|
||||
local function load_config()
|
||||
|
@ -85,14 +85,7 @@ local function install_single(name, list, installed)
|
|||
if installed[name] then return end
|
||||
local pkg = list[name]
|
||||
if not pkg then
|
||||
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
|
||||
error("Package not found: " .. name)
|
||||
end
|
||||
|
||||
if pkg.dependencies then
|
||||
|
@ -136,13 +129,7 @@ function CKG.fetch(name)
|
|||
local list = fetch_package_lists(cfg)
|
||||
local pkg = list[name]
|
||||
if not pkg then
|
||||
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
|
||||
error("Package not found: " .. name)
|
||||
end
|
||||
if not fs.exists(CACHE_DIR) then fs.makeDir(CACHE_DIR) end
|
||||
local cache_path = fs.combine(CACHE_DIR, name)
|
||||
|
@ -266,4 +253,4 @@ Usage:
|
|||
ckg clear-repos Reset repositories to default
|
||||
ckg update Refresh package indexes
|
||||
]])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue