def create_base(self): packages = ['vim', 'xorg-server-xvfb'] if not os.path.exists(self.base_dir): mkarchroot(self.base_dir, ['base-devel']) else: arch_nspawn(self.base_dir, ['pacman', '--noconfirm', '-Syu']) arch_nspawn(self.base_dir, ['pacman', '--noconfirm', '--needed', '-S'] + packages)
def run(self, cmd, workdir=None): if workdir: if isinstance(cmd, list): cmd = ' '.join(cmd) cmd = 'cd {} && {}'.format(workdir, cmd) cmd = (['bash', '-cil', cmd]) arch_nspawn(self.workdir, cmd, bind_ro=self.bind_ro, bind_rw=self.bind_rw)
def install(self, pkgs): if not isinstance(pkgs, list): pkgs = [pkgs] if len(pkgs) > 0: arch_nspawn(self.workdir, ['pacman', '--noconfirm', '-S'] + pkgs)