From e8c070753409e859cfe6be04873466a9cf2fe703 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sat, 26 Jul 2008 22:29:09 +0000 Subject: [PATCH] luci/lpk: Initial commit --- libs/lpk/Makefile | 2 ++ libs/lpk/luasrc/lpk.lua | 38 ++++++++++++++++++++++++++++++++++ libs/lpk/luasrc/lpk/state.lua | 25 ++++++++++++++++++++++ libs/lpk/luasrc/lpk/state/install.lua | 0 libs/lpk/luasrc/lpk/state/resolve.lua | 0 libs/lpk/luasrc/lpk/state/retreive.lua | 0 6 files changed, 65 insertions(+) create mode 100644 libs/lpk/Makefile create mode 100644 libs/lpk/luasrc/lpk.lua create mode 100644 libs/lpk/luasrc/lpk/state.lua create mode 100644 libs/lpk/luasrc/lpk/state/install.lua create mode 100644 libs/lpk/luasrc/lpk/state/resolve.lua create mode 100644 libs/lpk/luasrc/lpk/state/retreive.lua diff --git a/libs/lpk/Makefile b/libs/lpk/Makefile new file mode 100644 index 000000000..f7fac7740 --- /dev/null +++ b/libs/lpk/Makefile @@ -0,0 +1,2 @@ +include ../../build/config.mk +include ../../build/module.mk diff --git a/libs/lpk/luasrc/lpk.lua b/libs/lpk/luasrc/lpk.lua new file mode 100644 index 000000000..fc2235458 --- /dev/null +++ b/libs/lpk/luasrc/lpk.lua @@ -0,0 +1,38 @@ +module("luci.lpk", package.seeall) + +function getopt( arg, options ) + 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 ] + end + else + tab[ jopt ] = true + end + y = y + 1 + end + else + table.insert(args, v) + end + end + return tab, args +end + diff --git a/libs/lpk/luasrc/lpk/state.lua b/libs/lpk/luasrc/lpk/state.lua new file mode 100644 index 000000000..29765de00 --- /dev/null +++ b/libs/lpk/luasrc/lpk/state.lua @@ -0,0 +1,25 @@ +module("luci.lpk.state", package.seeall) +require("luci.util") + +State = luci.util.class() + +function State.__init__() + self.poststates = {} + self.prestates = {} +end + +function State.add_poststate(state) + table.insert(self.poststates, state) +end + +function State.add_prestate(state) + table.insert(self.prestates, state) +end + +function State.process() + +end + +function State.handle() + +end diff --git a/libs/lpk/luasrc/lpk/state/install.lua b/libs/lpk/luasrc/lpk/state/install.lua new file mode 100644 index 000000000..e69de29bb diff --git a/libs/lpk/luasrc/lpk/state/resolve.lua b/libs/lpk/luasrc/lpk/state/resolve.lua new file mode 100644 index 000000000..e69de29bb diff --git a/libs/lpk/luasrc/lpk/state/retreive.lua b/libs/lpk/luasrc/lpk/state/retreive.lua new file mode 100644 index 000000000..e69de29bb -- 2.11.0