From: Lars Wirzenius Date: Sat, 24 Dec 2011 10:08:54 +0000 (+0000) Subject: add --sudo option X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=e3571547c2a9ce6b37739aae626c03de2aea96cb;p=forks%2Fvmdebootstrap.git add --sudo option --- diff --git a/vmdebootstrap b/vmdebootstrap index b6d6a48..dd72925 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -63,6 +63,9 @@ class VmDebootstrap(cliapp.Application): metavar='USER/PASSWORD') self.settings.boolean(['serial-console'], 'configure image to use a serial console') + self.settings.boolean(['sudo'], + 'install sudo, and if user is created, add them ' + 'to sudo group') def process_args(self, args): if not self.settings['image']: @@ -169,6 +172,8 @@ class VmDebootstrap(cliapp.Application): kernel_image = 'linux-image-2.6-%s' % kernel_arch include = [kernel_image] + self.settings['package'] + if self.settings['sudo'] and 'sudo' not in include: + include.append('sudo') self.runcmd(['debootstrap', '--arch=%s' % self.settings['arch'], @@ -209,6 +214,8 @@ class VmDebootstrap(cliapp.Application): def create_user(user): self.runcmd(['chroot', rootdir, 'adduser', '--gecos', user, '--disabled-password', user]) + if self.settings['sudo']: + self.runcmd(['chroot', rootdir, 'adduser', user, 'sudo']) for userpass in self.settings['user']: if '/' in userpass: