Fix gentoo

It didn't work from within vagrant. Now it does.
This commit is contained in:
Virgil Dupras 2018-04-15 20:24:19 -04:00
parent 04b8dfe1dc
commit 466f627852
4 changed files with 20 additions and 23 deletions

View file

@ -22,27 +22,17 @@ elif [ ${DISTRIBUTION} = 'centos' -o ${DISTRIBUTION} = 'fedora' ]; then
else
echo 'Creating vagrant user...'
useradd --create-home -s /bin/bash vagrant
adduser vagrant sudo || useradd vagrant
echo -n 'vagrant:vagrant' | chpasswd
fi
# Configure SSH access
if [ -d /home/vagrant/.ssh ]; then
echo 'Skipping vagrant SSH credentials configuration'
else
echo 'SSH key has not been set'
mkdir -p /home/vagrant/.ssh
echo $VAGRANT_KEY > /home/vagrant/.ssh/authorized_keys
chown -R vagrant: /home/vagrant/.ssh
echo 'SSH credentials configured for the vagrant user.'
fi
mkdir -p /home/vagrant/.ssh
echo $VAGRANT_KEY > /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
chmod +x /home/vagrant/.ssh
echo 'SSH credentials configured for the vagrant user.'
# Enable passwordless sudo for the vagrant user
if [ -f /etc/sudoers.d/vagrant ]; then
echo 'Skipping sudoers file creation.'
else
echo 'Sudoers file was not found'
echo "vagrant ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant
echo 'Sudoers file created.'
fi
echo "vagrant ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant
echo 'Sudoers file created.'

View file

@ -0,0 +1,5 @@
lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed
# Default console settings
lxc.tty = 4
lxc.pts = 1024

View file

@ -5,7 +5,7 @@ source /etc/profile
echo 'Installing packages and upgrading'
PACKAGES=(vim net-misc/curl wget man-db openssh bash-completion ca-certificates sudo)
PACKAGES=(net-misc/curl wget man-db openssh ca-certificates sudo)
echo "Installing additional packages: ${ADDPACKAGES}"
PACKAGES+=" ${ADDPACKAGES}"
@ -32,8 +32,10 @@ if [[ $SALT = 1 ]]; then
fi
# trying to set capabilities on an unprivileged container fails.
echo "net-misc/iputils -filecaps" > /etc/portage/package.use/vagrant_overrides
echo "*/* -filecaps" > /etc/portage/package.use/vagrant_overrides
emerge --sync
emerge --noreplace ${PACKAGES[*]}
emerge -uND @world
rc-config add sshd default

View file

@ -30,9 +30,9 @@ SECS=15
log "Sleeping for $SECS seconds..."
sleep $SECS
#utils.lxc.runscript gentoo/install-packages.sh
#utils.lxc.runscript common/prepare-vagrant-user.sh
#utils.lxc.runscript gentoo/clean.sh
utils.lxc.runscript gentoo/install-packages.sh
utils.lxc.runscript common/prepare-vagrant-user.sh
utils.lxc.runscript gentoo/clean.sh
utils.lxc.stop
./common/package.sh