From e3571547c2a9ce6b37739aae626c03de2aea96cb Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 24 Dec 2011 10:08:54 +0000 Subject: [PATCH] add --sudo option --- vmdebootstrap | 7 +++++++ 1 file changed, 7 insertions(+) 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: -- 2.39.2