[Fai-commit] r4126 - in people/h01ger: . live-cd live-cd/live-include-dir live-cd/live-include-dir/etc

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Wed Nov 1 23:17:59 CET 2006


Author: h01ger-guest
Date: 2006-11-01 23:17:58 +0100 (Wed, 01 Nov 2006)
New Revision: 4126

Added:
   people/h01ger/live-cd/
   people/h01ger/live-cd/README.txt
   people/h01ger/live-cd/live-include-dir/
   people/h01ger/live-cd/live-include-dir/etc/
   people/h01ger/live-cd/live-include-dir/etc/foo
   people/h01ger/live-cd/live-include-dir/fai.conf
   people/h01ger/live-cd/live-include-dir/hook
   people/h01ger/live-cd/live-include-dir/mount2dir
   people/h01ger/live-cd/live-include-dir/real-hook
   people/h01ger/live-cd/live-include-dir/run_fai
   people/h01ger/live-cd/live-include-dir/sources.list
Log:
- this is the beginning of a fai-live-cd made with live-package
- it's tested with fai 3.0 and does everything (install a base system with FAI on /dev/sda)
- except that grub isn't installed properly
- and that softupdate is used and not dir-install

So after I left the code rot for three weeks on my hard drive, I decided to do an early release :)


Added: people/h01ger/live-cd/README.txt
===================================================================
--- people/h01ger/live-cd/README.txt	2006-11-01 11:48:17 UTC (rev 4125)
+++ people/h01ger/live-cd/README.txt	2006-11-01 22:17:58 UTC (rev 4126)
@@ -0,0 +1,16 @@
+(c) Holger Levsen 2006
+released under GPL2
+
+fai-live-cd with live-package
+-----------------------------
+
+download all files in live-include-dir and run
+# make-live --hook live-include-dir/hook 
+
+
+
+additional comments:
+- this is alpha, tested with fai 3.0 on etch
+- /etc/make-live.conf is not included, I basically used the package default
+- feedback is great
+- the live-cd works, but grub installation is buggy

Added: people/h01ger/live-cd/live-include-dir/etc/foo
===================================================================

Added: people/h01ger/live-cd/live-include-dir/fai.conf
===================================================================
--- people/h01ger/live-cd/live-include-dir/fai.conf	2006-11-01 11:48:17 UTC (rev 4125)
+++ people/h01ger/live-cd/live-include-dir/fai.conf	2006-11-01 22:17:58 UTC (rev 4126)
@@ -0,0 +1,35 @@
+# $Id: fai.conf 3770 2006-08-07 12:08:51Z lange $
+
+# /etc/fai/fai.conf -- configuration for FAI (Fully Automatic Installation)
+
+# 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
+
+# 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=
+
+# set protocol type for saving logs. Values: ssh, rsh, ftp
+FAI_LOGPROTO=rsh
+
+# the configuration space on the install server
+FAI_CONFIGDIR=/srv/fai/config
+
+# how to access the fai config space
+# default if undefined here: nfs://`hostname`/$FAI_CONFIGDIR
+#FAI_CONFIG_SRC=nfs://yourservername$FAI_CONFIGDIR
+
+# the following variables are read only for most users
+
+# mount point where the mirror will be mounted
+MNTPOINT=/media/mirror
+
+# the local configuration directory on the install client
+FAI=/var/lib/fai/config

Added: people/h01ger/live-cd/live-include-dir/hook
===================================================================
--- people/h01ger/live-cd/live-include-dir/hook	2006-11-01 11:48:17 UTC (rev 4125)
+++ people/h01ger/live-cd/live-include-dir/hook	2006-11-01 22:17:58 UTC (rev 4126)
@@ -0,0 +1 @@
+sh /real-hook


Property changes on: people/h01ger/live-cd/live-include-dir/hook
___________________________________________________________________
Name: svn:executable
   + *

