1
0
mirror of https://github.com/AR2000AR/openComputers_codes.git synced 2025-09-04 12:45:58 +02:00

[pm] bootstrap floppy

This commit is contained in:
2023-06-26 17:49:45 +02:00
parent 8c476968e9
commit e61428e3fc
7 changed files with 87 additions and 1 deletions

View File

@@ -45,7 +45,9 @@ Command line tool for dns resolution
---
## PM Package manager
`oppm` is good. No denying it. But it has it's limitations. The main one for me : requiring a github repository (ironic I know).\
To fix this issue, I created a package format using tar as container.
To fix this issue, I created a package format using tar as container.\
You can find instructions to make a installation floppy [here](pm_installer/)
### [pm](pm/)
The package manager. Install, uninstall and keep track of installed packages.

View File

@@ -4,6 +4,10 @@ Package manager for OpenOS. Use tar archive as package container
## Installation
- run `oppm install pm`
or
Create a installation floppy. Installation and script can be found [here](../pm_installer/).
## Usage
**Install a package :**\

View File

@@ -1,6 +1,13 @@
# pm_get
Download and install pm packages from a repository on internet.
## Installation
- run `oppm install pm`
or
Create a installation floppy. Installation and script can be found [here](../pm_installer/).
## Usage :
- `pm-get install <package>` : install the package
- `pm-get uninstall <package> [--autoremove] [--purge]` : uninstall the package. Optionally remove configurations files and/or old dependance no longer needed

7
pm_installer/README.md Normal file
View File

@@ -0,0 +1,7 @@
# PM installation floppy creation tool
## Usage :
- Insert a empty floppy
- run `wget https://github.com/AR2000AR/openComputers_codes/raw/master/pm_installer/download.lua /tmp/pmInstaller.lua`
- run `/tmp/pmInstaller.lua <floppyPath>`. Do not forget to replace `<floppyPath>` with the empty floppy's path
You now have a installation floppy for `pm` and `pm-get`. You can install them with `install`

38
pm_installer/download.lua Normal file
View File

@@ -0,0 +1,38 @@
local shell = require("shell")
local filesystem = require("filesystem")
local os = require("os")
local floppy = ''
local baseURL = 'https://github.com/AR2000AR/openComputers_codes/raw/master/'
local function wget(...)
shell.execute(table.concat({"wget -f", ...}, " "))
end
local function mkdir(...)
shell.execute(table.concat({"mkdir", ...}, " "))
end
local f = string.format
local function concatPath(...) return table.concat({...}, '/') end
local args, opts = shell.parse(...)
if (not filesystem.exists(args[1]) or not filesystem.isDirectory(args[1])) then
print("No target for the installation disk creation")
os.exit(1)
end
floppy = args[1]
mkdir(concatPath(floppy, 'bin'))
mkdir(concatPath(floppy, 'lib'))
local files = {
['pm_get/bin/pm-get.lua'] = 'bin/pm-get.lua',
['pm/bin/pm.lua'] = 'bin/pm.lua',
['pm/lib/pm.lua'] = 'lib/pm.lua',
['tar/lib/tar.lua'] = 'lib/tar.lua',
['pm_installer/floppy/.install'] = '.install',
['pm_installer/floppy/.prop'] = '.prop',
['packages/pm.tar'] = 'pm.tar',
['packages/pm_get.tar'] = 'pm_get.tar',
['packages/libtar.tar'] = 'libtar.tar',
}
for src, dst in pairs(files) do
wget(concatPath(baseURL, src), concatPath(floppy, dst))
end

View File

@@ -0,0 +1,27 @@
local shell = require("shell")
local package = require("package")
local component = require("component")
local filesystem = require("filesystem")
local FROM = _ENV.install.from
local exists = filesystem.exists
--init path
local oldPackagePath = package.path
package.path = table.concat({oldPackagePath, string.format("%s/lib/?.lua", FROM)}, ";")
--install
if (exists(FROM .. "libtar.tar") and exists(FROM .. "pm.tar")) then
shell.execute(FROM .. "bin/pm install --allow-same-version " .. FROM .. "libtar.tar")
shell.execute(FROM .. "bin/pm install --allow-same-version " .. FROM .. "pm.tar")
end
if (component.isAvailable("internet")) then
shell.execute(FROM .. "bin/pm install --allow-same-version " .. FROM .. "pm_get.tar")
shell.execute("pm-get update")
shell.execute("pm-get upgrade")
end
--reset path
package.path = oldPackagePath

View File

@@ -0,0 +1 @@
{label='Package Manager', setlabel=false, setboot=false, reboot=false}