Skip to content

Instantly share code, notes, and snippets.

@GregSutcliffe
Created May 20, 2012 15:29
Show Gist options
  • Save GregSutcliffe/2758510 to your computer and use it in GitHub Desktop.
Save GregSutcliffe/2758510 to your computer and use it in GitHub Desktop.
Blog/ArchPage2
Name: "Arch AIF Profile"
Template kind: "script"
Content:
# We'd like to use this, but Foreman parses backslashed URLs
#MIRROR='< % = @mediapath % >'
# Simple repo call
MIRROR='ftp://mirrors.kernel.org/archlinux/$repo/os/$arch'
# Apt-cacher approach
#MIRROR='http://foreman:3142/archlinux/$repo/os/$arch'
TARGET_REPOSITORIES=(core $var_MIRRORLIST) # $var_MIRRORLIST is set by AIF
HARDWARECLOCK=UTC
TIMEZONE=Europe/London
# Do you want to have additional pacman repositories or packages available at runtime (during installation)?
# RUNTIME_REPOSITORIES same format as TARGET_REPOSITORIES
RUNTIME_REPOSITORIES=
# space separated list
RUNTIME_PACKAGES=
# packages to install
# all packages in this group will be installed (defaults to base if no group and no packages are specified)
TARGET_GROUPS=base
# Exclude packages if they are member of any groups in TARGET_GROUPS. example: 'nano reiserfsprogs' (they are in base)
TARGET_PACKAGES_EXCLUDE=
# you can also specify separate packages to install (this is empty by default)
TARGET_PACKAGES='openssh'
# you can optionally also override some functions...
# This way you can change/extend/remove pretty much all functionality in AIF !
worker_intro () {
inform "Automatic procedure running the generic-install-on-sda example config. THIS WILL ERASE AND OVERWRITE /DEV/SDA. IF YOU DO NOT WANT THIS PRESS CTRL+C WITHIN 10 SECONDS"
sleep 10
}
# Set hostname and network device
worker_configure_system () {
preconfigure_target
sed -i 's/^HOSTNAME="myhost"/HOSTNAME="<%= @host.name.split('.').first %>"/' $var_TARGET_DIR/etc/rc.conf
sed -i 's/^interface=$/interface=eth0/' $var_TARGET_DIR/etc/rc.conf
postconfigure_target
}
# Disk
<%= @host.diskLayout %>
Name: "Arch Finish"
Template kind: "finish"
Content:
# Start services on boot
/bin/sed -i 's/DAEMONS=(\(.*\))/DAEMONS=(\1 sshd)/' /etc/rc.conf
# Yaourt repo
echo '[archlinuxfr]
Server = http://repo.archlinux.fr/$arch' >> /etc/pacman.conf
pacman -Sy --noconfirm yaourt base-devel
# Install stuff with yaourt
yaourt -Sy --noconfirm puppet
# Patch bug 8858
cat > /tmp/patch <<EOD
--- a/network/http_pool.rb 2012-03-09 12:51:21.000000000 -0700
+++ b/network/http_pool.rb 2012-03-09 13:25:06.000000000 -0700
@@ -12,6 +12,7 @@
# Use cert information from a Puppet client to set up the http object.
def self.cert_setup(http)
# Just no-op if we don't have certs.
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
return false unless FileTest.exist?(Puppet[:hostcert]) and FileTest.exist?(Puppet[:localcacert])
http.cert_store = ssl_host.ssl_store
EOD
cd /usr/lib/ruby/site_ruby/1.9.1/puppet && patch -p1 < /tmp/patch
cat > /etc/puppet/puppet.conf << EOD
<%= snippets "puppet.conf" -%>
EOD
/usr/bin/touch /etc/puppet/namespaceauth.conf
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag --server <%= @host.puppetmaster %> --no-daemonize
# Set up a proper run for after boot which will be replaced by puppet
#echo -e "# Puppet Name: puppet-agent\n*/5 * * * * /usr/local/sbin/run_puppet\n" | crontab -
# Fix bug in Arch installer
grub-install --recheck /dev/sda
Name: "Arch Install"
Template kind: "finish"
Content:
# Network config - set this to your nameserver!
/bin/cat > /etc/resolv.conf << EOF
search <%= @host.domain %>
nameserver 192.168.100.1
EOF
# Trash the disk, see releng bug #
dd if=/dev/zero of=/dev/sda count=1 bs=512
# Install profle
wget <%= foreman_url("script") %> -O /tmp/foreman.aif
/sbin/aif -p automatic -c /tmp/foreman.aif
# Set root password (can't be done in a sub-script due to variable expansion)
/bin/echo 'root:<%= root_pass %>' | chroot /mnt /usr/sbin/chpasswd -e
# Finish script
mkdir -p /mnt/tmp
wget <%= foreman_url("finish") %> -O /mnt/tmp/foreman.postinstall
# Execute chroot script
mount -o bind /dev /mnt/dev
mount -o bind /run /mnt/run
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
chmod +x /mnt/tmp/foreman.postinstall
cp /etc/resolv.conf /mnt/etc/resolv.conf
chroot /mnt /tmp/foreman.postinstall
# Built, notify foreman
/usr/bin/wget --quiet --output-document=/dev/null --no-check-certificate <%= foreman_url %>
# Reboot
/sbin/shutdown -r now
Name: "Arch PXELinux"
Template kind: "PXELinux"
Content:
DEFAULT menu
PROMPT 0
MENU TITLE Archlinux Installer
TIMEOUT 50
TOTALTIMEOUT 6000
ONTIMEOUT arch_nfs
LABEL arch_http
TEXT HELP
Boot the Arch Linux live medium (Using HTTP). It allows you to install Arch Linux or
perform system maintenance.
ENDTEXT
MENU LABEL Boot Arch Linux (HTTP)
LINUX <%= @kernel %>
INITRD <%= @initrd %>
APPEND archisobasedir=arch archiso_http_srv=http://192.168.100.1:23575/ script=http://192.168.100.1/unattended/provision
IPAPPEND 3
LABEL arch_nfs
TEXT HELP
Boot the Arch Linux live medium (Using NFS). It allows you to install Arch Linux or
perform system maintenance.
ENDTEXT
MENU LABEL Boot Arch Linux (NFS)
LINUX <%= @kernel %>
INITRD <%= @initrd %>
APPEND archisobasedir=arch archiso_nfs_srv=192.168.100.1:/srv/archiso/mnt script=http://192.168.100.1/unattended/provision
IPAPPEND 3
Name: "Arch - sda"
Content:
# can be set to 'uuid', 'dev', 'label', or leave empty for 'dev'
PART_ACCESS=uuid
# These variables are mandatory
GRUB_DEVICE=/dev/sda
PARTITIONS='/dev/sda 100:ext2:+ 512:swap *:ext3'
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 ext3;yes;/;target;no_opts;no_label;no_params'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment