diff options
-rwxr-xr-x | build_tools/l7/larch0/cli/archin.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/build_tools/l7/larch0/cli/archin.py b/build_tools/l7/larch0/cli/archin.py index 7e00831..832d883 100755 --- a/build_tools/l7/larch0/cli/archin.py +++ b/build_tools/l7/larch0/cli/archin.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # # archin.py # @@ -193,11 +194,42 @@ class Installation: if not ok: errout(_("Package installation failed")) + #cachepacks goes here + self.cache_packages=[] + cache_packs = self.add_cache_packsfile(self.profile_dir, 'cachepacks') + cachedir = "%s/var/cache/pacman/pkg/" % self.installation_dir + print cachedir + comment(" *** %s ***" % _("Installing Cache Packages")) + ok = self.pacmancall('-Sw --cachedir='+cachedir , ' '.join(self.cache_packages)) + if not ok: + errout(_("Package installation failed")) + # Some chroot scripts might need /etc/mtab runcmd('bash -c ":> %s/etc/mtab"' % self.installation_dir) # Build the final version of pacman.conf self.make_pacman_conf(True) + + #post_process goes here + comment(" *** %s ***" % _("Start of post processing")) + post_process_file="%s/post-process.sh" %self.profile_dir + #try: + if os.path.isfile(post_process_file): + cmd = "%s %s %s" %(post_process_file,self.installation_dir,self.profile_dir) + print "this is my cmd: %s" %cmd + runcmd(cmd) + else: + #except: + comment(" *** %s ***" % _("Post processing file not found")) + # pass + ##run script to post-process the new installation + #if [ -f ${PROFILE}/post-process.sh ] + #then + # ${PROFILE}/post-process.sh ${INSTLDIR} ${PROFILE} + # echo ${PROFILE}/post-process.sh ${INSTLDIR} ${PROFILE} + #fi + # + comment(" *** %s ***" % _("Arch installation completed")) return True @@ -232,6 +264,37 @@ class Installation: self.packages.append(line) fh.close() + def add_cache_packsfile(self, dir, packs_file, must=True): + path = dir + '/' + packs_file + if must and not os.path.isfile(path): + errout(_("No '%s' file") % path) + fh = open(path) + for line in fh: + line = line.strip() + if line and (line[0] != '#'): + if line[0] == '*': + self.add_group(line[1:].split()[0]) + elif line[0] == '+': + # Include directive + line = line[1:].split()[0] + if line[0] != '/': + line = dir + '/' + line + d, pf = line.rsplit('/', 1) + if not d: + errout(_("Invalid package file include: %s")) + print "calling myself with %s %s" %(d,pf) + self.add_cache_packsfile(d, pf) + + elif line.startswith('!!!'): + # Ignore everything (!) entered previously. + # Allows requiredpacks to be overridden in addedpacks. + self.cache_packages = [] + else: + line = line.split()[0] + if ((line not in self.cache_packages) and (line not in self.veto_packages)): + self.cache_packages.append(line) + fh.close() + def add_group(self, gname): """Add the packages belonging to a group to the installaion list, |