diff --git a/.gitignore b/.gitignore index 6950816..8d23dc6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ updateFiles.bat .vscode/ libGUI/libGUI/widget/Keypad.lua /misc/ -/pm/testpackages \ No newline at end of file +/pm/testpackages +/packages/.prop \ No newline at end of file diff --git a/packages/autocrafter.tar b/packages/autocrafter.tar new file mode 100644 index 0000000..67b2ce5 Binary files /dev/null and b/packages/autocrafter.tar differ diff --git a/packages/bank_account_maker.tar b/packages/bank_account_maker.tar new file mode 100644 index 0000000..ad1558a Binary files /dev/null and b/packages/bank_account_maker.tar differ diff --git a/packages/bank_api.tar b/packages/bank_api.tar new file mode 100644 index 0000000..7900c8c Binary files /dev/null and b/packages/bank_api.tar differ diff --git a/packages/bank_atm.tar b/packages/bank_atm.tar new file mode 100644 index 0000000..7954c43 Binary files /dev/null and b/packages/bank_atm.tar differ diff --git a/packages/bank_client.tar b/packages/bank_client.tar new file mode 100644 index 0000000..64f640d Binary files /dev/null and b/packages/bank_client.tar differ diff --git a/packages/bank_dev_tools.tar b/packages/bank_dev_tools.tar new file mode 100644 index 0000000..f083c4a Binary files /dev/null and b/packages/bank_dev_tools.tar differ diff --git a/packages/bank_server.tar b/packages/bank_server.tar new file mode 100644 index 0000000..1f436cf Binary files /dev/null and b/packages/bank_server.tar differ diff --git a/packages/crypttool.tar b/packages/crypttool.tar new file mode 100644 index 0000000..809b676 Binary files /dev/null and b/packages/crypttool.tar differ diff --git a/packages/dns_common.tar b/packages/dns_common.tar new file mode 100644 index 0000000..64f5e26 Binary files /dev/null and b/packages/dns_common.tar differ diff --git a/packages/dns_server.tar b/packages/dns_server.tar new file mode 100644 index 0000000..2cd3a78 Binary files /dev/null and b/packages/dns_server.tar differ diff --git a/packages/door_ctrl.tar b/packages/door_ctrl.tar new file mode 100644 index 0000000..847ebf1 Binary files /dev/null and b/packages/door_ctrl.tar differ diff --git a/packages/instgen.tar b/packages/instgen.tar new file mode 100644 index 0000000..d1973f0 Binary files /dev/null and b/packages/instgen.tar differ diff --git a/packages/item_id_catcher.tar b/packages/item_id_catcher.tar new file mode 100644 index 0000000..0dfac5c Binary files /dev/null and b/packages/item_id_catcher.tar differ diff --git a/packages/libcb.tar b/packages/libcb.tar new file mode 100644 index 0000000..107e576 Binary files /dev/null and b/packages/libcb.tar differ diff --git a/packages/libclass.tar b/packages/libclass.tar new file mode 100644 index 0000000..6d302f0 Binary files /dev/null and b/packages/libclass.tar differ diff --git a/packages/libcoin.tar b/packages/libcoin.tar new file mode 100644 index 0000000..47a42be Binary files /dev/null and b/packages/libcoin.tar differ diff --git a/packages/libgui.tar b/packages/libgui.tar new file mode 100644 index 0000000..b3ac256 Binary files /dev/null and b/packages/libgui.tar differ diff --git a/packages/libgui_extra.tar b/packages/libgui_extra.tar new file mode 100644 index 0000000..9eb18e3 Binary files /dev/null and b/packages/libgui_extra.tar differ diff --git a/packages/libtar.tar b/packages/libtar.tar new file mode 100644 index 0000000..724c18e Binary files /dev/null and b/packages/libtar.tar differ diff --git a/packages/lnfsc.tar b/packages/lnfsc.tar new file mode 100644 index 0000000..c587b6e Binary files /dev/null and b/packages/lnfsc.tar differ diff --git a/packages/lnfss.tar b/packages/lnfss.tar new file mode 100644 index 0000000..9e50eee Binary files /dev/null and b/packages/lnfss.tar differ diff --git a/packages/manifest b/packages/manifest new file mode 100644 index 0000000..6fe8349 --- /dev/null +++ b/packages/manifest @@ -0,0 +1,340 @@ +{ + ["bank_api"] = { + ["manifestVersion"] = "1.0", + ["package"] = "bank_api", + ["version"] = "oppm", + ["name"] = "Bank API", + ["repo"] = "tree/master/bank_api", + ["description"] = "API used to send request to the bank server", + ["note"] = "You will need to set the server address", + ["authors"] = "AR2000AR", + ["archiveName"] = "bank_api.tar" + }, + ["libcb"] = { + ["manifestVersion"] = "1.0", + ["package"] = "libcb", + ["version"] = "oppm", + ["name"] = "libCB", + ["repo"] = "tree/master/libCB", + ["description"] = "library used to read and write CB", + ["note"] = "CB are unmanaged floppies", + ["authors"] = "AR2000AR", + ["archiveName"] = "libcb.tar" + }, + ["bank_dev_tools"] = { + ["manifestVersion"] = "1.0", + ["package"] = "bank_dev_tools", + ["version"] = "oppm", + ["name"] = "bank_dev_tools", + ["repo"] = "tree/master/bank_dev_tools", + ["description"] = "collection of tools used to help in the bank software development", + ["note"] = "DEV ONLY", + ["authors"] = "AR2000AR", + ["archiveName"] = "bank_dev_tools.tar" + }, + ["bank_server"] = { + ["manifestVersion"] = "1.0", + ["package"] = "bank_server", + ["version"] = "oppm", + ["name"] = "Bank server", + ["repo"] = "tree/master/bank_server", + ["description"] = "The bank server service", + ["note"] = "enable it with the rc command", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["libcb"] = "oppm" + }, + ["archiveName"] = "bank_server.tar" + }, + ["libgui"] = { + ["manifestVersion"] = "1.0", + ["package"] = "libgui", + ["version"] = "oppm", + ["name"] = "libGUI", + ["repo"] = "tree/master/libGUI", + ["description"] = "library used to create gui \n The library can load \"pam\" images", + ["note"] = "transparency in pam image isn't fully supported. Only fully transparent pixel are recognized as such", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["libclass"] = "oppm" + }, + ["archiveName"] = "libgui.tar" + }, + ["libgui_extra"] = { + ["manifestVersion"] = "1.0", + ["package"] = "libgui_extra", + ["version"] = "oppm", + ["name"] = "libGUI-extra", + ["repo"] = "tree/master/libGUI-extra", + ["description"] = "more widgets for the libGUI", + ["authors"] = "AR2000AR, thofi", + ["dependencies"] = { + ["libgui"] = "oppm" + }, + ["archiveName"] = "libgui_extra.tar" + }, + ["bank_client"] = { + ["manifestVersion"] = "1.0", + ["package"] = "bank_client", + ["version"] = "oppm", + ["name"] = "bank client app", + ["repo"] = "tree/master/bank_client", + ["description"] = "The client app for the banker", + ["note"] = "WIP", + ["authors"] = "AR2000AR, thofi", + ["dependencies"] = { + ["libgui"] = "oppm", + ["libgui_extra"] = "oppm", + ["bank_api"] = "oppm", + ["libcb"] = "oppm" + }, + ["archiveName"] = "bank_client.tar" + }, + ["item_id_catcher"] = { + ["manifestVersion"] = "1.0", + ["package"] = "item_id_catcher", + ["version"] = "oppm", + ["name"] = "itemIdCatcher", + ["repo"] = "tree/master/itemIdCatcher", + ["description"] = "Write id of item in the chest on the top to a file", + ["note"] = "item are moved to a other chest", + ["authors"] = "AR2000AR", + ["archiveName"] = "item_id_catcher.tar" + }, + ["libclass"] = { + ["manifestVersion"] = "1.0", + ["package"] = "libclass", + ["version"] = "oppm", + ["name"] = "libClass", + ["repo"] = "tree/master/libClass", + ["description"] = "Class library for lua", + ["authors"] = "AR2000AR", + ["archiveName"] = "libclass.tar" + }, + ["libcoin"] = { + ["manifestVersion"] = "1.0", + ["package"] = "libcoin", + ["version"] = "oppm", + ["name"] = "libCoin", + ["repo"] = "tree/master/libCoin", + ["description"] = "small library used to moved coins from ordinarycoins from one chest to a other", + ["authors"] = "AR2000AR", + ["archiveName"] = "libcoin.tar" + }, + ["bank_atm"] = { + ["manifestVersion"] = "1.0", + ["package"] = "bank_atm", + ["version"] = "oppm", + ["name"] = "bank atm", + ["repo"] = "tree/master/bank_atm", + ["description"] = "atm that work with my bank server", + ["authors"] = "AR200AR", + ["dependencies"] = { + ["libgui"] = "oppm", + ["bank_api"] = "oppm", + ["libcb"] = "oppm", + ["libcoin"] = "oppm", + ["libgui_extra"] = "oppm" + }, + ["archiveName"] = "bank_atm.tar" + }, + ["door_ctrl"] = { + ["manifestVersion"] = "1.0", + ["package"] = "door_ctrl", + ["version"] = "oppm", + ["name"] = "Door controller", + ["repo"] = "tree/master/doorCtrl", + ["description"] = "Controll your doors with multiple redstone io block", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["libgui"] = "oppm", + ["libclass"] = "oppm" + }, + ["configFiles"] = { + "/etc/doorCtrl.conf" + }, + ["archiveName"] = "door_ctrl.tar" + }, + ["autocrafter"] = { + ["manifestVersion"] = "1.0", + ["package"] = "autocrafter", + ["version"] = "oppm", + ["name"] = "AutoCrafter", + ["repo"] = "tree/master/autocrafter", + ["description"] = "User a robot linked via a linked card to craft item from a inventory", + ["authors"] = "AR200AR", + ["archiveName"] = "autocrafter.tar" + }, + ["stargate"] = { + ["manifestVersion"] = "1.0", + ["package"] = "stargate", + ["version"] = "oppm", + ["name"] = "Stargate Ctl", + ["repo"] = "tree/master/stargate_crl", + ["description"] = "GUI to controll stargates from SGCraft", + ["authors"] = "AR2000AR", + ["archiveName"] = "stargate.tar" + }, + ["vending"] = { + ["manifestVersion"] = "1.0", + ["package"] = "vending", + ["version"] = "oppm", + ["name"] = "Vending", + ["repo"] = "tree/master/vending", + ["description"] = "Vending machine program compatible with libCoin and bank_api", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["libCoin"] = "oppm", + ["bank_api"] = "oppm" + }, + ["archiveName"] = "vending.tar" + }, + ["bank_account_maker"] = { + ["manifestVersion"] = "1.0", + ["package"] = "bank_account_maker", + ["version"] = "oppm", + ["name"] = "Account maker", + ["repo"] = "tree/master/account_maker", + ["description"] = "Machine to create one account per player and dispense a credit card", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["bank_api"] = "oppm" + }, + ["archiveName"] = "bank_account_maker.tar" + }, + ["lnfsc"] = { + ["manifestVersion"] = "1.0", + ["package"] = "lnfsc", + ["version"] = "oppm", + ["name"] = "Lua Network File System Client", + ["repo"] = "tree/master/lnfs", + ["description"] = "Let you mount a files ystem hosted by a other computer using lnfss and use it as if it was a local file system", + ["authors"] = "AR2000AR", + ["archiveName"] = "lnfsc.tar" + }, + ["lnfss"] = { + ["manifestVersion"] = "1.0", + ["package"] = "lnfss", + ["version"] = "oppm", + ["name"] = "Lua Network File System Server", + ["repo"] = "tree/master/lnfs", + ["description"] = "Share your local file system with other computers. Root folder is configurable in rc.cfg", + ["authors"] = "AR2000AR", + ["archiveName"] = "lnfss.tar" + }, + ["instgen"] = { + ["manifestVersion"] = "1.0", + ["package"] = "instgen", + ["version"] = "oppm", + ["name"] = "Repo installer", + ["repo"] = "tree/master/repo-installer", + ["description"] = "A set of tools for making installable floppies for OpenComputers from OPPM repositories.", + ["authors"] = "Izaya, AR2000AR", + ["archiveName"] = "instgen.tar" + }, + ["crypttool"] = { + ["manifestVersion"] = "1.0", + ["package"] = "crypttool", + ["version"] = "oppm", + ["name"] = "CryptTool", + ["repo"] = "tree/master/crypttol", + ["description"] = "Remount a filesystem and store everything as encrypted data. Use managed (default) floppy or HDD", + ["authors"] = "AR2000AR", + ["archiveName"] = "crypttool.tar" + }, + ["osinetwork"] = { + ["manifestVersion"] = "1.0", + ["package"] = "osinetwork", + ["version"] = "oppm", + ["name"] = "OSI Network stack", + ["repo"] = "tree/master/network", + ["description"] = "A close to official rfc emulation of the OSI layers for OpenOS. Include Ethernet, ARP, ICMP, UDP. Also provide a luasocket libe librairy", + ["note"] = "Are provided : ping, ifup, ifdown, arp, nc, netstat. Any one of theses tools may be moved to a separate package at any time", + ["authors"] = "AR2000AR", + ["configFiles"] = { + "/etc/network/interfaces" + }, + ["archiveName"] = "osinetwork.tar" + }, + ["dns_common"] = { + ["manifestVersion"] = "1.0", + ["package"] = "dns_common", + ["version"] = "oppm", + ["name"] = "DNS common files", + ["repo"] = "tree/master/dns_common", + ["description"] = "basic files used by the dns server as well as the resolver library", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["osinetwork"] = "oppm" + }, + ["configFiles"] = { + "/etc/resolv.conf" + }, + ["archiveName"] = "dns_common.tar" + }, + ["dns_server"] = { + ["manifestVersion"] = "1.0", + ["package"] = "dns_server", + ["version"] = "oppm", + ["name"] = "DNS server daemon", + ["repo"] = "tree/master/dns_server", + ["description"] = "this package provide the dns server", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["dns_common"] = "oppm" + }, + ["archiveName"] = "dns_server.tar" + }, + ["nslookup"] = { + ["manifestVersion"] = "1.0", + ["package"] = "nslookup", + ["version"] = "oppm", + ["name"] = "nslookup", + ["repo"] = "tree/master/nslookup", + ["description"] = "cmd line tool to querry a name server", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["dns_common"] = "oppm" + }, + ["archiveName"] = "nslookup.tar" + }, + ["libtar"] = { + ["manifestVersion"] = "1.0", + ["package"] = "libtar", + ["version"] = "1.1.0", + ["name"] = "libtar", + ["repo"] = "tree/master/tar", + ["description"] = "Librairy to extract and list the content of tar archive", + ["authors"] = "AR2000AR, luarock", + ["archiveName"] = "libtar.tar" + }, + ["pm"] = { + ["manifestVersion"] = "1.0", + ["package"] = "pm", + ["version"] = "1.2.2", + ["name"] = "pm Package Manager", + ["repo"] = "tree/master/pm", + ["description"] = "Package manager for OpenOS", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["libtar"] = "oppm" + }, + ["archiveName"] = "pm.tar" + }, + ["pm_get"] = { + ["manifestVersion"] = "1.0", + ["package"] = "pm_get", + ["version"] = "1.2.0", + ["name"] = "pm get", + ["repo"] = "tree/master/pm", + ["description"] = "Download and install package for pm", + ["authors"] = "AR2000AR", + ["dependencies"] = { + ["pm"] = "oppm" + }, + ["configFiles"] = { + "/etc/pm/sources.list" + }, + ["archiveName"] = "pm_get.tar" + } +} \ No newline at end of file diff --git a/packages/nslookup.tar b/packages/nslookup.tar new file mode 100644 index 0000000..46fcc68 Binary files /dev/null and b/packages/nslookup.tar differ diff --git a/packages/osinetwork.tar b/packages/osinetwork.tar new file mode 100644 index 0000000..fe7aaa6 Binary files /dev/null and b/packages/osinetwork.tar differ diff --git a/packages/pm.tar b/packages/pm.tar new file mode 100644 index 0000000..f6f3e49 Binary files /dev/null and b/packages/pm.tar differ diff --git a/packages/pm_get.tar b/packages/pm_get.tar new file mode 100644 index 0000000..5a6ecaa Binary files /dev/null and b/packages/pm_get.tar differ diff --git a/packages/stargate.tar b/packages/stargate.tar new file mode 100644 index 0000000..6c152f9 Binary files /dev/null and b/packages/stargate.tar differ diff --git a/packages/vending.tar b/packages/vending.tar new file mode 100644 index 0000000..589c42a Binary files /dev/null and b/packages/vending.tar differ diff --git a/pm_get/bin/pm-get.lua b/pm_get/bin/pm-get.lua index 5dcdcc5..f5dd2c0 100644 --- a/pm_get/bin/pm-get.lua +++ b/pm_get/bin/pm-get.lua @@ -12,7 +12,7 @@ local internet local DOWNLOAD_DIR = "/home/.pm-get/" --can't use /tmp as some archive can be bigger than the tmpfs local CONFIG_DIR = "/etc/pm/" --share the config directory with the rest of the package manager local SOURCE_FILE = CONFIG_DIR .. "sources.list" -local SOURCE_DIR = CONFIG_DIR .. SOURCE_FILE .. ".d/" +local SOURCE_DIR = SOURCE_FILE .. ".d/" local REPO_MANIFEST_CACHE = CONFIG_DIR .. "manifests.cache" local AUTO_INSTALLED = CONFIG_DIR .. "automaticlyInstalled" @@ -40,23 +40,35 @@ local function getSources() if (filesystem.exists(SOURCE_FILE) and not filesystem.isDirectory(SOURCE_FILE)) then file = assert(io.open(SOURCE_FILE)) for url in file:lines() do - table.insert(sources, url) + if (not url:sub(1, 1) ~= "#") then + table.insert(sources, url) + end end file:close() end - if (not filesystem.isDirectory(SOURCE_DIR)) then return sources end - for fileName in filesystem.list(SOURCE_DIR) do - file = assert(io.open(SOURCE_DIR .. fileName)) - for url in file:lines() do - table.insert(sources, url) + if (filesystem.isDirectory(SOURCE_DIR)) then + for fileName in filesystem.list(SOURCE_DIR) do + if (fileName:match("%.list")) then + file = assert(io.open(SOURCE_DIR .. fileName)) + for url in file:lines() do + if (not url:sub(1, 1) ~= "#") then + table.insert(sources, 1, url) + end + end + file:close() + end + end + end + for i, url in pairs(sources) do + if (url:match("^https://github.com/")) then + sources[i] = url:gsub("https://github.com/", "https://raw.githubusercontent.com/"):gsub("/tree/", "/"):gsub("/blob/", "/") end - file:close() end return sources end ---@return table> -local function getRepoList() +local function getPackageList() if (not reposRuntimeCache) then if (not filesystem.exists(REPO_MANIFEST_CACHE)) then printferr("No data. Run `pm-get upddate` or add repositorys") @@ -74,7 +86,7 @@ end ---@param targetRepo? string ---@return manifest? manifest, string? originRepo local function getPacket(name, targetRepo) - for repoName, repo in pairs(getRepoList()) do + for repoName, repo in pairs(getPackageList()) do if (not targetRepo or repoName == targetRepo) then if (repo[name]) then return repo[name], repoName @@ -223,7 +235,6 @@ local function update() local repos = getSources() local manifests = {} for _, repoURL in pairs(repos) do - printf("Found repository : %s", repoURL) local request = internet.request(repoURL .. "/manifest") local ready, reason repeat @@ -231,19 +242,22 @@ local function update() until ready or reason if (not ready) then printferr("Could not get manifest from %s\ns", repoURL, reason) - end - local data = "" - repeat - local read = request.read() - if (read) then data = data .. read end - until not read - request.close() - local pcalled - pcalled, data = pcall(serialization.unserialize, data) - if (pcalled == false) then - printferr("Invalid manifest for %s", repoURL) + request.close() else - manifests[repoURL] = data + printf("Found repository : %s", repoURL) + local data = "" + repeat + local read = request.read() + if (read) then data = data .. read end + until not read + request.close() + local pcalled + pcalled, data = pcall(serialization.unserialize, data) + if (pcalled == false) then + printferr("Invalid manifest for %s", repoURL) + else + manifests[repoURL] = data + end end end io.open(REPO_MANIFEST_CACHE, "w"):write(serialization.serialize(manifests)):close() @@ -287,7 +301,7 @@ if (mode == "update") then update() elseif (mode == "list") then args[1] = args[1] or ".*" - for repoName, repo in pairs(getRepoList()) do + for repoName, repo in pairs(getPackageList()) do for package, manifest in pairs(repo) do if (package:match("^" .. args[1])) then printf("%s (%s)", package, manifest.version) @@ -374,6 +388,19 @@ elseif (mode == "upgrade") then for _, pkg in pairs(toUpgrade) do install(pkg, false) end +elseif (mode == "sources") then + if (args[1] == "list") then + local sources = getSources() + for _, s in pairs(sources) do + print(s) + end + elseif (args[1] == "add" and args[2]) then + --TODO check if exists + filesystem.makeDirectory(SOURCE_DIR) + assert(io.open(SOURCE_DIR .. "/custom.list", "a")):write(args[2] .. "\n"):close() + else + print("pm-get sources add|list") + end else printHelp() os.exit(0) diff --git a/pm_get/etc/pm/sources.list b/pm_get/etc/pm/sources.list index e69de29..9a98b9e 100644 --- a/pm_get/etc/pm/sources.list +++ b/pm_get/etc/pm/sources.list @@ -0,0 +1 @@ +https://github.com/AR2000AR/openComputers_codes/tree/master/packages \ No newline at end of file diff --git a/programs.cfg b/programs.cfg index 763c9ab..4b2747f 100644 --- a/programs.cfg +++ b/programs.cfg @@ -317,7 +317,7 @@ dependencies = { ["pm"] = "/" }, - version = "1.1.1" + version = "1.2.0" name = "pm get", description = "Download and install package for pm", authors = "AR2000AR",