diff options
| author | karltk <karltk@gentoo.org> | 2003-12-08 21:21:24 +0000 |
|---|---|---|
| committer | karltk <karltk@gentoo.org> | 2003-12-08 21:21:24 +0000 |
| commit | e1e28ae986057fa550e41642d3b12507840ab115 (patch) | |
| tree | 08eb5845a56019e8cac89ae3c73bc4b64d267275 /trunk/src | |
| parent | 8437db08903cfbbd179a2d487691ae95f9c17c48 (diff) | |
| download | gentoolkit-e1e28ae986057fa550e41642d3b12507840ab115.tar.gz | |
Collected all pending updates
svn path=/; revision=43
Diffstat (limited to 'trunk/src')
| -rw-r--r-- | trunk/src/ekeyword/ekeyword.1 | 12 | ||||
| -rw-r--r-- | trunk/src/etc-update/etc-update.1 | 12 | ||||
| -rwxr-xr-x | trunk/src/gentool/gentool | 29 | ||||
| -rw-r--r-- | trunk/src/gentool/gentool.1 | 12 | ||||
| -rw-r--r-- | trunk/src/moo/AUTHORS | 1 | ||||
| -rw-r--r-- | trunk/src/moo/README | 0 | ||||
| -rw-r--r-- | trunk/src/moo/TODO | 0 | ||||
| -rwxr-xr-x | trunk/src/moo/moo | 192 | ||||
| -rw-r--r-- | trunk/src/moo/moo.1 | 12 | ||||
| -rw-r--r-- | trunk/src/revdep-rebuild/TODO | 6 | ||||
| -rw-r--r-- | trunk/src/revdep-rebuild/revdep-rebuild.1 | 12 |
11 files changed, 275 insertions, 13 deletions
diff --git a/trunk/src/ekeyword/ekeyword.1 b/trunk/src/ekeyword/ekeyword.1 new file mode 100644 index 0000000..339f4cd --- /dev/null +++ b/trunk/src/ekeyword/ekeyword.1 @@ -0,0 +1,12 @@ +.TH ekeyword "1" "Nov 2003" "gentoolkit" +.SH NAME +ekeyword \- Gentoo: ebuild Keyword Changer +.SH SYNOPSIS +.B ekeyword +.SH BUGS +This tool does not yet have a man page. Feel free to submit a bug about it to +http://bugs.gentoo.org +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg +<karltk@gentoo.org>. + diff --git a/trunk/src/etc-update/etc-update.1 b/trunk/src/etc-update/etc-update.1 new file mode 100644 index 0000000..53477d8 --- /dev/null +++ b/trunk/src/etc-update/etc-update.1 @@ -0,0 +1,12 @@ +.TH etc-update "1" "Nov 2003" "gentoolkit" +.SH NAME +etc-update \- Gentoo: Configuration Update Utility +.SH SYNOPSIS +.B etc-update +.SH BUGS +This tool does not yet have a man page. Feel free to submit a bug about it to +http://bugs.gentoo.org +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg +<karltk@gentoo.org>. + diff --git a/trunk/src/gentool/gentool b/trunk/src/gentool/gentool index c2019f5..e4148c9 100755 --- a/trunk/src/gentool/gentool +++ b/trunk/src/gentool/gentool @@ -143,7 +143,7 @@ class CmdListFiles(Command): class CmdListBelongs(Command): - """List all packages owning file_spec""" + """List all packages owning a particular file""" def __init__(self): self.default_opts = { "category": "*", @@ -219,41 +219,44 @@ class CmdListBelongs(Command): " " + yellow("-c, --category cat") + " - only search in category " + yellow("cat") + "\n" + \ " " + yellow("-e, --earlyout") + " - stop when first match found\n" -def cmdDepends(file_spec): +class CmdListDepends(Command): """List all packages directly or indirectly depending on pkgQuery""" pass -def cmdDisplayUSEs(query): +class CmdDisplayUSEs(Command): """Advanced report of a package's USE flags""" pass -def cmdDisplayDepGraph(pkgQuery): +class CmdDisplayDepGraph(Command): """Display tree graph of deps for pkgQuery""" pass -def cmdDisplayReverseDepGraph(pkgQuery): - """Display tree graph of reverse deps for pkgQuery""" - pass - -def cmdDisplayChanges(pkgQuery): +class CmdDisplayChanges(Command): """Display changes for pkgQuery""" pass -def cmdDisplaySize(pkgQuery): +class CmdDisplaySize(Command): """Display disk size consumed by pkgQuery""" pass -def cmdCheckIntegrity(pkgQuery): +class CmdCheckIntegrity(Command): """Check timestamps and md5sums for files owned by pkgQuery""" pass -def cmdPortageStatistics(): +class CmdDisplayStatistics(Command): """Display statistics about installed and uninstalled packages""" pass Known_commands = { "files": CmdListFiles(), - "belongs": CmdListBelongs() + "belongs": CmdListBelongs(), + "depends": CmdListDepends(), + "uses": CmdDisplayUSEs(), + "depgraph": CmdDisplayDepGraph(), + "changes": CmdDisplayChanges(), + "size": CmdDisplaySize(), + "check": CmdCheckIntegrity(), + "stats": CmdDisplayStatistics() } Config = { diff --git a/trunk/src/gentool/gentool.1 b/trunk/src/gentool/gentool.1 new file mode 100644 index 0000000..0f52b7f --- /dev/null +++ b/trunk/src/gentool/gentool.1 @@ -0,0 +1,12 @@ +.TH gentool "1" "Nov 2003" "gentoolkit" +.SH NAME +gentool \- Gentoo: Package Query Tool +.SH SYNOPSIS +.B gentool +.SH BUGS +This tool does not yet have a man page. Feel free to submit a bug about it to +http://bugs.gentoo.org +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg +<karltk@gentoo.org>. + diff --git a/trunk/src/moo/AUTHORS b/trunk/src/moo/AUTHORS new file mode 100644 index 0000000..fe436cb --- /dev/null +++ b/trunk/src/moo/AUTHORS @@ -0,0 +1 @@ +Karl Trygve Kalleberg <karltk@gentoo.org> diff --git a/trunk/src/moo/README b/trunk/src/moo/README new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/trunk/src/moo/README diff --git a/trunk/src/moo/TODO b/trunk/src/moo/TODO new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/trunk/src/moo/TODO diff --git a/trunk/src/moo/moo b/trunk/src/moo/moo new file mode 100755 index 0000000..5c925c5 --- /dev/null +++ b/trunk/src/moo/moo @@ -0,0 +1,192 @@ +#! /usr/bin/env python2.2 + +import os +import sys +import time +import signal + +CONFDIR="/tmp/moo" + + +def printUsage(): + print "Usage: moo <options> [command] <command-options>\n" + \ + "Where [command] is one of:\n" + \ + "scan - scan for available networks\n" + \ + "list - list available profiles\n"+ \ + "select - select a particular profile\n" + +def scanNetworks(): + pass + +def runCmd(cmd): + print "Executing \"" + cmd + "\"" + v = os.system(cmd) + print "Result: " + str(v) + +class ProfileHandler: + def __init__(self): + self.profiles = {} + self._loadProfiles() + def _loadProfiles(self): + for x in os.listdir(CONFDIR+"/profiles"): + if x[-1] != "~" and x[0] != ".": + self.profiles[x] = Profile(CONFDIR+"/profiles/"+x) + def listProfiles(self,detailed=0): + for x in self.profiles.keys(): + if detailed: + print x + ":" + self.profiles[x].dump() + else: + print x + " [" + self.profiles[x].description + "]" + def getProfileNames(self): + return self.profiles.keys() + def getProfile(self,name): + return self.profiles[name] + + +class Profile: + def __init__(self, filename): + self._loadFromFile(filename) + def _loadFromFile(self,filename): + self.desc = "" + self.ifaceName = "" + self.ip = "" + self.broadcast = "" + self.gateway = "" + self.exclusive = "no" + + ins = open(filename) + for s in ins.readlines(): + for x in ["description","ifaceName","ip","broadcast", + "gateway","exclusive"]: + if s.find(x+"=") == 0: + val=s.replace(x+"=","").strip() + self.__dict__[x] = val + def dump(self): + print "description = " + self.description + "\n" + \ + "iface = " + self.ifaceName + "\n" + \ + "ip = " + self.ip + "\n" + \ + "broadcast = " + self.broadcast + "\n" + \ + "gateway = " + self.gateway + "\n" + \ + "exclusive = " + self.exclusive + "\n" + +class Interface: + def __init__(self, name): + self.name = name + self.netmask = "" + self.broadcast = "" + self.ip = "" + self.gateway = "" + self._loadIPV4Info() + def _loadIPV4Info(self): + pass + def getNetmask(self): + return self.netmask + def getName(self): + return self.name + def getBroadcast(self): + return self.broadcast + def getGateway(self): + return self.gateway + def setGateway(self,gw): + self.gateway = gw + def setBroadcast(self,broadcast): + self.broadcast = broadcast + def setNetmask(self,netmask): + self.netmask = netmask + def runDHCP(self): + runCmd("dhcpcd " + self.name) + def down(self): + runCmd("ifconfig " + self.name + " down") + pidFile = "/var/run/dhcpcd-" + self.name + ".pid" + if os.path.exists(pidFile): + ins = open(pidFile) + pid = int(ins.readline()) + os.kill(pid,signal.SIGTERM) + time.sleep(1) + def up(self): + if self.ip: + options += self.ip + " " + if self.broadcast: + options += "broadcast " + self.broadcast + " " + if self.netmask: + options += "netmask " + self.netmask + " " + runCmd("ifconfig " + self.name + " " + options + " up") + if self.gateway: + runCmd("route add default gw " + self.gateway + " " + self.name) + +class InterfaceHandler: + def __init__(self): + self.ifaces = {} + self._loadAllInterfaces() + def _loadAllInterfaces(self): + ins=open("/proc/net/dev") + for line in ins.readlines(): + tokens = line.split() + ifaceName = tokens[0].strip() + if ifaceName[-1] == ":": + ifaceName = ifaceName[:-1] + iface = Interface(ifaceName) + self.ifaces[ifaceName] = iface + def getInterface(self,ifaceName): + return self.ifaces[ifaceName] + def downAll(self): + for x in self.ifaces.values(): + if x.getName() != "lo": + x.down() + +class Moo: + def __init__(self): + self.profileHandler = ProfileHandler() + self.ifaceHandler = InterfaceHandler() + + def selectProfile(self,profile): + prof = self.profileHandler.getProfile(profile) + + if prof.exclusive == "yes": + self.ifaceHandler.downAll() + + iface = self.ifaceHandler.getInterface(prof.ifaceName) + + if prof.ip == "dhcp": + iface.runDHCP() + else: + iface.setIPAddr(prof.ip) + iface.setBroadcast(prof.broadcast) + iface.setNetmask(prof.netmask) + iface.setGateway(prof.gateway) + iface.up() + + def listProfiles(self,detailed=0): + self.profileHandler.listProfiles(detailed) + +def main(): + if len(sys.argv) < 2: + printUsage() + sys.exit(1) + + moo = Moo() + + for i in xrange(len(sys.argv)): + if sys.argv[i] == "list": + detailed = 0 + for x in sys.argv[i:]: + if x == "--detailed": + detailed = 1 + moo.listProfiles(detailed) + + elif sys.argv[i] == "select": + moo.selectProfile(sys.argv[2]) + +if __name__ == "__main__": + main() + + +# TODO +# - automatically create profile +# - specify wireless network name +# - specify wep key +# - specify access point +# - specify pre_run/post_run commands +# - with parameters +# diff --git a/trunk/src/moo/moo.1 b/trunk/src/moo/moo.1 new file mode 100644 index 0000000..534aa0c --- /dev/null +++ b/trunk/src/moo/moo.1 @@ -0,0 +1,12 @@ +.TH moo "1" "Nov 2003" "gentoolkit" +.SH NAME +moo \- Gentoo: Configuration Update Utility +.SH SYNOPSIS +.B moo +.SH BUGS +This tool does not yet have a man page. Feel free to submit a bug about it to +http://bugs.gentoo.org +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg +<karltk@gentoo.org>. + diff --git a/trunk/src/revdep-rebuild/TODO b/trunk/src/revdep-rebuild/TODO new file mode 100644 index 0000000..7344bd5 --- /dev/null +++ b/trunk/src/revdep-rebuild/TODO @@ -0,0 +1,6 @@ +- revdep cache in /var/cache + - list all .so files this package depends on + - use timestamps of files to know when to rebuild + - if ts of cache is older than any of the package's contained + files, we must rebuild + diff --git a/trunk/src/revdep-rebuild/revdep-rebuild.1 b/trunk/src/revdep-rebuild/revdep-rebuild.1 new file mode 100644 index 0000000..9c6eea5 --- /dev/null +++ b/trunk/src/revdep-rebuild/revdep-rebuild.1 @@ -0,0 +1,12 @@ +.TH revdep-rebuild "1" "Nov 2003" "gentoolkit" +.SH NAME +revdep-rebuild \- Gentoo: Reverse dependency rebuilder +.SH SYNOPSIS +.B revdep-rebuild +.SH BUGS +This tool does not yet have a man page. Feel free to submit a bug about it to +http://bugs.gentoo.org +.SH AUTHORS +This informative man page was written by Karl Trygve Kalleberg +<karltk@gentoo.org>. + |
