Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from simonsd/arch
Archlinux netboot templates
- Loading branch information
Showing
13 changed files
with
419 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Archlinux AIF config file | ||
# created by Dave Simons | ||
# 11/07/2011 | ||
|
||
# install source | ||
SOURCE=net | ||
# use http mirrors only, ftp will time out | ||
SYNC_URL=http://mirrors.kernel.org/archlinux/core/os/i686 | ||
|
||
# time/date | ||
HARDWARECLOCK=localtime | ||
TIMEZONE=Europe/Brussels | ||
|
||
# packages to install | ||
TARGET_GROUPS=base | ||
TARGET_PACKAGES='sudo openssh vim ruby kernel26-headers make gcc glibc git perl net-tools' | ||
TARGET_PACKAGES_EXCLUDE='nano emacs wpa_supplicant xfsprogs reiserfsprogs pcmciautils mdadm jfsutils cryptsetup lvm2' | ||
|
||
# hard drive setup | ||
GRUB_DEVICE='/dev/sda' | ||
PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext4' | ||
BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params | ||
/dev/sda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params | ||
/dev/sda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params' | ||
|
||
worker_install_bootloader () | ||
{ | ||
cat << EOF > /mnt/boot/grub/device.map | ||
(hd0) /dev/sda | ||
EOF | ||
grub-install $var_GRUB_DEVICE --root-directory=/mnt || return 1 | ||
bootdev=$(mount|grep $var_TARGET_DIR/boot|cut -d' ' -f1) | ||
generate_grub_menulst || return 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Veewee::Session.declare({ | ||
:cpu_count => '1', :memory_size=> '256', | ||
:disk_size => '10140', :disk_format => 'VDI',:hostiocache => 'off', | ||
:os_type_id => 'ArchLinux', | ||
:iso_file => "archlinux-2010.05-netinstall-i686.iso", | ||
:iso_src => "http://archlinux.mirror.kangaroot.net/iso/latest/archlinux-2010.05-netinstall-i686.iso", | ||
:iso_md5 => "00df751d287d01821e0123c10056d020", | ||
:iso_download_timeout => "1000", | ||
:boot_wait => "5", :boot_cmd_sequence => [ | ||
'<Enter>', | ||
'<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>', | ||
'<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>', | ||
'<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>', | ||
'root<Enter>', | ||
'dhcpcd eth0<Enter><Wait><Wait>', | ||
'echo "sshd: ALL" > /etc/hosts.allow<Enter>', | ||
'passwd<Enter>', | ||
'vagrant<Enter>', | ||
'vagrant<Enter>', | ||
'/etc/rc.d/sshd start<Enter><Wait>', | ||
'sleep 3 && wget 10.0.2.2:7122/aif.cfg<Enter>', | ||
], | ||
:kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "aif.cfg", | ||
:ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "vagrant", :ssh_key => "", | ||
:ssh_host_port => "7222", :ssh_guest_port => "22", | ||
:sudo_cmd => "sh '%f'", | ||
:shutdown_cmd => "shutdown -h now", | ||
:postinstall_files => [ "postinstall.sh", "postinstall2.sh"], :postinstall_timeout => "10000" | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
|
||
date > /etc/vagrant_box_build_time | ||
|
||
# launch automated install | ||
su -c 'aif -p automatic -c aif.cfg' | ||
|
||
# copy over the vbox version file | ||
/bin/cp -f /root/.vbox_version /mnt/root/.vbox_version | ||
|
||
# chroot into the new system | ||
mount -o bind /dev /mnt/dev | ||
mount -o bind /sys /mnt/sys | ||
mount -t proc none /mnt/proc | ||
chroot /mnt <<ENDCHROOT | ||
# make sure network is up and a nameserver is available | ||
dhcpcd eth0 | ||
# sudo setup | ||
# note: do not use tabs here, it autocompletes and borks the sudoers file | ||
cat <<EOF > /etc/sudoers | ||
root ALL=(ALL) ALL | ||
%wheel ALL=(ALL) NOPASSWD: ALL | ||
EOF | ||
# set up user accounts | ||
passwd<<EOF | ||
vagrant | ||
vagrant | ||
EOF | ||
useradd -m -G wheel -r vagrant | ||
passwd -d vagrant | ||
passwd vagrant<<EOF | ||
vagrant | ||
vagrant | ||
EOF | ||
# create puppet group | ||
groupadd puppet | ||
# make sure ssh is allowed | ||
echo "sshd: ALL" > /etc/hosts.allow | ||
# and everything else isn't | ||
echo "ALL: ALL" > /etc/hosts.deny | ||
# make sure sshd starts | ||
sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 sshd):' /etc/rc.conf | ||
# install mitchellh's ssh key | ||
mkdir /home/vagrant/.ssh | ||
chmod 700 /home/vagrant/.ssh | ||
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys | ||
chmod 600 /home/vagrant/.ssh/authorized_keys | ||
chown -R vagrant /home/vagrant/.ssh | ||
# choose a mirror | ||
sed -i 's/^#\(.*leaseweb.*\)/\1/' /etc/pacman.d/mirrorlist | ||
# update pacman | ||
pacman -Syy | ||
pacman -S --noconfirm pacman | ||
# upgrade pacman db | ||
pacman-db-upgrade | ||
pacman -Syy | ||
# install some packages | ||
pacman -S --noconfirm glibc git | ||
gem install --no-ri --no-rdoc chef facter | ||
cd /tmp | ||
git clone https://github.com/puppetlabs/puppet.git | ||
cd puppet | ||
ruby install.rb --bindir=/usr/bin --sbindir=/sbin | ||
# set up networking | ||
sed -i 's/^\(interface=*\)/\1eth0/' /etc/rc.conf | ||
# leave the chroot | ||
ENDCHROOT | ||
|
||
# take down network to prevent next postinstall.sh from starting too soon | ||
/etc/rc.d/network stop | ||
|
||
# and reboot! | ||
reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# install virtualbox guest additions | ||
VBOX_VERSION=$(cat /root/.vbox_version) | ||
cd /tmp | ||
wget http://download.virtualbox.org/virtualbox/"$VBOX_VERSION"/VBoxGuestAdditions_"$VBOX_VERSION".iso | ||
mount -o loop VBoxGuestAdditions_"$VBOX_VERSION".iso /mnt | ||
sh /mnt/VBoxLinuxAdditions.run | ||
umount /mnt | ||
rm VBoxGuestAdditions_"$VBOX_VERSION".iso | ||
|
||
# host-only networking | ||
cat >> /etc/rc.local <<EOF | ||
# enable DHCP at boot on eth0 | ||
# See https://wiki.archlinux.org/index.php/Network#DHCP_fails_at_boot | ||
dhcpcd -k eth0 | ||
dhcpcd -nd eth0 | ||
EOF | ||
|
||
# clean out pacman cache | ||
pacman -Scc<<EOF | ||
y | ||
y | ||
EOF | ||
|
||
# zero out the fs | ||
dd if=/dev/zero of=/tmp/clean || rm /tmp/clean | ||
|
||
# and the final reboot! | ||
#reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Archlinux AIF config file | ||
# created by Dave Simons | ||
# 11/07/2011 | ||
|
||
# install source | ||
SOURCE=net | ||
# use http mirrors only, ftp will time out | ||
SYNC_URL=http://mirrors.kernel.org/archlinux/core/os/x86_64 | ||
|
||
# time/date | ||
HARDWARECLOCK=localtime | ||
TIMEZONE=Europe/Brussels | ||
|
||
# packages to install | ||
TARGET_GROUPS=base | ||
TARGET_PACKAGES='sudo openssh vim ruby kernel26-headers make gcc glibc git perl net-tools' | ||
TARGET_PACKAGES_EXCLUDE='nano emacs wpa_supplicant xfsprogs reiserfsprogs pcmciautils mdadm jfsutils cryptsetup lvm2' | ||
|
||
# hard drive setup | ||
GRUB_DEVICE='/dev/sda' | ||
PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext4' | ||
BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params | ||
/dev/sda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params | ||
/dev/sda3 raw no_label ext4;yes;/;target;no_opts;no_label;no_params' | ||
|
||
worker_install_bootloader () | ||
{ | ||
cat << EOF > /mnt/boot/grub/device.map | ||
(hd0) /dev/sda | ||
EOF | ||
grub-install $var_GRUB_DEVICE --root-directory=/mnt || return 1 | ||
bootdev=$(mount|grep $var_TARGET_DIR/boot|cut -d' ' -f1) | ||
generate_grub_menulst || return 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Veewee::Session.declare({ | ||
:cpu_count => '1', :memory_size=> '256', | ||
:disk_size => '10140', :disk_format => 'VDI',:hostiocache => 'off', | ||
:os_type_id => 'ArchLinux_64', | ||
:iso_file => "archlinux-2010.05-netinstall-x86_64.iso", | ||
:iso_src => "http://archlinux.mirror.kangaroot.net/iso/latest/archlinux-2010.05-netinstall-x86_64.iso", | ||
:iso_md5 => "577ca8026a9997f7cecb430276d78793", | ||
:iso_download_timeout => "1000", | ||
:boot_wait => "5", :boot_cmd_sequence => [ | ||
'<Enter>', | ||
'<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>', | ||
'<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>', | ||
'<Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait><Wait>', | ||
'root<Enter>', | ||
'dhcpcd eth0<Enter><Wait><Wait>', | ||
'echo "sshd: ALL" > /etc/hosts.allow<Enter>', | ||
'passwd<Enter>', | ||
'vagrant<Enter>', | ||
'vagrant<Enter>', | ||
'/etc/rc.d/sshd start<Enter><Wait>', | ||
'sleep 3 && wget 10.0.2.2:7122/aif.cfg<Enter>', | ||
], | ||
:kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "aif.cfg", | ||
:ssh_login_timeout => "10000", :ssh_user => "root", :ssh_password => "vagrant", :ssh_key => "", | ||
:ssh_host_port => "7222", :ssh_guest_port => "22", | ||
:sudo_cmd => "sh '%f'", | ||
:shutdown_cmd => "shutdown -h now", | ||
:postinstall_files => [ "postinstall.sh", "postinstall2.sh"], :postinstall_timeout => "10000" | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
|
||
# var to determine package source | ||
PKGSRC=net | ||
|
||
date > /etc/vagrant_box_build_time | ||
|
||
# launch automated install | ||
su -c 'aif -p automatic -c aif.cfg' | ||
|
||
# copy over the vbox version file | ||
/bin/cp -f /root/.vbox_version /mnt/root/.vbox_version | ||
|
||
# chroot into the new system | ||
mount -o bind /dev /mnt/dev | ||
mount -o bind /sys /mnt/sys | ||
mount -t proc none /mnt/proc | ||
chroot /mnt <<ENDCHROOT | ||
# make sure network is up and a nameserver is available | ||
dhcpcd eth0 | ||
# sudo setup | ||
# note: do not use tabs here, it autocompletes and borks the sudoers file | ||
cat <<EOF > /etc/sudoers | ||
root ALL=(ALL) ALL | ||
%wheel ALL=(ALL) NOPASSWD: ALL | ||
EOF | ||
# set up user accounts | ||
passwd<<EOF | ||
vagrant | ||
vagrant | ||
EOF | ||
useradd -m -G wheel -r vagrant | ||
passwd -d vagrant | ||
passwd vagrant<<EOF | ||
vagrant | ||
vagrant | ||
EOF | ||
# create puppet group | ||
groupadd puppet | ||
# make sure ssh is allowed | ||
echo "sshd: ALL" > /etc/hosts.allow | ||
# and everything else isn't | ||
echo "ALL: ALL" > /etc/hosts.deny | ||
# make sure sshd starts | ||
sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 sshd):' /etc/rc.conf | ||
# install mitchellh's ssh key | ||
mkdir /home/vagrant/.ssh | ||
chmod 700 /home/vagrant/.ssh | ||
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys | ||
chmod 600 /home/vagrant/.ssh/authorized_keys | ||
chown -R vagrant /home/vagrant/.ssh | ||
# choose a mirror | ||
sed -i 's/^#\(.*leaseweb.*\)/\1/' /etc/pacman.d/mirrorlist | ||
# update pacman | ||
[[ $PKGSRC == 'cd' ]] && pacman -Syy | ||
[[ $PKGSRC == 'cd' ]] && pacman -S --noconfirm pacman | ||
# upgrade pacman db | ||
pacman-db-upgrade | ||
pacman -Syy | ||
# install some packages | ||
pacman -S --noconfirm glibc git | ||
gem install --no-ri --no-rdoc chef facter | ||
cd /tmp | ||
git clone https://github.com/puppetlabs/puppet.git | ||
cd puppet | ||
ruby install.rb --bindir=/usr/bin --sbindir=/sbin | ||
# set up networking | ||
[[ $PKGSRC == 'net' ]] && sed -i 's/^\(interface=*\)/\1eth0/' /etc/rc.conf | ||
# leave the chroot | ||
ENDCHROOT | ||
|
||
# take down network to prevent next postinstall.sh from starting too soon | ||
/etc/rc.d/network stop | ||
|
||
# and reboot! | ||
reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# install virtualbox guest additions | ||
VBOX_VERSION=$(cat /root/.vbox_version) | ||
cd /tmp | ||
wget http://download.virtualbox.org/virtualbox/"$VBOX_VERSION"/VBoxGuestAdditions_"$VBOX_VERSION".iso | ||
mount -o loop VBoxGuestAdditions_"$VBOX_VERSION".iso /mnt | ||
sh /mnt/VBoxLinuxAdditions.run | ||
umount /mnt | ||
rm VBoxGuestAdditions_"$VBOX_VERSION".iso | ||
|
||
# host-only networking | ||
cat >> /etc/rc.local <<EOF | ||
# enable DHCP at boot on eth0 | ||
# See https://wiki.archlinux.org/index.php/Network#DHCP_fails_at_boot | ||
dhcpcd -k eth0 | ||
dhcpcd -nd eth0 | ||
EOF | ||
|
||
# clean out pacman cache | ||
pacman -Scc<<EOF | ||
y | ||
y | ||
EOF | ||
|
||
# zero out the fs | ||
dd if=/dev/zero of=/tmp/clean || rm /tmp/clean | ||
|
||
# and the final reboot! | ||
#reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.