diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-12-24 10:08:54 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-12-24 10:08:54 +0000 |
commit | e3571547c2a9ce6b37739aae626c03de2aea96cb (patch) | |
tree | 158a7b27469976d457531bfb2878adcc1fadd772 | |
parent | 6ae74289015820ae2d2825790988fb882c7e3b8c (diff) | |
download | vmdebootstrap-e3571547c2a9ce6b37739aae626c03de2aea96cb.tar.gz |
add --sudo option
-rwxr-xr-x | vmdebootstrap | 7 |
1 files changed, 7 insertions, 0 deletions
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: |