Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Lots of polishing on funtoo template #203

Merged
merged 9 commits into from

2 participants

@stagrlee

Biggest fixes we're to get RVM installed correctly in multi-user mode
After that, a bunch of refinement to get the funtoo "current" and "stable" variants to build nightly on my Mac Mini Jenkins machine.

@jedi4ever jedi4ever merged commit 6bf148f into jedi4ever:master
@petecheslock petecheslock referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 31, 2011
  1. clean up 100M of tarball

    Lee Thompson authored
  2. Merge branch 'patrick'

    Lee Thompson authored
Commits on Jan 2, 2012
Commits on Jan 3, 2012
  1. another ship in a bottle oddity

    Lee Thompson authored
Commits on Jan 4, 2012
  1. minor edit

    Lee Thompson authored
Commits on Jan 6, 2012
  1. interesting bug

    Lee Thompson authored
Commits on Jan 7, 2012
  1. @stagrlee
  2. @stagrlee

    Merge branch 'patrick'

    stagrlee authored
This page is out of date. Refresh to see the latest.
View
25 templates/funtoo-latest-generic_64-stable/definition.rb
@@ -1,35 +1,34 @@
Veewee::Session.declare( {
:cpu_count => '8', :memory_size=> '1536',
:disk_size => '10140', :disk_format => 'VDI',:hostiocache => 'off',
- :os_type_id => 'Gentoo', # Funtoo is a GIT based gentoo derivative
- :iso_file => "install-amd64-minimal-20111013.iso",
+ :os_type_id => 'Gentoo_64', # Funtoo is a GIT based gentoo derivative
+ :iso_file => "install-amd64-minimal-20111208.iso",
:iso_src => "http://ftp.osuosl.org/pub/gentoo/releases/amd64/autobuilds/20111208/install-amd64-minimal-20111208.iso",
:iso_md5 => "8c4e10aaaa7cce35503c0d23b4e0a42a",
:iso_download_timeout => "1000",
- :boot_wait => "1",
+ :boot_wait => "4",
:boot_cmd_sequence => [
- '<Wait>'*2,
- 'gentoo-nofb<Enter>',
- '<Wait>'*10,
- '<Enter>',
- '<Wait>'*10,
+ '<Wait>'*4,
+ 'gentoo-nofb<Enter>', # boot gentoo no frame buffer mode option
+ '<Wait>'*45,
+ '<Enter>', # asks about your keyboard, take the default
+ '<Wait>'*45,
+ '<Enter><Wait>', # just in case we are out of sync
'net-setup eth0<Enter>',
'<Wait><Enter>',
- '2<Enter>',
+ '2<Enter>', # Set up the NIC card with DHCP
'1<Enter>',
'<Wait><Wait>ifconfig -a <Enter>',
- #'sleep 5 ;curl http://%IP%:%PORT%/stages.sh -o stages.sh &&',
- #'bash stages.sh &<Enter>',
'passwd<Enter><Wait><Wait>',
'vagrant<Enter><Wait>',
'vagrant<Enter><Wait>',
- '/etc/init.d/sshd start<Enter>'
+ '/etc/init.d/sshd start<Enter><Wait><Wait>'
],
:kickstart_port => "7122", :kickstart_timeout => "10000",:kickstart_file => "",
:ssh_login_timeout => "10000",:ssh_user => "root", :ssh_password => "vagrant",:ssh_key => "",
:ssh_host_port => "7222", :ssh_guest_port => "22",
:sudo_cmd => "cat '%f'|su -",
:shutdown_cmd => "shutdown -p now",
- :postinstall_files => [ "postinstall.sh"],:postinstall_timeout => "15000"
+ :postinstall_files => [ "postinstall.sh", "postinstall2.sh" ], :postinstall_timeout => "15000"
}
)
View
121 templates/funtoo-latest-generic_64-stable/postinstall.sh
@@ -6,7 +6,7 @@ date > /etc/vagrant_box_build_time
#Partition the disk
# Gentoo live CD were using doesn't have gdisk and it looks
-# to be interactive like fdisk. sfdisk is scribable but has issues.
+# to be interactive like fdisk. sfdisk is scritable but has issues.
#
# If you adjust, best to read this
# http://www.spinics.net/lists/util-linux-ng/msg03406.html
@@ -58,20 +58,20 @@ tar xpf stage3*
#Chroot
mount --bind /proc ./proc
mount --bind /dev ./dev
-cp /etc/resolv.conf ./etc/
-echo "env-update && source /etc/profile" | chroot /mnt/funtoo /bin/bash -
+cp /etc/resolv.conf /mnt/funtoo/etc/
+chroot /mnt/funtoo env-update
# git installed from stage3 tarball
-echo "emerge --sync" | chroot /mnt/funtoo /bin/bash -
+chroot /mnt/funtoo emerge --sync
# California dreamin
-cd etc
+cd /mnt/funtoo/etc
rm -f localtime
ln -s ../usr/share/zoneinfo/America/Los_Angeles localtime
cd /mnt/funtoo
# get fstab defined
-cat <<FSTABEOF > ./etc/fstab
+cat <<FSTABEOF > /mnt/funtoo/etc/fstab
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
@@ -87,18 +87,17 @@ none /dev/shm tmpfs nodev,nosuid,noexec
FSTABEOF
# dhcp
-echo "rc-update add dhcpcd default" | chroot /mnt/funtoo /bin/bash -
+chroot /mnt/funtoo rc-update add dhcpcd default
# Get the kernel sources
-echo "sys-kernel/sysrescue-std-sources binary" >> ./etc/portage/package.use
-echo "emerge sysrescue-std-sources" | chroot /mnt/funtoo /bin/bash -
-
-# Fix a package blocker problem with the current stage3 tarball
-#echo "emerge -u sysvinit" | chroot /mnt/funtoo /bin/bash -
+echo 'MAKEOPTS="-j9"' >> /mnt/funtoo/etc/make.conf
+#echo 'MAKEOPTS="-j9"' >> /mnt/funtoo/etc/genkernel.conf
+echo "sys-kernel/sysrescue-std-sources binary" >> /mnt/funtoo/etc/portage/package.use
+echo "app-emulation/virtualbox-guest-additions" >> /mnt/funtoo/etc/portage/package.keywords
+echo 'MAKEOPTS="-j9" emerge sysrescue-std-sources' | chroot /mnt/funtoo /bin/bash -
# Make the disk bootable
-echo "emerge boot-update" | chroot /mnt/funtoo /bin/bash -
-echo 'MAKEOPTS="-j9"' >> /mnt/funtoo/etc/make.conf
+chroot /mnt/funtoo emerge boot-update
cat <<GRUBCONF > ./etc/boot.conf
boot {
@@ -120,95 +119,59 @@ boot {
}
GRUBCONF
-echo "grub-install --no-floppy /dev/sda" | chroot /mnt/funtoo /bin/bash -
-echo "boot-update" | chroot /mnt/funtoo /bin/bash -
+chroot /mnt/funtoo grub-install --no-floppy /dev/sda
+chroot /mnt/funtoo boot-update
-#Root password, decided vagrant sudo was better, commented out
-###chroot /mnt/funtoo /bin/bash <<ENDCHROOT
-###passwd<<EOF
-###vagrant
-###vagrant
-###EOF
-###ENDCHROOT
+#Root password, needed since we're a two step installation
+chroot /mnt/funtoo /bin/bash <<ENDCHROOT
+passwd<<EOF
+vagrant
+vagrant
+EOF
+ENDCHROOT
#create vagrant user with password set to vagrant
chroot /mnt/funtoo groupadd -r vagrant
-chroot /mnt/funtoo useradd -m -r vagrant -g vagrant -G wheel -p '$1$MPmczGP9$1SeNO4bw5YgiEJuo/ZkWq1' -c "Added by vagrant, veewee basebox creation"
+chroot /mnt/funtoo groupadd rvm
+chroot /mnt/funtoo useradd -m -r vagrant -g vagrant -G wheel,rvm -p '$1$MPmczGP9$1SeNO4bw5YgiEJuo/ZkWq1' -c "Added by vagrant, veewee basebox creation"
chroot /mnt/funtoo rc-update add sshd default
-# Cron & Syslog
-chroot /mnt/funtoo emerge -u metalog vixie-cron
-chroot /mnt/funtoo rc-update add metalog default
-chroot /mnt/funtoo rc-update add vixie-cron default
-
-#Get an editor going
-chroot /mnt/funtoo emerge -u vim
-echo "EDITOR=/usr/bin/vim" > /mnt/funtoo/etc/env.d/99editor
-
#Allow external ssh
-echo "echo 'sshd:ALL' > /etc/hosts.allow" | chroot /mnt/funtoo /bin/bash -
-echo "echo 'ALL:ALL' > /etc/hosts.deny" | chroot /mnt/funtoo /bin/bash -
+echo 'sshd:ALL' > /mnt/funtoo/etc/hosts.allow
+echo 'ALL:ALL' > /mnt/funtoo/etc/hosts.deny
#Configure Sudo
chroot /mnt/funtoo emerge -u sudo
-echo "echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" | chroot /mnt/funtoo /bin/bash -
+echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /mnt/funtoo/etc/sudoers
+
#Installing vagrant keys
chroot /mnt/funtoo emerge -u wget
echo "creating vagrant ssh keys"
-chroot /mnt/funtoo mkdir /home/vagrant/.ssh
-chroot /mnt/funtoo chmod 700 /home/vagrant/.ssh
-chroot /mnt/funtoo cd /home/vagrant/.ssh
-chroot /mnt/funtoo wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
-chroot /mnt/funtoo chmod 600 /home/vagrant/.ssh/authorized_keys
-chroot /mnt/funtoo chown -R vagrant /home/vagrant/.ssh
-
-#get some ruby running, needed for veewee validate step
-chroot /mnt/funtoo emerge -u git curl gcc automake autoconf m4
-chroot /mnt/funtoo emerge -u libiconv readline zlib openssl libyaml sqlite libxslt
-chroot /mnt/funtoo /bin/bash <<ENDRUBY
-bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
-. /usr/local/rvm/scripts/rvm
-rvm install ruby-1.8.7
-rvm use ruby-1.8.7 --default
-
-#Installing chef & Puppet
-. /usr/local/rvm/scripts/rvm
-gem install chef
-gem install puppet
-
-usermod -G rvm vagrant
-ENDRUBY
+VAGRANTID=$(grep vagrant /mnt/funtoo/etc/passwd | cut -d ":" -f 3,4)
+mkdir /mnt/funtoo/home/vagrant/.ssh
+chmod 700 /mnt/funtoo/home/vagrant/.ssh
+wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /mnt/funtoo/home/vagrant/.ssh/authorized_keys
+chmod 600 /mnt/funtoo/home/vagrant/.ssh/authorized_keys
+chown -R ${VAGRANTID} /mnt/funtoo/home/vagrant/.ssh
/bin/cp -f /root/.vbox_version /mnt/funtoo/home/vagrant/.vbox_version
-VBOX_VERSION=$(cat /root/.vbox_version)
-
-#Kernel headers
-echo "emerge =sys-kernel/linux-headers-2.6.39" | chroot /mnt/funtoo /bin/bash -
-
-#Installing the virtualbox guest additions
-cat <<EOF | chroot /mnt/funtoo /bin/bash -
-mkdir /etc/portage
-cat <<KEYWORDSEOF > /etc/portage/package.keywords
-=app-emulation/virtualbox-guest-additions-4.1.6-r1
-KEYWORDSEOF
-emerge =app-emulation/virtualbox-guest-additions-4.1.6-r1
-rc-update add virtualbox-guest-additions default
-EOF
-
-rm -rf /mnt/funtoo/usr/portage/distfiles
-mkdir /mnt/funtoo/usr/portage/distfiles
-echo "chown portage:portage /usr/portage/distfiles" | chroot /mnt/funtoo /bin/bash -
+/bin/cp -f /etc/vagrant_box_build_time /mnt/funtoo/etc/vagrant_box_build_time
+chown -R ${VAGRANTID} /mnt/funtoo/home/vagrant/.vbox_version
# veewee validate uses password authentication
sed -i -e 's:PasswordAuthentication no:PasswordAuthentication yes:' /mnt/funtoo/etc/ssh/sshd_config
+#Get an editor going
+chroot /mnt/funtoo emerge -u vim
+echo "EDITOR=/usr/bin/vim" > /mnt/funtoo/etc/env.d/99editor
chroot /mnt/funtoo env-update
-exit
+
cd /
-umount /mnt/funtoo/{proc,sys,dev}
+/etc/rc.d/network stop
+umount /mnt/funtoo/{boot,proc,dev}
umount /mnt/funtoo
reboot
View
83 templates/funtoo-latest-generic_64-stable/postinstall2.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+# Wanted multi-user RVM (ruby version manager) setup. It got really hacky.
+# Couldn't get the su command to work in the chroot so split the install into two
+# phases, one in chroot, and the second phase in the installed kernel.
+# Ruby's RVM needs to be installed by a user not root for multi-user use.
+# All this would go away in single user install of RVM
+
+# A bit better security, but still your root and vagrant accounts are wide open!
+echo -e "PermitRootLogin no\nAllowUsers vagrant" >> /etc/ssh/sshd_config
+
+# Cron & Syslog
+emerge -u --oneshot metalog vixie-cron
+rc-update add metalog default
+rc-update add vixie-cron default
+
+#Kernel headers
+emerge -u --oneshot sys-kernel/linux-headers
+
+#Installing the virtualbox guest additions
+emerge app-emulation/virtualbox-guest-additions
+rc-update add virtualbox-guest-additions default
+
+# Get ruby and rvm all setup...
+emerge -u --oneshot git curl gcc automake autoconf m4
+emerge -u --oneshot libiconv readline zlib openssl libyaml sqlite libxslt
+
+# Clean up portage
+rm -rf /usr/portage/distfiles/*
+rm /stage3*.tar.xz
+
+# What a PITA, wanted to get a shared RVM setup, but that can't be installed by root
+# Starting to feel like a matryoshka doll...
+# Setup so you can SSH into the vagrant account
+wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant' -O /tmp/sshkey
+chmod 600 /tmp/sshkey
+
+cat <<SSHCONF > /tmp/sshvagrant
+Host me
+ HostName 127.0.0.1
+ User vagrant
+ Port 22
+ UserKnownHostsFile /dev/null
+ StrictHostKeyChecking no
+ PasswordAuthentication no
+ IdentityFile /tmp/sshkey
+ IdentitiesOnly yes
+SSHCONF
+
+cat <<GEMINST > /tmp/sshgems
+echo -e "\n***\n*** My id is yuck ***\n***\n"
+
+# Lots of problems if you install as root so we'll use sudo like to docs describe
+sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
+sudo env-update
+source /etc/profile
+
+# Install ruby and gems into rvm
+rvm install 1.8.7
+rvm use 1.8.7 --default
+rvm gemset create global
+rvm use @global
+
+#Installing chef & puppet
+gem install chef
+gem install puppet
+
+# Cleanup
+sudo chmod 655 /tmp/sshkey
+sudo rm /tmp/ssh*
+
+echo -e "\n***\n*** Chef and Puppet installed in RVM ***\n***\n"
+GEMINST
+
+chmod 755 /tmp/sshgems
+sed -i -e 's,yuck,$(id),' /tmp/sshgems
+ssh -F /tmp/sshvagrant me /tmp/sshgems
+
+# Sometimes you don't get out of the SSH session. Think the EOF bails out both
+# the ssh login with the vagrant account and the veewee login with the root
+# account. So we put the RVM stuff last and its no issue.
+
+echo -e "\n***\n*** SURVIVED SSH EOF! ***\n***\n"
Something went wrong with that request. Please try again.