#!/usr/bin/env bash
#
# Copyright (c) 2009-2012 VMware, Inc.

set -e

base_dir=$(readlink -nf $(dirname $0)/../..)
source $base_dir/lib/prelude_apply.bash
source $base_dir/lib/prelude_bosh.bash

# Set up users/groups
run_in_chroot $chroot "
addgroup --system admin
adduser --disabled-password --gecos Ubuntu vcap
echo \"vcap:${bosh_users_password}\" | chpasswd
echo \"root:${bosh_users_password}\" | chpasswd
"

for grp in admin adm audio cdrom dialout floppy video plugdev dip
do
  run_in_chroot $chroot "adduser vcap $grp"
done

cp $assets_dir/sudoers $chroot/etc/sudoers

echo "export PATH=$bosh_dir/bin:$PATH" >> $chroot/root/.bashrc
echo "export PATH=$bosh_dir/bin:$PATH" >> $chroot/home/vcap/.bashrc

#!/usr/bin/env bash
#
# Copyright (c) 2009-2012 VMware, Inc.

set -e

base_dir=$(readlink -nf $(dirname $0)/../..)
source $base_dir/lib/prelude_apply.bash
source $base_dir/lib/prelude_bosh.bash

# Set up users/groups
vcap_user_groups='admin,adm,audio,cdrom,dialout,floppy,video,plugdev,dip'

run_in_chroot $chroot "
groupadd --system admin
useradd -m --comment 'BOSH System User' vcap
echo \"vcap:${bosh_users_password}\" | chpasswd
echo \"root:${bosh_users_password}\" | chpasswd
usermod -G ${vcap_user_groups} vcap
"

# Setup SUDO
cp $assets_dir/sudoers $chroot/etc/sudoers

# Add $bosh_dir/bin to $PATH
echo "export PATH=$bosh_dir/bin:$PATH" >> $chroot/root/.bashrc
echo "export PATH=$bosh_dir/bin:$PATH" >> $chroot/home/vcap/.bashrc

Use Ubuntu/CentOS agnostic user/group tools
Use Ubuntu/CentOS agnostic user/group tools

Signed-off-by: Tony Hansmann <2c126519f2a6ad76296f425c3012060fde99f90e@pivotallabs.com>
