boxes/ubuntu: Configure vagrant user
This commit applies @smaftoul patch from https://gist.github.com/smaftoul/2d6fcf43b7c6545aa588/revisions
This commit is contained in:
parent
61e7cbce42
commit
03b262319f
2 changed files with 12 additions and 5 deletions
|
@ -117,6 +117,8 @@ finalize_user()
|
||||||
{
|
{
|
||||||
user=$1
|
user=$1
|
||||||
|
|
||||||
|
chroot $rootfs getent passwd $user || chroot $rootfs adduser --disabled-password --gecos "" $user
|
||||||
|
|
||||||
sudo_version=$(chroot $rootfs dpkg-query -W -f='${Version}' sudo)
|
sudo_version=$(chroot $rootfs dpkg-query -W -f='${Version}' sudo)
|
||||||
|
|
||||||
if chroot $rootfs dpkg --compare-versions $sudo_version gt "1.8.3p1-1"; then
|
if chroot $rootfs dpkg --compare-versions $sudo_version gt "1.8.3p1-1"; then
|
||||||
|
@ -513,6 +515,9 @@ EOF
|
||||||
|
|
||||||
# remove pointless services in a container
|
# remove pointless services in a container
|
||||||
chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove
|
chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove
|
||||||
|
chroot $rootfs /usr/sbin/update-rc.d -f checkroot-bootclean.sh remove
|
||||||
|
chroot $rootfs /usr/sbin/update-rc.d -f mountall-bootclean.sh remove
|
||||||
|
chroot $rootfs /usr/sbin/update-rc.d -f mountnfs-bootclean.sh remove
|
||||||
|
|
||||||
chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls u*.conf); do mv $f $f.orig; done'
|
chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls u*.conf); do mv $f $f.orig; done'
|
||||||
chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls tty[2-9].conf); do mv $f $f.orig; done'
|
chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls tty[2-9].conf); do mv $f $f.orig; done'
|
||||||
|
@ -787,6 +792,13 @@ else
|
||||||
finalize_user ubuntu
|
finalize_user ubuntu
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
vagrant_key_file="/tmp/vagrant.pub"
|
||||||
|
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > /tmp/vagrant.pub
|
||||||
|
orig_auth_key="$auth_key"
|
||||||
|
auth_key="/tmp/vagrant.pub"
|
||||||
|
finalize_user vagrant
|
||||||
|
auth_key="$orig_auth_key"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "##"
|
echo "##"
|
||||||
if [ -n "$bindhome" ]; then
|
if [ -n "$bindhome" ]; then
|
||||||
|
|
|
@ -41,7 +41,6 @@ class BuildGenericBoxTask < ::Rake::TaskLib
|
||||||
|
|
||||||
import_template do |template|
|
import_template do |template|
|
||||||
create_base_container(template) do |rootfs|
|
create_base_container(template) do |rootfs|
|
||||||
configure_vagrant_user(rootfs)
|
|
||||||
install_cfg_engines(rootfs)
|
install_cfg_engines(rootfs)
|
||||||
cleanup(rootfs)
|
cleanup(rootfs)
|
||||||
prepare_package_contents(rootfs)
|
prepare_package_contents(rootfs)
|
||||||
|
@ -74,10 +73,6 @@ class BuildGenericBoxTask < ::Rake::TaskLib
|
||||||
sh "sudo lxc-destroy -n #{container_name}"
|
sh "sudo lxc-destroy -n #{container_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure_vagrant_user(rootfs)
|
|
||||||
puts "TODO: Configure vagrant user under #{rootfs}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def install_cfg_engines(rootfs)
|
def install_cfg_engines(rootfs)
|
||||||
puts "TODO: Install cfg engines under #{rootfs}"
|
puts "TODO: Install cfg engines under #{rootfs}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue