import time
-__version__ = '0.2'
+__version__ = '0.3'
class VmDebootstrap(cliapp.Application):
self.settings.boolean(['sudo'],
'install sudo, and if user is created, add them '
'to sudo group')
+ self.settings.string(['owner'],
+ 'the user who will own the image when the build '
+ 'is complete.')
def process_args(self, args):
if not self.settings['image'] and not self.settings['tarball']:
if self.settings['tarball']:
self.create_tarball(rootdir)
+
+ if self.settings['owner']:
+ self.chown(rootdir)
except BaseException, e:
self.message('EEEK! Something bad happened...')
+ self.message(e)
self.cleanup_system()
raise
else:
self.message('Creating tarball of disk contents')
self.runcmd(['tar', '-cf', self.settings['tarball'], '-C', rootdir, '.'])
+ def chown(self, rootdir):
+ # Change image owner after completed build
+ self.message("Changing owner to %s" % self.settings["owner"])
+ subprocess.call(["chown",
+ self.settings["owner"],
+ self.settings["image"]])
+
if __name__ == '__main__':
VmDebootstrap(version=__version__).run()