Merge branch 'preos' into 4.0-pre-not-stable

remotes/origin/4.0-pre-not-stable
Nico Schottelius 11 years ago
commit 44f910d199
  1. 14
      cdist/preos.py

14
cdist/preos.py vendored

@ -162,10 +162,6 @@ cp -L "$src" "$real_dst"
fd.write(val) fd.write(val)
os.chmod(filename, stat.S_IRUSR | stat.S_IXUSR) os.chmod(filename, stat.S_IRUSR | stat.S_IXUSR)
def remove_archives(self, base_dir):
cmd = [ "chroot", self.target_dir, "/usr/bin/apt-get", "clean" ]
subprocess.check_call(cmd)
def create_kernel(self): def create_kernel(self):
dst = os.path.join(self.out_dir, "kernel") dst = os.path.join(self.out_dir, "kernel")
srcglob = glob.glob("%s/boot/vmlinuz-*" % self.target_dir) srcglob = glob.glob("%s/boot/vmlinuz-*" % self.target_dir)
@ -257,6 +253,12 @@ cp -L "$src" "$real_dst"
config = cdist.config.Config(local, remote) config = cdist.config.Config(local, remote)
config.run() config.run()
def cleanup(self):
# Remove cruft from chroot
for action in 'autoclean clean autoremove'.split():
cmd = [ 'chroot', self.target_dir, '/usr/bin/apt-get', action]
subprocess.check_call(cmd)
@classmethod @classmethod
def commandline(cls, args): def commandline(cls, args):
self = cls(target_dir=args.target_dir[0], self = cls(target_dir=args.target_dir[0],
@ -274,8 +276,8 @@ cp -L "$src" "$real_dst"
if args.config: if args.config:
self.config() self.config()
# Cleanup archives before creating any image # Cleanup chroot
self.remove_archives() self.cleanup()
# Output pxe files # Output pxe files
if args.pxe_boot_dir: if args.pxe_boot_dir:

Loading…
Cancel
Save