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 else
echo 'Creating vagrant user...' echo 'Creating vagrant user...'
useradd --create-home -s /bin/bash vagrant useradd --create-home -s /bin/bash vagrant
adduser vagrant sudo || useradd vagrant
echo -n 'vagrant:vagrant' | chpasswd echo -n 'vagrant:vagrant' | chpasswd
fi fi
# Configure SSH access # 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 mkdir -p /home/vagrant/.ssh
echo $VAGRANT_KEY > /home/vagrant/.ssh/authorized_keys echo $VAGRANT_KEY > /home/vagrant/.ssh/authorized_keys
chown -R vagrant: /home/vagrant/.ssh chown -R vagrant /home/vagrant/.ssh
chmod +x /home/vagrant/.ssh
echo 'SSH credentials configured for the vagrant user.' echo 'SSH credentials configured for the vagrant user.'
fi
# Enable passwordless sudo 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 echo "vagrant ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant chmod 0440 /etc/sudoers.d/vagrant
echo 'Sudoers file created.' echo 'Sudoers file created.'
fi

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' 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}" echo "Installing additional packages: ${ADDPACKAGES}"
PACKAGES+=" ${ADDPACKAGES}" PACKAGES+=" ${ADDPACKAGES}"
@ -32,8 +32,10 @@ if [[ $SALT = 1 ]]; then
fi fi
# trying to set capabilities on an unprivileged container fails. # 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 --sync
emerge --noreplace ${PACKAGES[*]} emerge --noreplace ${PACKAGES[*]}
emerge -uND @world emerge -uND @world
rc-config add sshd default

View file

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