From: root Date: Fri, 6 Jun 2014 15:02:47 +0000 (-0400) Subject: initial commit X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2d1f80141012c71750cb16bb6d16f48f4ea53a45;p=fai-configs.git initial commit --- 2d1f80141012c71750cb16bb6d16f48f4ea53a45 diff --git a/class/10-base-classes b/class/10-base-classes new file mode 100755 index 0000000..7ff11a1 --- /dev/null +++ b/class/10-base-classes @@ -0,0 +1,8 @@ +#! /bin/bash + +# Echo architecture and OS name in uppercase. Do NOT remove these two lines. +uname -s | tr '[:lower:]' '[:upper:]' +[ -x "`which dpkg`" ] && dpkg --print-architecture | tr a-z A-Z + +[ -f /etc/RUNNING_FROM_FAICD ] && echo "FAICD" +exit 0 diff --git a/class/20-hwdetect.source b/class/20-hwdetect.source new file mode 100755 index 0000000..da8a0b0 --- /dev/null +++ b/class/20-hwdetect.source @@ -0,0 +1,50 @@ +#! /bin/bash + +# (c) Thomas Lange, 2002-2009, lange@informatik.uni-koeln.de + +# NOTE: Files named *.source will be evaluated, but their output ignored. Instead +# the contents of $newclasses will be added to the list of defined classes. + +[ $do_init_tasks -eq 1 ] || return 0 # Do only execute when doing install + +echo 0 > /proc/sys/kernel/printk + +# load all IDE drivers + +# DMA does not work if we load all modules in drivers/ide, so only try pci modules +if [ -d /lib/modules/$(uname -r)/kernel/drivers/ide/pci ] ; then + mod=$(find /lib/modules/$(uname -r)/kernel/drivers/ide/pci -type f | sed 's/\.ko$//' | sed 's/.*\///') + for i in $mod; do + modprobe $i 1>/dev/null 2>&1 + done +fi + +# Booting from CD does not always enable DMA. +for d in $( echo /proc/ide/hd[a-z] 2>/dev/null); do + [ -d $d ] && echo "using_dma:1" > $d/settings +done + +# load additional kernel modules +kernelmodules="usbkbd ide-disk" +case $(uname -r) in + 2.6*) kernelmodules="$kernelmodules mptspi dm-mod md-mod aes dm-crypt" ;; +esac + +for mod in $kernelmodules; do + [ "$verbose" ] && echo loading kernel module $mod + modprobe -a $mod 1>/dev/null 2>&1 +done + +# let discover do most of the job +#[ -x /sbin/discover-modprobe ] && /sbin/discover-modprobe + +# now we can mount the USB filesystem +mount -t usbfs usbfs /proc/bus/usb + +modprobe -a sd_mod sr_mod + +echo $printk > /proc/sys/kernel/printk + +set_disk_info # calculate number of available disks +save_dmesg # save new boot messages (from loading modules) + diff --git a/class/50-host-classes b/class/50-host-classes new file mode 100755 index 0000000..49ae3de --- /dev/null +++ b/class/50-host-classes @@ -0,0 +1,24 @@ +#! /bin/bash + +# assign classes hosts + +# use a list of classes for our demo machine +case $HOSTNAME in + faiserver) + echo "FAIBASE DEMO FAISERVER" ;; + demohost) + echo "FAIBASE DHCPC DEMO" ;; + gnomehost) + echo "FAIBASE DHCPC DEMO XORG GNOME";; + atom*) + echo "FAIBASE DHCPC DEMO" ;; + bear) + echo "FAIBASE DHCPC LVM_XEN_SERVER XEN" ;; + puma) + echo "FAIBASE DHCPC RAID_XEN_VIRTUAL" ;; + *) + echo "FAIBASE DHCPC" ;; +esac + +(ifclass I386 || ifclass AMD64) && echo GRUB_PC +exit 0 diff --git a/class/FAIBASE.var b/class/FAIBASE.var new file mode 100644 index 0000000..c3901d7 --- /dev/null +++ b/class/FAIBASE.var @@ -0,0 +1,27 @@ +# default values for installation. You can override them in your *.var files + +# allow installation of packages from unsigned repositories +FAI_ALLOW_UNSIGNED=1 + +CONSOLEFONT= +KEYMAP=us-latin1 + +# Set UTC=yes if your system clock is set to UTC (GMT), and UTC=no if not. +UTC=yes +TIMEZONE=Europe/Berlin + +# root password for the new installed linux system; md5 and crypt are possible +# pw is "fai" +ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1' + +# MODULESLIST contains modules that will be loaded by the new system, +# not during installation these modules will be written to /etc/modules +# If you need a module during installation, add it to $kernelmodules +# in 20-hwdetect.source. But discover should do most of this job +MODULESLIST="usbkbd ehci-hcd ohci-hcd uhci-hcd usbhid psmouse" + +# erros in tasks greater than this value will cause the installation to stop +STOP_ON_ERROR=700 + +# use the new partitioning tool +USE_SETUP_STORAGE=1 diff --git a/class/GERMAN.var b/class/GERMAN.var new file mode 100644 index 0000000..219e3f7 --- /dev/null +++ b/class/GERMAN.var @@ -0,0 +1,2 @@ +# german environment +KEYMAP=de-latin1-nodeadkeys diff --git a/debconf/FAIBASE b/debconf/FAIBASE new file mode 100644 index 0000000..6d2e9dd --- /dev/null +++ b/debconf/FAIBASE @@ -0,0 +1,9 @@ +passwd passwd/shadow boolean true +exim4-config exim4/dc_eximconfig_configtype select local delivery only; not on a network +locales locales/default_environment_locale select en_US.UTF-8 +locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8 +xserver-xorg xserver-xorg/config/inputdevice/keyboard/model string pc105 +xserver-xorg xserver-xorg/autodetect_monitor boolean false +xserver-xorg xserver-xorg/autodetect_keyboard boolean true +xserver-xorg xserver-xorg/autodetect_mouse boolean true +xserver-xorg xserver-xorg/autodetect_video_card boolean true diff --git a/debconf/FAIBASE.bak b/debconf/FAIBASE.bak new file mode 100644 index 0000000..6d2e9dd --- /dev/null +++ b/debconf/FAIBASE.bak @@ -0,0 +1,9 @@ +passwd passwd/shadow boolean true +exim4-config exim4/dc_eximconfig_configtype select local delivery only; not on a network +locales locales/default_environment_locale select en_US.UTF-8 +locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8 +xserver-xorg xserver-xorg/config/inputdevice/keyboard/model string pc105 +xserver-xorg xserver-xorg/autodetect_monitor boolean false +xserver-xorg xserver-xorg/autodetect_keyboard boolean true +xserver-xorg xserver-xorg/autodetect_mouse boolean true +xserver-xorg xserver-xorg/autodetect_video_card boolean true diff --git a/debconf/FAISERVER b/debconf/FAISERVER new file mode 100644 index 0000000..be6e8b4 --- /dev/null +++ b/debconf/FAISERVER @@ -0,0 +1,2 @@ +# Should the server be started by inetd? +tftpd-hpa tftpd-hpa/use_inetd boolean false diff --git a/debconf/FAISERVER.bak b/debconf/FAISERVER.bak new file mode 100644 index 0000000..be6e8b4 --- /dev/null +++ b/debconf/FAISERVER.bak @@ -0,0 +1,2 @@ +# Should the server be started by inetd? +tftpd-hpa tftpd-hpa/use_inetd boolean false diff --git a/debconf/GERMAN b/debconf/GERMAN new file mode 100644 index 0000000..97ac8e9 --- /dev/null +++ b/debconf/GERMAN @@ -0,0 +1,3 @@ +locales locales/default_environment_locale select de_DE.UTF-8 +locales locales/locales_to_be_generated multiselect de_DE.UTF-8 UTF-8 +xserver-xorg xserver-xorg/config/inputdevice/keyboard/layout string de diff --git a/disk_config/FAIBASE b/disk_config/FAIBASE new file mode 100644 index 0000000..0f44dcc --- /dev/null +++ b/disk_config/FAIBASE @@ -0,0 +1,12 @@ +# example of new config file for setup-storage +# +# + +disk_config disk1 disklabel:msdos bootable:1 fstabkey:uuid + +primary / 250 ext3 rw,noatime,errors=remount-ro +logical swap 200-1000 swap rw +logical /var 600-1300 ext3 rw,noatime createopts="-L var -m 5" tuneopts="-c 0 -i 0" +logical /tmp 100-1G ext3 rw,noatime,nosuid,nodev createopts="-L tmp -m 0" tuneopts="-c 0 -i 0" +logical /usr 1G-8G ext3 rw,noatime,nodev createopts="-L usr" +logical /home 100-50% ext3 rw,noatime,nosuid,nodev createopts="-L home -m 1" tuneopts="-c 0 -i 0" diff --git a/disk_config/FAISERVER b/disk_config/FAISERVER new file mode 100644 index 0000000..43d0ad0 --- /dev/null +++ b/disk_config/FAISERVER @@ -0,0 +1,13 @@ +# example of new config file for setup-storage +# +# + +disk_config disk1 disklabel:msdos fstabkey:uuid + +primary / 300 ext3 rw,noatime,errors=remount-ro +logical swap 200-1000 swap rw +logical /var 600-5G ext3 rw,noatime,nosuid,nodev createopts="-m15" tuneopts="-c 0 -i 0" +logical /tmp 100-1000 ext3 rw,noatime,nosuid,nodev createopts="-m 0" tuneopts="-c 0 -i 0" +logical /usr 1G-6G ext3 rw,noatime +logical /home 100-40% ext3 rw,noatime,nosuid,nodev createopts="-m 1" tuneopts="-c 0 -i 0" +logical /srv 1G-50% ext3 rw,noatime createopts="-m 1" tuneopts="-c 0 -i 0" diff --git a/disk_config/LVM_XEN_SERVER b/disk_config/LVM_XEN_SERVER new file mode 100644 index 0000000..dded9f7 --- /dev/null +++ b/disk_config/LVM_XEN_SERVER @@ -0,0 +1,24 @@ +disk_config disk1 fstabkey:uuid +primary /boot 100 ext3 rw +primary swap 256 swap sw +primary / 2000 ext3 rw +logical /tmp 1000 ext3 rw,nosuid +logical /usr 2000 ext3 rw +logical /var 2000 ext3 rw +logical - 0- - - + +disk_config lvm +vg XENU disk1.8 +XENU-worm_ - 2000 ext3 - +XENU-wormswap - 500 swap - +XENU-worm_tmp - 500 ext3 - +XENU-worm_usr - 2000 ext3 - +XENU-worm_var - 2000 ext3 - +XENU-bull_ - 2000 ext3 - +XENU-bullswap - 500 swap - +XENU-bull_tmp - 500 ext3 - +XENU-bull_usr - 2000 ext3 - +XENU-bull_var - 2000 ext3 - +XENU-bull_var_spool - 4000 ext3 - +XENU-bull_var_mail - 100000 ext3 - + diff --git a/disk_config/RAID_XEN_VIRTUAL b/disk_config/RAID_XEN_VIRTUAL new file mode 100644 index 0000000..0c43674 --- /dev/null +++ b/disk_config/RAID_XEN_VIRTUAL @@ -0,0 +1,20 @@ +disk_config hda virtual +primary - 2000 - - +primary - 500 - - +primary - 500 - - +primary - 2000 - - +primary - 2000 - - + +disk_config sda virtual +primary - 2000 - - +primary - 500 - - +primary - 500 - - +primary - 2000 - - +primary - 2000 - - + +disk_config raid +raid1 / hda1,sda1 ext3 rw +raid1 swap hda2,sda2 swap sw +raid1 /tmp hda3,sda3 ext3 rw,nosuid,nodev +raid1 /usr hda4,sda4 ext3 rw +raid1 /var hda5,sda5 ext3 rw diff --git a/files/boot/grub/menu.lst/GRUB b/files/boot/grub/menu.lst/GRUB new file mode 100644 index 0000000..18ce0a2 --- /dev/null +++ b/files/boot/grub/menu.lst/GRUB @@ -0,0 +1,43 @@ +# +timeout 5 +default 0 +color cyan/blue white/blue + +### BEGIN AUTOMAGIC KERNELS LIST +## lines between the AUTOMAGIC KERNELS LIST markers will be modified +## by the debian update-grub script except for the default optons below + +## DO NOT UNCOMMENT THEM, Just edit them to your needs + +## ## Start Default Options ## +## default kernel options +# kopt=root=#ROOT_PARTITION# ro + +## default grub root device +## e.g. groot=(hd0,0) +# groot=#GROOT# + +## should update-grub create alternative boot options +## e.g. alternative=true +## alternative=false +# alternative=true + +## should update-grub lock alternative boot options +## e.g. lockalternative=true +## lockalternative=false +# lockalternative=true + +## altoption boot targets option +## multiple altoptions lines are allowed +## e.g. altoptions=(extra menu suffix) extra boot options +## altoptions=(recovery mode) single +# altoptions=(recovery mode) single + +## add memtest86 if found +# memtest86=true + +## ## End Default Options ## + +### END DEBIAN AUTOMAGIC KERNELS LIST + + diff --git a/files/boot/grub/menu.lst/postinst b/files/boot/grub/menu.lst/postinst new file mode 100755 index 0000000..9802193 --- /dev/null +++ b/files/boot/grub/menu.lst/postinst @@ -0,0 +1,27 @@ +#! /bin/bash + +error=0 ; trap "error=$((error|1))" ERR + +set -a + +if [ -r $LOGDIR/disk_var.sh ] ; then + . $LOGDIR/disk_var.sh +else + echo "disk_var.sh not found!" + exit 0 +fi + +# if class NOMBR is defined, write boot loader into root partition, not into mbr +ifclass NOMBR && BOOT_DEVICE=$BOOT_PARTITION + +[ -z "$BOOT_DEVICE" ] && exit 701 +[ -z "$BOOT_PARTITION" ] && exit 702 + +$ROOTCMD grub-install --no-floppy $(device2grub $BOOT_DEVICE) +GROOT=$(device2grub $BOOT_PARTITION) +perl -pi -e 's/#(\w+)#/$ENV{$1}/g' $2 +$ROOTCMD /usr/sbin/update-grub +echo "Grub installed on $BOOT_DEVICE on $GROOT" + +exit $error + diff --git a/files/etc/apache2/conf.d/FAISERVER b/files/etc/apache2/conf.d/FAISERVER new file mode 100644 index 0000000..a648620 --- /dev/null +++ b/files/etc/apache2/conf.d/FAISERVER @@ -0,0 +1,24 @@ + + AllowOverride None + Options None + Order deny,allow + Deny from all + Allow from 192.168.1 + + + + AllowOverride None + Options None + Order deny,allow +# Deny from all + Allow from all + + + + AllowOverride None + Options None + Order deny,allow +# Deny from all + Allow from all + + diff --git a/files/etc/approx/approx.conf/FAISERVER b/files/etc/approx/approx.conf/FAISERVER new file mode 100644 index 0000000..51b4b87 --- /dev/null +++ b/files/etc/approx/approx.conf/FAISERVER @@ -0,0 +1,3 @@ +debian http://cdn.debian.net/debian +security http://security.debian.org/debian-security +cskoeln http://fai-project.org/download diff --git a/files/etc/apt-proxy/apt-proxy-v2.conf/FAISERVER b/files/etc/apt-proxy/apt-proxy-v2.conf/FAISERVER new file mode 100644 index 0000000..e69de29 diff --git a/files/etc/default/tftpd-hpa/FAISERVER b/files/etc/default/tftpd-hpa/FAISERVER new file mode 100644 index 0000000..f432436 --- /dev/null +++ b/files/etc/default/tftpd-hpa/FAISERVER @@ -0,0 +1,3 @@ +#Defaults for tftpd-hpa +RUN_DAEMON="yes" +OPTIONS="-l -s /srv/tftp" diff --git a/files/etc/dhcp3/dhcpd.conf/FAISERVER b/files/etc/dhcp3/dhcpd.conf/FAISERVER new file mode 100644 index 0000000..ae5fc31 --- /dev/null +++ b/files/etc/dhcp3/dhcpd.conf/FAISERVER @@ -0,0 +1,49 @@ +# dhcpd.conf for a fai install server +# replace faiserver with the name of your install server + +deny unknown-clients; +option dhcp-max-message-size 2048; +use-host-decl-names on; +#always-reply-rfc1048 on; + +subnet 192.168.1.0 netmask 255.255.255.0 { + option routers 192.168.1.250; + option domain-name "fai"; + option domain-name-servers 192.168.1.250; + option time-servers faiserver; + option ntp-servers faiserver; + server-name faiserver; + next-server faiserver; + filename "fai/pxelinux.0"; +} + +# generate more lines with: + +# perl -e 'for (1..25) {printf "host atom%02s {hardware ethernet XXX:$_;fixed-address atom%02s;}\n",$_,$_;}' + +# replace 1:2:3:4:5:XX with the hardware addresses of your clients +host atom01 {hardware ethernet 1:2:3:4:5:1;fixed-address atom01;} +host atom02 {hardware ethernet 1:2:3:4:5:2;fixed-address atom02;} +host atom03 {hardware ethernet 1:2:3:4:5:3;fixed-address atom03;} +host atom04 {hardware ethernet 1:2:3:4:5:4;fixed-address atom04;} +host atom05 {hardware ethernet 1:2:3:4:5:5;fixed-address atom05;} +host atom06 {hardware ethernet 1:2:3:4:5:6;fixed-address atom06;} +host atom07 {hardware ethernet 1:2:3:4:5:7;fixed-address atom07;} +host atom08 {hardware ethernet 1:2:3:4:5:8;fixed-address atom08;} +host atom09 {hardware ethernet 1:2:3:4:5:9;fixed-address atom09;} +host atom10 {hardware ethernet 1:2:3:4:5:10;fixed-address atom10;} +host atom11 {hardware ethernet 1:2:3:4:5:11;fixed-address atom11;} +host atom12 {hardware ethernet 1:2:3:4:5:12;fixed-address atom12;} +host atom13 {hardware ethernet 1:2:3:4:5:13;fixed-address atom13;} +host atom14 {hardware ethernet 1:2:3:4:5:14;fixed-address atom14;} +host atom15 {hardware ethernet 1:2:3:4:5:15;fixed-address atom15;} +host atom16 {hardware ethernet 1:2:3:4:5:16;fixed-address atom16;} +host atom17 {hardware ethernet 1:2:3:4:5:17;fixed-address atom17;} +host atom18 {hardware ethernet 1:2:3:4:5:18;fixed-address atom18;} +host atom19 {hardware ethernet 1:2:3:4:5:19;fixed-address atom19;} +host atom20 {hardware ethernet 1:2:3:4:5:20;fixed-address atom20;} +host atom21 {hardware ethernet 1:2:3:4:5:21;fixed-address atom21;} +host atom22 {hardware ethernet 1:2:3:4:5:22;fixed-address atom22;} +host atom23 {hardware ethernet 1:2:3:4:5:23;fixed-address atom23;} +host atom24 {hardware ethernet 1:2:3:4:5:24;fixed-address atom24;} +host atom25 {hardware ethernet 1:2:3:4:5:25;fixed-address atom25;} diff --git a/files/etc/fai/apt/sources.list/FAISERVER b/files/etc/fai/apt/sources.list/FAISERVER new file mode 100644 index 0000000..f3611af --- /dev/null +++ b/files/etc/fai/apt/sources.list/FAISERVER @@ -0,0 +1,8 @@ +# via local partial mirror (was mirror on fai-cd) +deb http://faiserver/debian squeeze main +#deb http://faiserver/debian squeeze/updates main +#deb http://faiserver/debian-security squeeze/updates main contrib non-free + +# via approx +deb http://faiserver:9999/debian squeeze main contrib non-free +deb http://faiserver:9999/security squeeze/updates main contrib non-free diff --git a/files/etc/fai/fai.conf/FAISERVER b/files/etc/fai/fai.conf/FAISERVER new file mode 100644 index 0000000..a8fe212 --- /dev/null +++ b/files/etc/fai/fai.conf/FAISERVER @@ -0,0 +1,37 @@ +# $Id: fai.conf 5526 2009-09-28 08:29:37Z lange $ + +# /etc/fai/fai.conf -- configuration for FAI (Fully Automatic Installation) + +# how to access the fai config space +# If undefined here, make-fai-nfsroot/fai-setup will use default value +# nfs:///$FAI_CONFIGDIR +# supported URL-types: nfs, file, cvs, cvs+ssh, svn+file, svn+http, +# git, git+http, hg+http +#FAI_CONFIG_SRC=nfs://yourservername/path/to/config/space + +# LOGUSER: an account on the install server which saves all log-files +# and which can change the kernel that is booted via network. +# Configure .rhosts for this account and PAM, so that root can log in +# from all install clients without password. This account should have +# write permissions for /srv/tftp/fai. For example, you can use write +# permissions for the group linuxadm. chgrp linuxadm /srv/tftp/fai;chmod +# g+w /srv/tftp/fai. If the variable is undefined, this feature is disabled. +# Define it, to enable it, eg. LOGUSER=fai +LOGUSER=fai + +# set protocol type for saving logs. Values: ssh, rsh, ftp +FAI_LOGPROTO=ssh + +# Access to Debian mirror via NFS mounted directory +# If FAI_DEBMIRROR is defined, install clients mount it to $MNTPOINT +#FAI_DEBMIRROR=yournfs debianmirror:/path/to/debianmirror + + +# The following variables are read only for almost every user. +# Do not change them unless you know what you are doing! + +# mount point where the mirror will be mounted +MNTPOINT=/media/mirror + +# the local configuration directory on the install client +FAI=/var/lib/fai/config diff --git a/files/etc/fai/make-fai-nfsroot.conf/FAISERVER b/files/etc/fai/make-fai-nfsroot.conf/FAISERVER new file mode 100644 index 0000000..6908d18 --- /dev/null +++ b/files/etc/fai/make-fai-nfsroot.conf/FAISERVER @@ -0,0 +1,36 @@ +# these variables are only used by make-fai-nfsroot(8) +# here you can use also variables defined in fai.conf + +# directory on the install server where the nfsroot for FAI is +# created, approx size: 390MB, also defined in bootptab or dhcp.conf +NFSROOT=/srv/fai/nfsroot + +# TFTP directory for FAI files +TFTPROOT=/srv/tftp/fai + +# location of the configuration space on the install server +FAI_CONFIGDIR=/srv/fai/config + +# Add a line for mirrorhost and installserver when DNS is not available +# on the clients. This line(s) will be added to $nfsroot/etc/hosts. +NFSROOT_ETC_HOSTS="192.168.1.250 faiserver" + +# Parameter for debootstrap: " " +FAI_DEBOOTSTRAP="squeeze http://faiserver:9999/debian" + +# the encrypted (with md5 or crypt) root password on all install clients during +# installation process; used when log in via ssh; default pw is: fai +FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1' + +# location of a identity.pub file; this user can log to the install +# clients in as root without a password; only useful with FAI_FLAGS="sshd" +#SSH_IDENTITY=/home/admin/.ssh/identity.pub + +# directory of hooks to be sourced at the end of make-fai-nfsroot, +# i.e they have to be shell scripts. +#NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/ + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# following lines should be read only for most of you + +FAI_DEBOOTSTRAP_OPTS="--exclude=info" diff --git a/files/etc/fai/menu.lst/FAISERVER b/files/etc/fai/menu.lst/FAISERVER new file mode 100644 index 0000000..4ce0b62 --- /dev/null +++ b/files/etc/fai/menu.lst/FAISERVER @@ -0,0 +1,44 @@ +# grub menu.lst for fai-cd + +# Boot automatically after some secs. +timeout 30 + +color light-gray/black light-gray/red +default 6 + +title | +root (cd) +title +------------------------------------------------------+ +root (cd) +title | FAI-CD (c) Thomas Lange, lange@debian.org | +root (cd) +title | _VERSIONSTRING_ | +root (cd) +title +------------------------------------------------------+ +root (cd) +title | +root (cd) +title | + +title boot from local disk +rootnoverify (hd0) +chainloader +1 + +title Fully Automatic Installation - demohost (pw: installme) +password installme +kernel /boot/vmlinuz boot=live FAI_FLAGS="verbose,createvt" FAI_ACTION=install hostname=demohost +initrd /boot/initrd.img + +title Fully Automatic Installation with GNOME (pw: installme) +password installme +kernel /boot/vmlinuz boot=live FAI_FLAGS="verbose,createvt" FAI_ACTION=install hostname=gnomehost +initrd /boot/initrd.img + +title Fully Automatic Installation - faiserver (pw: installme) +password installme +kernel /boot/vmlinuz boot=live FAI_FLAGS="verbose,createvt" FAI_ACTION=install hostname=faiserver +initrd /boot/initrd.img + +title FAI rescue system, no installation +kernel /boot/vmlinuz boot=live FAI_FLAGS="verbose,createvt" FAI_ACTION=sysinfo hostname=demohost +initrd /boot/initrd.img diff --git a/files/etc/kernel-img.conf/DEFAULT b/files/etc/kernel-img.conf/DEFAULT new file mode 100644 index 0000000..27999ba --- /dev/null +++ b/files/etc/kernel-img.conf/DEFAULT @@ -0,0 +1,5 @@ +do_symlinks = Yes +do_initrd = Yes +silent_modules=yes +clobber_modules=yes +do_boot_enable=no diff --git a/files/etc/motd/FAIBASE b/files/etc/motd/FAIBASE new file mode 100644 index 0000000..9f8fed3 --- /dev/null +++ b/files/etc/motd/FAIBASE @@ -0,0 +1,4 @@ + + +Plan your installation, and FAI installs your plan. + diff --git a/files/etc/rc2.d/S99fai-setup/FAISERVER b/files/etc/rc2.d/S99fai-setup/FAISERVER new file mode 100755 index 0000000..2a56628 --- /dev/null +++ b/files/etc/rc2.d/S99fai-setup/FAISERVER @@ -0,0 +1,29 @@ +#! /bin/bash + +# setup script that is only run once at boot time + +echo "Creating the nfsroot for FAI." + +. /etc/fai/fai.conf +. /etc/fai/make-fai-nfsroot.conf + +if [ ! -d "$FAI_CONFIGDIR/class" ]; then + mkdir -p $FAI_CONFIGDIR + cp -a /usr/share/doc/fai-doc/examples/simple/* $FAI_CONFIGDIR +fi + +# setup network +dhclient eth0 # connection to the outside world (hopefully) +ip addr add 192.168.1.250 dev eth0 # (fixed address of faiserver) +/etc/init.d/nscd restart +/etc/init.d/apache2 restart + +fai-setup -v 2>&1 | tee /var/log/fai-setup.log + +# create default pxelinux boot configuration (boot from local disk) +fai-chboot -o default + +echo "Log files are saved to /var/log/fai-setup.log" + +# remove me +rm $0 diff --git a/hooks/instsoft.FAIBASE b/hooks/instsoft.FAIBASE new file mode 100755 index 0000000..123cbe5 --- /dev/null +++ b/hooks/instsoft.FAIBASE @@ -0,0 +1,3 @@ +#! /bin/bash + +[ -s $target/etc/kernel-img.conf ] || fcopy -Bi /etc/kernel-img.conf diff --git a/hooks/savelog.LAST.source b/hooks/savelog.LAST.source new file mode 100755 index 0000000..48b138f --- /dev/null +++ b/hooks/savelog.LAST.source @@ -0,0 +1,162 @@ +#! /bin/bash + +# parse all log files for error messages +# print errors and warnings found to error.log +# WARNING: This will only work with english error messages! + +errfile=$LOGDIR/error.log + +# Define grep patterns. Do not start or end with an empty line! +globalerrorpatterns="error +fail +warn +bad +no space +syntax +Couldn't stat +Cannot access +is bigger than the limit +did not exist +non existent +not found +couldn't +can't +E: Sorry, broken packages +operator expected +ambiguous redirect +No previous regular expression +No such +Device or resource busy +unknown option +[a-z]\+\.log:E: +No candidate version found +segfault +Couldn't find any package whose name or description matched +cannot create +The following packages have unmet dependencies" + +globalignorepatterns="[a-z]\+\.log:# +Error: Driver 'pcspkr' is already registered, aborting +: bytes packets errors dropped +:+ error=0 +:+ trap error= +task_error_func= +STOP_ON_ERROR= +courier-webadmin +gstreamer0.10-plugins-bad +ibwebadmin +kernel-patch-badram +kolab-webadmin +kolabadmin +gstreamer0.10-plugins-really-bad +gsambad +libad +libtest-nowarnings-perl +libtest-warn-perl +libclass-errorhandler-perl +zope-ploneerrorreporting +libroxen-errormessage +liberror-perl +libgpg-error-dev +libgpg-error0 +^fstab.\+errors=remount +[RT]X packets: +WARNING: unexpected IO-APIC +warned about = ( ) +daemon.warn +kern.warn +rw,errors= +Expect some cache +no error +failmsg +RPC call returned error 101 +deverror.out +(floppy), sector 0 +mount version older than kernel +Can't locate module +Warning only 896MB will be used. +hostname: Host name lookup failure +I can't tell the difference. +warning, not much extra random data, consider using the -rand option +confC._FILE +Warning: 3 database(s) sources +were not found, (but were created) +removing exim +The home dir you specified already exists. +No Rule for /usr/lib/ispell/default.hash. +/usr/sbin/update-fonts-.\+: warning: absolute path +hostname: Unknown server error +EXT2-fs warning: checktime reached +RPC: sendmsg returned error 101 +can't print them to stdout. Define these classes +warning: downgrading +suppress emacs errors +echo Error: +Can't open dependencies file +documents in /usr/doc are no longer supported +if you have both a SCSI and an IDE CD-ROM +Warning: /proc/ide/hd?/settings interface is obsolete, and will be removed soon +Monitoring disabled +Error: only one processor found. +Error Recovery Strategy: +sector 0 does not have an +syslogin_perform_logout: logout() returned an error +grub is not in an XFS filesystem. +grub-install: line 374: +grub-probe: error: Cannot open \`/boot/grub/device.map' +is harmless +not updating .\+ font directory data. +register_serial(): autoconfig failed +Fontconfig error: Cannot load default config file +asking for cache data failed +However, I can not read the target: +fai-kernels/modules.dep: No such file +Warning: The partition table looks like it was made +task_error=0 +^info: Trying to set +warning: /usr/lib/X11/fonts +can't read /etc/udev/rules.d/z25_persistent-net.rules +/cow': No such file or directory +Dummy start-stop-daemon called +X: bytes packets errors +ACPI Error +ACPI Warning +cannot stat \`/etc/modprobe.d/\*.conf' +cdrom: open failed." + +# add pattern on some conditions +if [ -n $FAI_ALLOW_UNSIGNED ] ; then + globalignorepatterns="$globalignorepatterns +WARNING: untrusted versions +Ignoring these trust violations" +fi +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Here you can define your own patterns. Put one pattern in a line, +# do not create empty lines. +myerrorpatterns="XXXXX" +myignorepatterns="XXXXX" +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# The main routine +errorpatterns="$globalerrorpatterns +$myerrorpatterns" +ignorepatterns="$globalignorepatterns +$myignorepatterns" + +cd $LOGDIR || exit 3 +if [ -s $errfile ]; then + echo "Errorfile already exists. Aborting." + exit +fi + +grep -i "$errorpatterns" *.log | grep -vi "$ignorepatterns" > $errfile +if [ "$verbose" ]; then + egrep -v '^software.log:' $errfile > $LOGDIR/tempfile + mv $LOGDIR/tempfile $errfile +fi + +if [ -s $errfile ]; then + echo "ERRORS found in log files. See $errfile" +else + echo "Congratulations! No errors found in log files." + export flag_reboot=1 +fi diff --git a/package_config/DEFAULT b/package_config/DEFAULT new file mode 100644 index 0000000..c12a917 --- /dev/null +++ b/package_config/DEFAULT @@ -0,0 +1,26 @@ +PACKAGES aptitude I386 +linux-image-2.6-486 initramfs-tools +memtest86+ + +PACKAGES aptitude CHROOT +linux-image-486- +linux-image-amd64- + +PACKAGES aptitude AMD64 +linux-image-2.6-amd64 initramfs-tools +memtest86+ + +PACKAGES aptitude XEN +xen-linux-system-2.6.26-2-xen-amd64 + +PACKAGES aptitude DHCPC +dhcp3-client + +PACKAGES aptitude GRUB +grub-legacy lilo- + +PACKAGES aptitude GRUB_PC +grub-pc grub-legacy- lilo- + +PACKAGES aptitude LILO +lilo grub- diff --git a/package_config/DEMO b/package_config/DEMO new file mode 100644 index 0000000..0502f9b --- /dev/null +++ b/package_config/DEMO @@ -0,0 +1,11 @@ +# some packages we need on a demo machine + +PACKAGES aptitude +fortune-mod fortunes +rstat-client #rstatd +rusers rusersd + +# only when also class XORG is defined +PACKAGES aptitude XORG +bb xpenguins +#frozen-bubble diff --git a/package_config/FAIBASE b/package_config/FAIBASE new file mode 100644 index 0000000..9200feb --- /dev/null +++ b/package_config/FAIBASE @@ -0,0 +1,25 @@ +PACKAGES aptitude +fai-client +cfengine2 +cron +debconf-utils +file +hdparm +jove +less +linuxlogo +nfs-common +nscd +rdate +rsync +openssh-client openssh-server +strace +tcsh +time +procinfo +exim4 +eject +locales +console-common +pciutils usbutils +lvm2 diff --git a/package_config/FAIBASE~ b/package_config/FAIBASE~ new file mode 100644 index 0000000..e633c3d --- /dev/null +++ b/package_config/FAIBASE~ @@ -0,0 +1,26 @@ +PACKAGES aptitude +fai-client +cfengine2 +cron +dialog +debconf-utils +file +hdparm +jove +less +linuxlogo +nfs-common +nscd +rdate +rsync +openssh-client openssh-server +strace +tcsh +time +procinfo +exim4 +eject +locales +console-common +pciutils usbutils +lvm2 diff --git a/package_config/FAISERVER b/package_config/FAISERVER new file mode 100644 index 0000000..33b4210 --- /dev/null +++ b/package_config/FAISERVER @@ -0,0 +1,9 @@ +PACKAGES aptitude +fai-quickstart + +dhcp3-client +debmirror tcpdump +apache2 +genisoimage grub +approx lftp +syslinux-common diff --git a/package_config/GERMAN b/package_config/GERMAN new file mode 100644 index 0000000..d33b05e --- /dev/null +++ b/package_config/GERMAN @@ -0,0 +1,5 @@ +PACKAGES aptitude +german + +PACKAGES aptitude GNOME +iceweasel-l10n-de icedove-l10n-de diff --git a/package_config/GNOME b/package_config/GNOME new file mode 100644 index 0000000..b2d1195 --- /dev/null +++ b/package_config/GNOME @@ -0,0 +1,10 @@ +PACKAGES aptitude + +iceweasel +#icedove +menu gdm +gnome-core +gconf-editor +gnome-screensaver gnome-system-monitor gnome-system-tools +gnome-network-admin +libgnomevfs2-bin diff --git a/package_config/XORG b/package_config/XORG new file mode 100644 index 0000000..45ac35d --- /dev/null +++ b/package_config/XORG @@ -0,0 +1,6 @@ +PACKAGES aptitude +xorg xserver-xorg-video-all xserver-xorg-input-all +ttf-freefont +xscreensaver +xscreensaver-gl +xterm diff --git a/scripts/DEMO/10-misc b/scripts/DEMO/10-misc new file mode 100755 index 0000000..ac9fb19 --- /dev/null +++ b/scripts/DEMO/10-misc @@ -0,0 +1,17 @@ +#! /bin/bash + +# (c) Thomas Lange, 2001-2009, lange@debian.org + +ifclass XORG && { + fcopy -M /etc/X11/xorg.conf +# [ -n "$VIDEODRIVER" ] || VIDEODRIVER=vesa +# grep -q %%VIDEODRIVER%% $target/etc/X11/xorg.conf && +# perl -pi.orig -pe "s/%%VIDEODRIVER%%/$VIDEODRIVER/" $target/etc/X11/xorg.conf +} + +# add a demo user account +if ! $ROOTCMD getent passwd demo ; then + $ROOTCMD adduser --disabled-login --gecos "fai demo user" demo +# echo "demo:$ROOTPW" | $ROOTCMD chpasswd --encrypted + $ROOTCMD usermod -p "$ROOTPW" demo +fi diff --git a/scripts/DEMO/30-demo b/scripts/DEMO/30-demo new file mode 100755 index 0000000..69c2a28 --- /dev/null +++ b/scripts/DEMO/30-demo @@ -0,0 +1,20 @@ +#! /usr/sbin/cfagent -f + +control: + any:: + actionsequence = ( files editfiles ) + EditFileSize = ( 30000 ) + +files: + any:: + +# floppy and cdroms are accessible for all + ${target}/dev include=fd* mode=666 action=fixall r=1 + ${target}/dev include=sr* mode=444 action=fixall r=1 + +editfiles: + any:: + + { ${target}/etc/init.d/sysklogd + ReplaceAll "^SYSLOGD=.*" With 'SYSLOGD="-m 360"' + } diff --git a/scripts/FAIBASE/10-misc b/scripts/FAIBASE/10-misc new file mode 100755 index 0000000..7b8c8f4 --- /dev/null +++ b/scripts/FAIBASE/10-misc @@ -0,0 +1,37 @@ +#! /bin/bash + +# (c) Thomas Lange, 2001-2008, lange@debian.org + +error=0 ; trap "error=$((error|1))" ERR + +# a list of modules which are loaded at boot time +fcopy -i /etc/modules +for module in $MODULESLIST; do + ainsl -a $target/etc/modules "^$module$" +done + +fcopy /etc/hostname || echo $HOSTNAME > $target/etc/hostname +echo $TIMEZONE > $target/etc/timezone +ln -fs /usr/share/zoneinfo/${TIMEZONE} $target/etc/localtime + +if [ -n "$IPADDR" ]; then + ifclass DHCPC || ainsl -s $FAI_ROOT/etc/hosts "$IPADDR $HOSTNAME.$DOMAIN $HOSTNAME" +fi + +fcopy -iM /etc/hosts /etc/motd + +# set root password +#echo "root:$ROOTPW" | $ROOTCMD chpasswd --encrypted +$ROOTCMD usermod -p "$ROOTPW" root +# make /root accessible only by root +chmod 0700 $target/root +chown root:root $target/root +# copy default dotfiles for root account +fcopy -ir /root + +# create keyboard layout table +$ROOTCMD bash -c "echo 'console-data console-data/keymap/full select $KEYMAP' | debconf-set-selections" +$ROOTCMD install-keymap $KEYMAP || true +# dumpkeys | gzip -9f >$target/etc/console/boottime.kmap.gz + +exit $error diff --git a/scripts/FAIBASE/20-removable_media b/scripts/FAIBASE/20-removable_media new file mode 100755 index 0000000..d6f368a --- /dev/null +++ b/scripts/FAIBASE/20-removable_media @@ -0,0 +1,27 @@ +#! /bin/bash + +# (c) Thomas Lange, 2006,2009, lange@debian.org +# create entries for removable media in fstab and directories in /media + +[ -b $target/dev/fd0 ] && ainsl $target/etc/fstab "/dev/fd0 /media/floppy auto users,noauto 0 0" + +cdromlist() { + [ -f /proc/sys/dev/cdrom/info ] || return + devs=$(grep 'drive name:' /proc/sys/dev/cdrom/info | cut -d ":" -f 2) + for d in $devs; do + echo $d + done +} + +fstabline () { + line=$(printf "%-15s %-15s %-7s %-15s %-7s %s\n" "$1" "$2" "$3" "$4" "$5" "$6") + ainsl $target/etc/fstab "$line" +} + +i=0 +for cdrom in $(cdromlist | tac); do + [ $i -eq 0 ] && ln -s cdrom0 $target/media/cdrom + mkdir -p $target/media/cdrom$i + fstabline /dev/$cdrom /media/cdrom$i udf,iso9660 ro,user,noauto 0 0 + i=$(($i + 1)) +done diff --git a/scripts/FAIBASE/30-interface b/scripts/FAIBASE/30-interface new file mode 100755 index 0000000..783867f --- /dev/null +++ b/scripts/FAIBASE/30-interface @@ -0,0 +1,34 @@ +#! /bin/bash + +error=0 ; trap "error=$((error|1))" ERR + +if ifclass DHCPC && [ $FAI_ACTION != "softupdate" ] +then + cat > $target/etc/network/interfaces <<-EOF + # generated by FAI + auto lo eth0 + iface lo inet loopback + iface eth0 inet dhcp +EOF +elif [ $FAI_ACTION != "softupdate" ] +then + [ -n "$IPADDR" ] && cat > $target/etc/network/interfaces <<-EOF + # generated by FAI + auto lo eth0 + iface lo inet loopback + iface eth0 inet static + address $IPADDR + netmask $NETMASK + broadcast $BROADCAST + gateway $GATEWAYS +EOF + [ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc/networks + [ -s /etc/resolv.conf ] && cp -p /etc/resolv.conf $target/etc +fi + +# here fcopy is mostly used, when installing a client for running in a +# different subnet than during the installation +fcopy -i /etc/resolv.conf +fcopy -iM /etc/network/interfaces /etc/networks + +exit $error diff --git a/scripts/FAIBASE/40-misc b/scripts/FAIBASE/40-misc new file mode 100755 index 0000000..3424a84 --- /dev/null +++ b/scripts/FAIBASE/40-misc @@ -0,0 +1,26 @@ +#! /usr/sbin/cfagent -f + +control: + any:: + actionsequence = ( directories editfiles ) + EditFileSize = ( 30000 ) + +directories: + any:: + ${target}/tmp mode=1777 owner=0 group=0 + +editfiles: + any:: + { ${target}/etc/mailname + AutoCreate + AppendIfNoSuchLine "${HOSTNAME}" + } + + { ${target}/etc/default/rcS + ReplaceAll "^UTC=.*" With "UTC=${UTC}" + } + + { ${target}/etc/inittab + ReplaceAll "/sbin/getty 38400" + With "/sbin/getty -f /etc/issue.linuxlogo 38400" + } diff --git a/scripts/FAISERVER/10-conffiles b/scripts/FAISERVER/10-conffiles new file mode 100755 index 0000000..f8703d8 --- /dev/null +++ b/scripts/FAISERVER/10-conffiles @@ -0,0 +1,17 @@ +#! /bin/bash + +fcopy -Bv /etc/dhcp3/dhcpd.conf /etc/default/tftpd-hpa # not needed /etc/apache2/conf.d +fcopy -Bvr /etc/fai + +fcopy /etc/fai/apt/sources.list /etc/approx.conf + +if [ $FAI_ACTION = "install" ]; then + + # use the same sources.list for the server itself and the clients + cp -a $target/etc/fai/apt $target/etc/ + + rm -f $target/etc/resolv.conf + + # create some host entries + perl -e 'for (1..25) {printf "192.168.1.%s atom%02s\n",$_,$_;}' >> $target/etc/hosts +fi diff --git a/scripts/FAISERVER/20-copy-mirror b/scripts/FAISERVER/20-copy-mirror new file mode 100755 index 0000000..393c164 --- /dev/null +++ b/scripts/FAISERVER/20-copy-mirror @@ -0,0 +1,15 @@ +#! /bin/bash + +# TODO: if we install from network copy the package mirror via, e.g., wget + +[ -d /media/mirror ] || exit 0 + +echo "Copying Debian mirror from CD to local disk. This may take some time." +mkdir -p $target/var/www/debian +cp -a /media/mirror/* $target/var/www/debian + +cd $target/var/www/debian/dists +# this link can only work when squeeze is released. For testing before the release use : ln -s testing squeeze +ln -s stable squeeze + +fcopy -v /etc/rc2.d/S99fai-setup diff --git a/scripts/GRUB/10-setup b/scripts/GRUB/10-setup new file mode 100755 index 0000000..3c22c89 --- /dev/null +++ b/scripts/GRUB/10-setup @@ -0,0 +1,9 @@ +#! /bin/bash +# support for GRUB version 1 (0.97) + +error=0 ; trap "error=$((error|1))" ERR + +fcopy -v /boot/grub/menu.lst + +exit $error + diff --git a/scripts/GRUB/20-initramfs b/scripts/GRUB/20-initramfs new file mode 100755 index 0000000..6142073 --- /dev/null +++ b/scripts/GRUB/20-initramfs @@ -0,0 +1,22 @@ +#! /bin/bash +# support for GRUB version 1 (0.97) + +error=0 ; trap "error=$((error|1))" ERR + +not_up2date() { + if [ $# -eq 0 ] ; then + echo "No package name given!" + return 127 + fi + + egrep -q "(^Unpacking $1 |^Unpacking replacement $1 )" $LOGDIR/*.log + return $? +} + +if [ `not_up2date lvm2` -o `not_up2date mdadm` ] ; then + $ROOTCMD update-initramfs -k all -u +fi + + +exit $error + diff --git a/scripts/GRUB_PC/10-setup b/scripts/GRUB_PC/10-setup new file mode 100755 index 0000000..85e7234 --- /dev/null +++ b/scripts/GRUB_PC/10-setup @@ -0,0 +1,27 @@ +#! /bin/bash +# support for GRUB version 2 (1.98-1) + +error=0 ; trap "error=$((error|1))" ERR + +set -a + +# during softupdate use this file +[ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh + +[ -z "$BOOT_DEVICE" ] && exit 701 + +$ROOTCMD grub-mkdevicemap --no-floppy +# needed for ubuntu +$ROOTCMD grub-mkconfig -o /boot/grub/grub.cfg + +GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE) +# see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606035 +GROOT=$(echo $GROOT | sed 's:md/:md:g') + +$ROOTCMD grub-install --no-floppy "$GROOT" +echo "Grub installed on $BOOT_DEVICE = $GROOT" + +$ROOTCMD update-grub + + +exit $error diff --git a/scripts/LAST/50-misc b/scripts/LAST/50-misc new file mode 100755 index 0000000..6de8856 --- /dev/null +++ b/scripts/LAST/50-misc @@ -0,0 +1,35 @@ +#! /bin/bash + +# copyright Thomas Lange 2001-2007, lange@debian.org + +error=0 ; trap "error=$((error|1))" ERR + +# remove backup files from cfengine +dirs="root etc var" +for path in $dirs; do + find $target/$path -maxdepth 20 -name \*.cfedited -o -name \*.cfsaved | xargs -r rm +done + +[ "$FAI_DEBMIRROR" ] && + ainsl $target/etc/fstab "#$FAI_DEBMIRROR $MNTPOINT nfs ro 0 0" + +# set bios clock +if [ $do_init_tasks -eq 1 ] ; then + case "$UTC" in + no|"") hwopt="--localtime" ;; + yes) hwopt="--utc" ;; + esac + $ROOTCMD hwclock $hwopt --systohc || true +fi + +# Make sure everything is configured properly +echo "Running \"apt-get -f install\" for the last time." +$ROOTCMD apt-get -f install + +lskernels=$(echo $target/boot/vmlinu*) +[ -f ${lskernels%% *} ] || echo "ERROR: No kernel was installed. Have a look at shell.log" +# copy sources.list +fcopy -i /etc/apt/sources.list + +exit $error + diff --git a/scripts/LILO/20-create-liloconf b/scripts/LILO/20-create-liloconf new file mode 100755 index 0000000..85a9d7d --- /dev/null +++ b/scripts/LILO/20-create-liloconf @@ -0,0 +1,72 @@ +#! /bin/bash + +# copyright Thomas Lange 2001-2005, lange@debian.org +# LILO support may be dropped in a future release + +FFLAGS=${FAI_FLAGS// /,} + +cd $target/boot && kernelversion=$(ls vmlinuz-*) + +# if class NOMBR is defined, write boot loader into root partition, not into mbr +ifclass NOMBR && BOOT_DEVICE=$ROOT_PARTITION + +if ifclass LILO; then + fcopy /etc/lilo.conf || { + # if the installed kernel is using an initial ramdisk + if [ -L $target/initrd.img ]; then + initrdopt="initrd=/initrd.img" + fi + # write lilo.conf and install lilo to disk + echo "Creating lilo.conf for /vmlinuz" + cat > $target/etc/lilo.conf <<-EOF + boot=$BOOT_DEVICE + root=$ROOT_PARTITION + install=/boot/boot.b + map=/boot/map + vga=normal + delay=50 + + image=/vmlinuz + append="devfs=nomount $kappend" + $initrdopt + label=linux + read-only + + image=/vmlinuz.old + label=linux.old + read-only + optional + $liloappend +EOF + } +fi + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +ifclass FAI_BOOTPART && { + + rev=`uname -r` + mkdir -p $target/fai-boot + cp -a /boot/vmlinuz-$rev $target/fai-boot + + ifclass LILO && { + # write lilo.conf and install lilo to disk + echo "Add /fai-boot partition to lilo.conf" + + cat >> $target/etc/lilo.conf <<-EOF + image=/fai-boot/boot/$kernelversion + $initrdopt + append="devfs=nomount" + label=FAI +EOF + mkdir $target/fai-boot/etc + cp $target/etc/lilo.conf $target/fai-boot/etc + } + +} + +# now call lilo +# you can also use this +# $ROOTCMD lilo -v +if ifclass LILO; then + $target/sbin/lilo -r $target +fi diff --git a/tests/FAIBASE_TEST b/tests/FAIBASE_TEST new file mode 100755 index 0000000..79bfab2 --- /dev/null +++ b/tests/FAIBASE_TEST @@ -0,0 +1,44 @@ +#! /usr/bin/perl + +use strict; +use warnings; +use Faitest; +package FAITEST; + +setup_test(); +# - - - - - - - - - - - - - - - - - - - - - - - - - - +# now comes the test itself + +my $dev = &getDevByMount("/target/home"); +&checkE2fsAttribute($dev,"Filesystem volume name","home"); +&checkE2fsAttribute($dev,"Maximum mount count","-1"); +&checkE2fsAttribute($dev,"Check interval","0 ()"); + +exit printresult(); +# - - - - - - - - - - - - - - - - - - - - - - - - - - +__END__ + +=head1 NAME + +FAIBASE_TEST - regression test for setup-storage disk layout FAIBASE + +=head1 SYNOPSIS + +FAIBASE_TEST checks some important aspects of setup-storage. The +disk_config/FAIBASE tunes some filesystem parameters upon creation. We +check only the last partition since we expect prior errors to make +creation of the last partition fail. + + Options: + -help simple help + -verbose=n increase verbosity of test script + +=head1 OPTIONS + +=over 8 + +=item B<-help> +simple help + +=item B<-verbose> +increase verbosity of test script diff --git a/tests/Faitest.pm b/tests/Faitest.pm new file mode 100644 index 0000000..bdaf1c1 --- /dev/null +++ b/tests/Faitest.pm @@ -0,0 +1,95 @@ +#! /usr/bin/perl + +# Subroutines for automatic tests +# +# Copyright (C) 2009 Thomas Lange, lange@informatik.uni-koeln.de +# Based on the first version by Sebastian Hetze, 08/2008 + +package FAITEST; + +$errors = 0; + +use Getopt::Long; +use Pod::Usage; +# - - - - - - - - - - - - - - - - - - - - - - - - - - +sub setup_test { + + my $verbose = 0; + my $help = 0; + my $man = 0; + $verbose = $ENV{'debug'} if $ENV{'debug'}; + + my $result = GetOptions ( + "verbose=i" => \$verbose, + "help" => \$help, + "man" => \$man, + + ); + + pod2usage(1) if $help; + pod2usage(-exitstatus => 0, -verbose => 2) if $man; + + open(LOGFILE,">> $ENV{LOGDIR}/test.log") || die "Can't open test.log. $!"; + print LOGFILE "------------ Test $0 starting ------------\n"; +} + +sub printresult { + + # write test result and set next test + my ($nexttest) = @_; + + if ($errors > 0) { + print STDERR "\n===> $0 FAILED with $errors errors\n"; + print LOGFILE "\n===> $0 FAILED with $errors errors\n"; + } else { + print STDERR "\n===> $0 PASSED successfully\n"; + print LOGFILE "\n===> $0 PASSED successfully\n"; + print LOGFILE "NEXTTEST=$nexttest\n" if $nexttest; + } + close (LOGFILE); + return $errors; +} + +sub getDevByMount { + + my $mount = shift; + my $dev = qx#mount|grep $mount|cut -d' ' -f1#; + chomp $dev; + return $dev +} + +sub checkMdStat { + + my ($device, $expected) = @_; + my ($value) = qx#grep -i "^$device\\b" /proc/mdstat# =~ m/$device\s*:\s*(.*)/i; + + if ($value eq $expected) { + print LOGFILE "Check raid $device success\n"; + return 0; + } else { + print LOGFILE "Check raid $device FAILED.\n Expect <$expected>\n Found <$value>\n"; + $errors++; + return 1; + } +} + +sub checkE2fsAttribute { + + my ($device, $attribute, $expected) = @_; + + # since attribute is a space separated list of attributes, IMO we must loop over + # the list. Ask Sebastian again + my ($value) = qx#tune2fs -l $device |grep -i "$attribute"# =~ m/$attribute:\s+(.*)/i; + + if ($value eq $expected) { + print LOGFILE "Check $attribute for $device success\n"; + return 0; + } else { + print LOGFILE "Check $attribute for $device FAILED.\n Expect <$expected>\n Found <$value>\n"; + + $errors++; + return 1; + } +} + +1;