diff options
Diffstat (limited to 'libs/lpk')
-rw-r--r-- | libs/lpk/Makefile | 2 | ||||
-rw-r--r-- | libs/lpk/luasrc/lpk.lua | 41 | ||||
-rw-r--r-- | libs/lpk/luasrc/lpk/core.lua | 107 | ||||
-rw-r--r-- | libs/lpk/luasrc/lpk/core/download.lua | 1 | ||||
-rw-r--r-- | libs/lpk/luasrc/lpk/core/install.lua | 16 | ||||
-rw-r--r-- | libs/lpk/luasrc/lpk/core/resolve.lua | 0 | ||||
-rw-r--r-- | libs/lpk/luasrc/lpk/core/retrieve.lua | 7 | ||||
-rw-r--r-- | libs/lpk/luasrc/lpk/core/unpack.lua | 0 | ||||
-rw-r--r-- | libs/lpk/luasrc/lpk/util.lua | 59 | ||||
-rw-r--r-- | libs/lpk/root/etc/lpk.conf | 1 | ||||
-rwxr-xr-x | libs/lpk/root/usr/bin/lpk | 2 |
11 files changed, 0 insertions, 236 deletions
diff --git a/libs/lpk/Makefile b/libs/lpk/Makefile deleted file mode 100644 index f7fac7740e..0000000000 --- a/libs/lpk/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -include ../../build/config.mk -include ../../build/module.mk diff --git a/libs/lpk/luasrc/lpk.lua b/libs/lpk/luasrc/lpk.lua deleted file mode 100644 index 7117c75f9c..0000000000 --- a/libs/lpk/luasrc/lpk.lua +++ /dev/null @@ -1,41 +0,0 @@ -module("luci.lpk", package.seeall) -require("luci.lpk.util") -require("luci.lpk.core") - -__appname__ = "LuCI »lpk« Package Manager" -__version__ = "0.1" -__authors__ = "Steven Barth, Jo-Philipp Wich" -__cpyrght__ = string.format("Copyright (c) 2008 %s", __authors__) - - -options, arguments = luci.lpk.util.getopt(arg) -config = luci.util.dtable() -machine = luci.lpk.core.Machine() - -local cfgdump = loadfile("/etc/lpk.conf") -if cfgdump then - setfenv(cfgdump, config) - pcall(cfgdump) -end - -if #arguments < 1 then - luci.lpk.util.splash() -else - local task, error = machine:task(table.remove(arguments, 1), - unpack(arguments)) - - if task then - local stat, error = task:perform() - if not stat then - luci.util.perror(error or task.register.errstr or "Unknown Error") - os.exit(task.register.error or 1) - end - else - luci.util.perror((error or "Unknown Error") .. "\n") - luci.lpk.util.splash() - os.exit(1) - end -end - - - diff --git a/libs/lpk/luasrc/lpk/core.lua b/libs/lpk/luasrc/lpk/core.lua deleted file mode 100644 index 97de4fa92e..0000000000 --- a/libs/lpk/luasrc/lpk/core.lua +++ /dev/null @@ -1,107 +0,0 @@ -module("luci.lpk.core", package.seeall) -require("luci.util") - -Task = luci.util.class() - -function Task.__init__(self, machine, register, start) - self.machine = machine - - -- The queue that has to be processed - self.work = {start} - - -- The queue that has to be processed in case of rollback - self.done = {} - - -- The Task register - self.register = register -end - -function Task.rollback(self) - if #self.done < 1 then - return false - end - - local state = table.remove(self.done) - if not state.rollback then - return true - end - - local ret, err = pcall(state.rollback, state, self.register) - - if ret then - return true - else - return false, err - end -end - -function Task.step(self) - local state = table.remove(self.work) - local ret, next = pcall(state.process, self.register) - - if ret then - if next then - local nstate = self.machine:state(next) - if nstate then - table.insert(self.work, state) - table.insert(self.work, nstate) - else - self.register.error = 2 - self.register.errstr = "Unknown state: " .. next - return false - end - else - table.insert(self.done, state) - end - - return #self.work > 0 - else - self.register.error = next - return false - end -end - -function Task.perform(self) - while self:step() do - end - - if not self.register.error then - return true - else - local stat, err - repeat - stat, err = self:rollback() - until not stat - - if err then - self.register.errstr = err - self.register.error = 2 - end - - return false - end -end - - -Machine = luci.util.class() - -function Machine.__init__(self, namespace) - self.namespace = namespace or _NAME -end - -function Machine.state(self, name) - local ret, state = pcall(require, self.namespace .. "." .. name) - return ret and state -end - -function Machine.task(self, name, ...) - local start = self:state(name) - - if type(start) ~= "table" or not start.entry then - return false, "No such command: " .. name - end - - local register = {} - - return start.entry(register, ...) and Task(self, register, start) -end diff --git a/libs/lpk/luasrc/lpk/core/download.lua b/libs/lpk/luasrc/lpk/core/download.lua deleted file mode 100644 index 7b306479fd..0000000000 --- a/libs/lpk/luasrc/lpk/core/download.lua +++ /dev/null @@ -1 +0,0 @@ -module("luci.lpk.core.download", package.seeall) diff --git a/libs/lpk/luasrc/lpk/core/install.lua b/libs/lpk/luasrc/lpk/core/install.lua deleted file mode 100644 index 434f618324..0000000000 --- a/libs/lpk/luasrc/lpk/core/install.lua +++ /dev/null @@ -1,16 +0,0 @@ -module("luci.lpk.core.install", package.seeall) - -function entry(register, ...) - print("Requested install of " .. table.concat(arg, ", ")) - return true -end - -function process(register) - register.sometext = "Test" - if not register.retrieved then - print("Step down to retrieve") - return "retrieve" - else - print("Coming up again") - end -end
\ No newline at end of file diff --git a/libs/lpk/luasrc/lpk/core/resolve.lua b/libs/lpk/luasrc/lpk/core/resolve.lua deleted file mode 100644 index e69de29bb2..0000000000 --- a/libs/lpk/luasrc/lpk/core/resolve.lua +++ /dev/null diff --git a/libs/lpk/luasrc/lpk/core/retrieve.lua b/libs/lpk/luasrc/lpk/core/retrieve.lua deleted file mode 100644 index 6176a94b99..0000000000 --- a/libs/lpk/luasrc/lpk/core/retrieve.lua +++ /dev/null @@ -1,7 +0,0 @@ -module("luci.lpk.core.retrieve", package.seeall) - -function process(register) - print "Now in retrieve" - print (register.sometext) - register.retrieved = true -end
\ No newline at end of file diff --git a/libs/lpk/luasrc/lpk/core/unpack.lua b/libs/lpk/luasrc/lpk/core/unpack.lua deleted file mode 100644 index e69de29bb2..0000000000 --- a/libs/lpk/luasrc/lpk/core/unpack.lua +++ /dev/null diff --git a/libs/lpk/luasrc/lpk/util.lua b/libs/lpk/luasrc/lpk/util.lua deleted file mode 100644 index 95bdb965f6..0000000000 --- a/libs/lpk/luasrc/lpk/util.lua +++ /dev/null @@ -1,59 +0,0 @@ -module("luci.lpk.util", package.seeall) - -function getopt( arg, options ) - options = options or "" - local tab = {} - local args = {} - for k, v in ipairs(arg) do - if v:sub(1, 2) == "--" then - local x = v:find( "=", 1, true ) - if x then - tab[ v:sub( 3, x-1 ) ] = v:sub( x+1 ) - else - tab[ v:sub( 3 ) ] = true - end - elseif v:sub( 1, 1 ) == "-" then - local y = 2 - local l = #v - local jopt - while ( y <= l ) do - jopt = v:sub( y, y ) - if options:find( jopt, 1, true ) then - if y < l then - tab[ jopt ] = v:sub( y+1 ) - y = l - else - tab[ jopt ] = arg[ k + 1 ] - arg[ k + 1 ] = "" - end - else - tab[ jopt ] = true - end - y = y + 1 - end - elseif #v > 0 then - table.insert(args, v) - end - end - return tab, args -end - -function splash() - require("luci.lpk") - luci.util.perror(string.format("%s v%s\n%s", - luci.lpk.__appname__, luci.lpk.__version__, luci.lpk.__cpyrght__)) - luci.util.perror([[ - -Usage: - lpk [options] <command> [arguments] - lpk [options] install|remove pkg1 [pkg2] [...] [pkgn] - -Commands: - install - Install packages - remove - Remove packages - purge - Remove packages and their configuration files - -Options: - --force-depends - Ignore unresolvable dependencies -]]) -end
\ No newline at end of file diff --git a/libs/lpk/root/etc/lpk.conf b/libs/lpk/root/etc/lpk.conf deleted file mode 100644 index 7ff49f89bf..0000000000 --- a/libs/lpk/root/etc/lpk.conf +++ /dev/null @@ -1 +0,0 @@ -backend.model = "ipkg"
\ No newline at end of file diff --git a/libs/lpk/root/usr/bin/lpk b/libs/lpk/root/usr/bin/lpk deleted file mode 100755 index 6e6dcded3e..0000000000 --- a/libs/lpk/root/usr/bin/lpk +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/lua -require("luci.lpk")
\ No newline at end of file |