Added: people/h01ger/live-cd/live-include-dir/mount2dir
===================================================================
--- people/h01ger/live-cd/live-include-dir/mount2dir	2006-11-01 11:48:17 UTC (rev 4125)
+++ people/h01ger/live-cd/live-include-dir/mount2dir	2006-11-01 22:17:58 UTC (rev 4126)
@@ -0,0 +1,93 @@
+#! /bin/sh
+
+# $Id: mount2dir 3388 2006-04-08 20:46:04Z lange $
+#*********************************************************************
+#
+# mount2dir -- mount partitions to a directory using a fstab file
+#
+# This script is part of FAI (Fully Automatic Installation)
+# (c) 2001-2006 by Thomas Lange, lange at informatik.uni-koeln.de
+# Universitaet zu Koeln
+#
+#*********************************************************************
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# A copy of the GNU General Public License is available as
+# `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
+# or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html.  You
+# can also obtain it by writing to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#*********************************************************************
+
+# examples:
+# mount new created partitions to /tmp/target
+# mount2dir /tmp/target /tmp/fstab 1
+#
+# root filesystem already mounted. Found a fstab inside. Now mount
+# the remaining partitons
+# mount2dir $target $target/etc/fstab 0 ro
+#
+# TODO: option parsing with getopts, option for also mounting nfs directories
+# matching a certain server name
+
+target=$1 # where to mount
+fstab=$2
+fscheck=$3 # make fsck if 1
+moptions=$4 # if set, use only this mount option (mostly -r)
+
+# exit if too few parameters given
+[ "$fstab" ] || {
+    echo "Too few parameters."
+    echo "Usage: mount2dir targetdir fstab [ fscheck mopt ]"
+    exit 1
+}
+
+[ -f $fstab ] || {
+    echo "No fstab file $fstab found."
+    exit 2
+}
+
+(
+while read device mountpoint fstype mopt dummy; do
+
+    case $mopt in
+	*noauto*) continue ;;
+    esac
+
+    [ "$mountpoint" == "none" ]  && continue
+    [ "$fstype" == "swap" ]  && continue
+    [ "$fstype" == "proc" ]  && continue
+    [ "$fstype" == "usbfs" ]  && continue
+    [ "$fstype" == "sysfs" ]  && continue
+    [ "$fstype" == "tmpfs" ]  && continue
+    [ "$fstype" == "devpts" ]  && continue
+
+    case $device in
+	""|\#*) continue ;;
+
+	/dev/*)
+
+	    # overwrite mount options
+	    mopt="-o $mopt"
+	    [ "$moptions" ] && mopt="-o $moptions"
+	    [ -d $target/$mountpoint ] || mkdir -p $target$mountpoint
+	    if [ $debug ]; then
+		echo "Mounting $device to $target$mountpoint type: $fstype opt: $mopt"
+	    else
+		[ $verbose ] && echo "Mounting $device to $target$mountpoint"
+	    fi
+	    # should we fsck the partition first?
+	    [ "$fscheck" = 1 ] && fsck -nt $fstype $device
+	    mount -t $fstype $mopt $device $target$mountpoint
+    esac
+done
+
+) < $fstab


Property changes on: people/h01ger/live-cd/live-include-dir/mount2dir
___________________________________________________________________
Name: svn:executable
   + *

Added: people/h01ger/live-cd/live-include-dir/real-hook
===================================================================
--- people/h01ger/live-cd/live-include-dir/real-hook	2006-11-01 11:48:17 UTC (rev 4125)
+++ people/h01ger/live-cd/live-include-dir/real-hook	2006-11-01 22:17:58 UTC (rev 4126)
@@ -0,0 +1,153 @@
+#!/bin/sh
+
+# (c) Holger Levsen <debian at layer-acht.org>
+# GPLv2
+
+#
+# populate fai config dir
+#
+mkdir -p /srv/fai/config
+cp -avx /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config/
+
+# fixme: this is just a wordaround for #390504
+mkdir -p /var/lib/fai
+ln -s /srv/fai/config /var/lib/fai/config
+# fixme: this is a workaround for #390504
+echo FAI_CONFIG_SRC=file:///srv/fai/config >> /etc/fai/fai.conf
+# fai.conf is still incomplete, but we cannot complete it yet... (see below)
+# we need from fai-nfsroot for fai-mirror:
+mv /mount2dir /usr/lib/fai/
+
+
+#
+# run fai at boot
+#
+mv /run_fai /etc/init.d/
+update-rc.d run_fai start 99 2 3 4 5 . 
+
+#
+# no autologin to casper user account
+#
+### missing, not important atm
+
+#
+# hack around:
+## WARNING: /srv/fai/nfsroot/var/tmp/base-pkgs.lis 
+## WARNING: /srv/fai/nfsroot/var/tmp/packages.nfsroot does not exists.
+##	minus fai-nfsroot and lilo
+## Can't add those packages. Maybe the nfsroot is not yet created.
+cat >> /srv/fai/config/package_config/live << EOF
+
+PACKAGES install
+adduser apt apt-utils aptitude base-files base-passwd bash bsdmainutils bsdutils coreutils cpio cron debconf debconf-i18n debianutils diff dmidecode dpkg dselect e2fslibs e2fsprogs ed findutils gcc-4.1-base gettext-base gnupg grep groff-base gzip hostname ifupdown initscripts iptables iputils-ping klogd laptop-detect libacl1 libattr1 libblkid1 libbz2-1.0 libc6 libcap1 libcomerr2 libconsole libdb4.2 libdb4.3 libdb4.4 libdevmapper1.02 libgcc1 libgcrypt11 libgdbm3 libgnutls13 libgpg-error0 libldap-2.3-0 libldap2 liblocale-gettext-perl liblzo1 liblzo2-2 libncurses5 libncursesw5 libnewt0.52 libopencdk8 libpam-modules libpam-runtime libpam0g libpopt0 libreadline5 libsasl2 libselinux1 libsepol1 libsigc++-1.2-5c2 libsigc++-2.0-0c2a libslang2 libss2 libssl0.9.8 libstdc++6 libtasn1-2 libtasn1-3 libtasn1-3-bin libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl libusb-0.1-4 libuuid1 libwrap0 login logrotate lsb-base makedev man-db manpages mawk mktemp module-init-tools modutils mount nano ncurses-base ncurses-bin net-tools netbase netcat openbsd-inetd passwd perl-base procps readline-common sed sysklogd sysv-rc sysvinit tar tasksel tasksel-data tcpd traceroute tzdata util-linux vim-common vim-tiny wget whiptail zlib1g
+module-init-tools dhcp3-client ssh rdate lshw hwinfo portmap bootpc rsync lftp rsh-client less dump reiserfsprogs usbutils psmisc pciutils hdparm smartmontools parted mdadm lvm2 dnsutils ntpdate dosfstools cvs jove xfsprogs xfsdump sysutils dialog discover mdetect libnet-perl console-tools console-common expect iproute udev subversion grub hwtools read-edid 
+debian-archive-keyring
+EOF
+
+# workaround stupid udev problem: s/disk1/hda/
+cat > /srv/fai/config/disk_config/FAIBASE << EOF
+# generic disk configuration for one small disk
+# disk size from 500Mb up to what you can buy today
+#
+# <type> <mountpoint> <size in mb> [mount options]     [;extra options]
+
+disk_config hda
+#disk_config disk1
+primary  /             150-300      rw,errors=remount-ro ; -c -j ext3
+logical  swap          40-500      rw                   
+logical  /var          90-1000     rw                   ; -m 5  -j ext3
+logical  /tmp          50-1000     rw                   ; -m 0 -j ext3
+logical  /usr          200-4000    rw                   ; -j ext3
+logical  /home         50-         rw,nosuid            ; -m 1 -j ext3
+# logical /home        preserve9   rw,nosuid            ; -m 1 -j ext3
+EOF
+
+
+#
+# create hook to partition disks on softupdate
+#
+#fixme: softupdate.DEFAULT is not a proper classname for this case...
+# first EOF in brackets to avoid escaping of variables
+cat > /srv/fai/config/hooks/softupdate.DEFAULT << 'EOF'
+#!/bin/bash
+
+set_disk_info
+load_keymap_consolechars
+
+task_partition
+task_mountdisks	
+# use debootstrap instead of task_extrbase	
+echo start debootstrap
+echo "target=$target"
+df -h
+debootstrap etch /tmp/target file:///media/mirror
+mkdir -p $target/media/mirror/debian
+echo mounting mirror into chroot
+mount --bind /media/mirror $target/media/mirror/debian
+echo "deb file:///media/mirror/debian etch main" > $target/etc/apt/sources.list
+cat <<'FOE' > $target/etc/apt/apt.conf.d/10fai
+APT::Get::AllowUnauthenticated "true";
+Aptitude::CmdLine::Ignore-Trust-Violations yes;
+FOE
+cat <<'FOE' > $target/etc/hosts
+127.0.0.1               localhost
+# The following lines are desirable for IPv6 capable hosts
+::1     ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+ff02::3 ip6-allhosts
+FOE
+
+cat $target/etc/apt/sources.list
+echo debug: task_softupdate
+task_softupdate
+
+EOF
+#
+# fix grub install - thanks to Oliver 'oz' Osburg
+#fixme: fstab fehlt
+cat > /srv/fai/config/scripts/GRUB/10-setup << 'EOF'
+#! /bin/bash
+set -a
+[ -r /tmp/fai/disk_var.sh ] && . /tmp/fai/disk_var.sh
+error=0 ; trap "error=$((error|1))" ERR
+#fcopy -Uv boot/grub/menu.lst
+mkdir -p $target/boot/grub
+grub-install --no-floppy --root-directory=$target $BOOT_DEVICE
+GROOT=$(device2grub $BOOT_PARTITION)
+$ROOTCMD /usr/sbin/update-grub -y
+echo "Grub installed on $BOOT_DEVICE on $GROOT"
+exit $error
+EOF
+#
+# make them executable...
+#
+chmod +x /srv/fai/config/scripts/GRUB/10-setup 
+chmod +x /srv/fai/config/hooks/softupdate.DEFAULT
+
+
+#
+# make mirror on cd...
+#
+mkdir -p /media/mirror
+# fixme: workaround #390377 
+export ftp_proxy="http://mainframe:3128/"
+export http_proxy="http://mainframe:3128/"
+# fixme: I386 and AMD64 only if...
+fai-mirror -v -c live,DEFAULT,DEMO,FAIBASE,I386,CHROOT,AMD64,DHCPC,GRUB /media/mirror
+# new sources.list for this mirror
+mv /sources.list /etc/fai/apt/
+
+# another workaround
+# during fai-mirror run, FAI_ROOT needs to be set to an existing chroot...
+echo target=/tmp/target >> /etc/fai/fai.conf
+echo FAI_ROOT=/tmp/target >> /etc/fai/fai.conf
+
+#
+# cleanup make-live hooks
+#
+rm /hook
+rm /real-hook
+

Added: people/h01ger/live-cd/live-include-dir/run_fai
===================================================================
--- people/h01ger/live-cd/live-include-dir/run_fai	2006-11-01 11:48:17 UTC (rev 4125)
+++ people/h01ger/live-cd/live-include-dir/run_fai	2006-11-01 22:17:58 UTC (rev 4126)
@@ -0,0 +1,25 @@
+#! /bin/sh
+
+# Author: Holger Levsen <debian at layer-acht.org>
+
+case "$1" in
+  start)
+	# if we do "fai install", we need from fai-nfsroot:
+	# ./lib/mkrw
+	# ./lib/load_keymap_consolechars
+	# ./lib/create_resolv_conf
+	# 
+	# and we need to 
+	# echo do_init_tasks=1 >> /etc/fai/fai.conf
+ 	#
+	# so we go for softupdates...
+	#
+	unset LANG
+        sh -xv /usr/sbin/fai  -N softupdate
+	;;
+  *)
+  	echo doing nothing
+	;;
+esac
+
+


Property changes on: people/h01ger/live-cd/live-include-dir/run_fai
___________________________________________________________________
Name: svn:executable
   + *

Added: people/h01ger/live-cd/live-include-dir/sources.list
===================================================================
--- people/h01ger/live-cd/live-include-dir/sources.list	2006-11-01 11:48:17 UTC (rev 4125)
+++ people/h01ger/live-cd/live-include-dir/sources.list	2006-11-01 22:17:58 UTC (rev 4126)
@@ -0,0 +1,8 @@
+# These lines should work for many sites
+# A more comprehensive example can be found in /usr/share/doc/fai/examples/etc
+
+#deb http://ftp.debian.org/debian etch main contrib non-free
+#deb http://ftp.debian.org/debian etch-proposed-updates main contrib non-free
+
+#deb http://security.debian.org/debian-security etch/updates main contrib non-free
+deb file:///media/mirror/debian etch main contrib non-free




More information about the Fai-commit mailing list