[Fai-commit] r2973 - in people/lazyboy: . fai-dev-helpers

fai-repository at svn.debian.org fai-repository at svn.debian.org
Fri Oct 21 09:04:37 UTC 2005


Author: lazyboy-guest
Date: 2005-10-21 09:04:36 +0000 (Fri, 21 Oct 2005)
New Revision: 2973

Added:
   people/lazyboy/fai-dev-helpers/
   people/lazyboy/fai-dev-helpers/README
   people/lazyboy/fai-dev-helpers/create-base-sarge-chroot
   people/lazyboy/fai-dev-helpers/fai-dev-build
   people/lazyboy/fai-dev-helpers/fai-dev-installpackage
   people/lazyboy/fai-dev-helpers/fai-dev-minimize-chroot
   people/lazyboy/fai-dev-helpers/fai-dev-preparedevenv
   people/lazyboy/fai-dev-helpers/fai-dev-runtest
   people/lazyboy/fai-dev-helpers/qemu-live-cd
Log:
adding my scripts for fai-development in a chroot and with qemu

Added: people/lazyboy/fai-dev-helpers/README
===================================================================
--- people/lazyboy/fai-dev-helpers/README	2005-10-20 23:01:54 UTC (rev 2972)
+++ people/lazyboy/fai-dev-helpers/README	2005-10-21 09:04:36 UTC (rev 2973)
@@ -0,0 +1,28 @@
+these are some helper scripts to ease FAI development and testing.
+
+for now it's mostly targeted to development of or testing with fai-cd.
+
+You'll need debooststrap, maybe a Debian mirror, pbuilder (read pbuilder docs
+for a nice introduction),and qemu, everything gets faster when using the kqemu
+accelarator kernel module.
+
+Go to the directory that you want to make a fai development environment (does not
+need to be the FAI source directory where you want to develop your code) and start
+with running fai-dev-preparedevenv as root or with sudo (needed for chroot
+creation). Most commands will need to be run as root or with sudo, because chroots
+are involved everywhere. I didn't come to think about how to make that better.
+
+ask henning at sprang.de when you have questions or suggestions.
+
+This stuff here is not well tested on other environments than mine, so it might
+completely destroy all of your system,you shouldnot use it without checking the
+full shell script code for possible troubles when you run that stuff on your
+system
+
+
+These scripts are licensed under the GNU General Public License, Version 2 or
+higher. Use them at your own risk.
+
+Copyright Henning Sprang.
+
+

Added: people/lazyboy/fai-dev-helpers/create-base-sarge-chroot
===================================================================
--- people/lazyboy/fai-dev-helpers/create-base-sarge-chroot	2005-10-20 23:01:54 UTC (rev 2972)
+++ people/lazyboy/fai-dev-helpers/create-base-sarge-chroot	2005-10-21 09:04:36 UTC (rev 2973)
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+if [ -z $1 ]; then
+	CHROOT_DIR=sarge-chroot
+else
+	CHROOT_DIR=$1
+fi
+
+if [ -x $CHROOT_DIR ]; then
+	echo "error: chroot dir '$CHROOT_DIR' already exists - exiting"
+	exit 1
+else
+	mkdir $CHROOT_DIR
+fi
+
+debootstrap \
+	--include=vim,vim-common,libgpmg1,less \
+	sarge \
+	$CHROOT_DIR \
+	http://debmirror.hostnet.lazy/debian/
+
+#  some dirty tricks to get some nice resolv.conf and sources.list:
+
+# resolv.conf
+echo "search lazy hostnet.lazy">$CHROOT_DIR/etc/resolv.conf
+echo "nameserver 127.0.0.1">>$CHROOT_DIR/etc/resolv.conf
+echo "nameserver 192.168.0.1">>$CHROOT_DIR/etc/resolv.conf
+
+# sources.list
+echo "deb http://debmirror.hostnet.lazy/debian sarge main contrib">$CHROOT_DIR/etc/apt/sources.list
+echo "deb http://security.debian.org/debian-security sarge/updates main contrib">>$CHROOT_DIR/etc/apt/sources.list
+
+# TODO: maybe we could cleanup apr archives in chroot?


Property changes on: people/lazyboy/fai-dev-helpers/create-base-sarge-chroot
___________________________________________________________________
Name: svn:executable
   + *

Added: people/lazyboy/fai-dev-helpers/fai-dev-build
===================================================================
--- people/lazyboy/fai-dev-helpers/fai-dev-build	2005-10-20 23:01:54 UTC (rev 2972)
+++ people/lazyboy/fai-dev-helpers/fai-dev-build	2005-10-21 09:04:36 UTC (rev 2973)
@@ -0,0 +1,28 @@
+#! /bin/sh
+if [ -z $1 ]; then
+	echo "please give sourcedir"
+	exit
+fi
+SOURCEDIR=$1
+
+if ! [ -x $SOURCEDIR/debian ]; then
+	echo "SOURCEDIR '$SOURCEDIR' does not contain debian sources."
+	echo "exiting."
+	exit 1
+fi
+
+RUNDIR=`pwd`
+
+if ! [ -x $RUNDIR/chroot ];then
+	echo "RUNDIR '$RUNDIR' does not contain a chroot dir."
+	echo "run preparedevenv first, please"
+	echo "exiting."
+	exit
+fi
+
+
+
+cd $SOURCEDIR
+
+sudo /usr/bin/pdebuild --buildresult $RUNDIR/chroot/incoming --
+


Property changes on: people/lazyboy/fai-dev-helpers/fai-dev-build
___________________________________________________________________
Name: svn:executable
   + *

Added: people/lazyboy/fai-dev-helpers/fai-dev-installpackage
===================================================================
--- people/lazyboy/fai-dev-helpers/fai-dev-installpackage	2005-10-20 23:01:54 UTC (rev 2972)
+++ people/lazyboy/fai-dev-helpers/fai-dev-installpackage	2005-10-21 09:04:36 UTC (rev 2973)
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+if [ -z $1 ]; then
+	echo "must give package name"
+	echo "exiting."
+	exit 1
+fi
+PACKAGE_NAME=$1
+	
+RUNDIR=`pwd`
+
+if ! [ -x $RUNDIR/chroot ];then
+	echo "RUNDIR '$RUNDIR' does not contain a chroot dir."
+	echo "run preparedevenv first, please"
+	echo "exiting."
+	exit
+fi
+
+
+# do necessary stuff in the chroot
+ROOTCMD="chroot ./chroot"
+
+$ROOTCMD dpkg -P fai
+$ROOTCMD rm -r /usr/local/share/fai/
+$ROOTCMD dpkg -i /incoming/$PACKAGE_NAME
+$ROOTCMD apt-get update
+$ROOTCMD apt-get install -f
+$ROOTCMD cp -pr /usr/share/doc/fai/examples/simple /usr/local/share/fai
+
+# TODO: better add a possibility to run a custom post-package-install script here
+$ROOTCMD vim /etc/fai/fai.conf
+$ROOTCMD vim /etc/fai/make-fai-nfsroot.conf
+$ROOTCMD vim /etc/fai/sources.list
+
+# TODO: normally not needed, or?
+#$ROOTCMD fai-setup


Property changes on: people/lazyboy/fai-dev-helpers/fai-dev-installpackage
___________________________________________________________________
Name: svn:executable
   + *

Added: people/lazyboy/fai-dev-helpers/fai-dev-minimize-chroot
===================================================================
--- people/lazyboy/fai-dev-helpers/fai-dev-minimize-chroot	2005-10-20 23:01:54 UTC (rev 2972)
+++ people/lazyboy/fai-dev-helpers/fai-dev-minimize-chroot	2005-10-21 09:04:36 UTC (rev 2973)
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+if ! [ -x ./chroot ]; then
+	echo "not a fai development directory with a chroot. exiting"
+	exit 1
+fi
+
+# TODO: maybe ask user if all that should be deleted?!
+
+rm -r ./chroot/var/run/fai-cd/fai-cd_testsimple.iso chroot/var/run/fai-mirror/*
+rm -r ./chroot/usr/lib/fai/nfsroot/
+
+#rm -r chroot/usr/local/share/fai
+
+qemu-img create -f qcow qemu_install_client.disk 2500M
+


Property changes on: people/lazyboy/fai-dev-helpers/fai-dev-minimize-chroot
___________________________________________________________________
Name: svn:executable
   + *

Added: people/lazyboy/fai-dev-helpers/fai-dev-preparedevenv
===================================================================
--- people/lazyboy/fai-dev-helpers/fai-dev-preparedevenv	2005-10-20 23:01:54 UTC (rev 2972)
+++ people/lazyboy/fai-dev-helpers/fai-dev-preparedevenv	2005-10-21 09:04:36 UTC (rev 2973)
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# stop when not run as root!
+
+# TODO: fill in create-base-sarge chroot code here?
+~/bin/create-base-sarge-chroot chroot
+
+# TODO: put stuff in TEMPLATE_DIR
+# or better hardcode those here, so everything is in one place first?
+TEMPLATE_DIR=/hier/produktion/fai-devel/dev/chroot_templates/
+
+# copy/link the config files needed in chroot
+rm ./chroot/etc/apt/sources.list
+cp $TEMPLATE_DIR/sources.list ./chroot/etc/apt/sources.list
+rm ./chroot/etc/resolv.conf
+cp $TEMPLATE_DIR/resolv.conf ./chroot/etc/resolv.conf
+
+# create chroot/incoming for packages
+mkdir chroot/incoming
+chown henning chroot/incoming
+
+# create vm install image
+qemu-img create -f qcow qemu_install_client.disk  2500M
+
+# some help
+
+# TODO: could do the additional package install when some option (e.g.
+# testtype=fai-cd) is set.
+echo "
+further preparation:
+
+install needed package recommends and suggest manually 
+
+e.g.
+chroot ./chroot apt-get update
+chroot ./chroot apt-get install debootstrap fai-kernels wget syslinux \
+	debmirror mknbi apt-move mkinitrd-cd grub mkisofs
+
+prepare pbuilder: 
+in case you did not already, read about pbuilder and create a
+base chroot for pbuilder. You'll need it for the buildfai script
+
+development cycle:
+
+- edit fai code
+
+- run fai-dev-build
+
+- eventually add manual tweaks in the chroot
+
+- run fai-dev-installpackage
+
+- run fai-dev-runtest 
+
+- check results and maybe errors and start again
+"
+


Property changes on: people/lazyboy/fai-dev-helpers/fai-dev-preparedevenv
___________________________________________________________________
Name: svn:executable
   + *

Added: people/lazyboy/fai-dev-helpers/fai-dev-runtest
===================================================================
--- people/lazyboy/fai-dev-helpers/fai-dev-runtest	2005-10-20 23:01:54 UTC (rev 2972)
+++ people/lazyboy/fai-dev-helpers/fai-dev-runtest	2005-10-21 09:04:36 UTC (rev 2973)
@@ -0,0 +1,29 @@
+#!/bin/sh
+RUNDIR=`pwd`
+
+if ! [ -x $RUNDIR/chroot ];then
+	echo "RUNDIR '$RUNDIR' does not contain a chroot dir."
+	echo "run preparedevenv, buildfai, and installpackage first, please"
+	echo "exiting."
+	exit 1
+fi
+
+
+# do necessary stuff in the chroot
+ROOTCMD="chroot ./chroot"
+
+$ROOTCMD rm -r /var/run/fai-cd/fai-cd_testsimple.iso /var/run/fai-mirror/
+$ROOTCMD mkdir /var/run/fai-mirror /var/run/fai-cd
+$ROOTCMD make-fai-nfsroot
+$ROOTCMD fai-mirror /var/run/fai-mirror/
+$ROOTCMD fai-cd -m /var/run/fai-mirror/ /var/run/fai-cd/fai-cd_testsimple.iso
+
+echo "
+# run qemu with the resulting iso and the prepared hd image for installation
+qemu -m 64 -boot d -cdrom ./chroot/var/run/fai-cd/fai-cd_testsimple.iso -hda qemu_install_client.disk -user-net -k de
+
+# check results and maybe errors and start again
+qemu -m 64 -user-net -k de -hda qemu_install_client.disk
+"
+
+


Property changes on: people/lazyboy/fai-dev-helpers/fai-dev-runtest
___________________________________________________________________
Name: svn:executable
   + *

Added: people/lazyboy/fai-dev-helpers/qemu-live-cd
===================================================================
--- people/lazyboy/fai-dev-helpers/qemu-live-cd	2005-10-20 23:01:54 UTC (rev 2972)
+++ people/lazyboy/fai-dev-helpers/qemu-live-cd	2005-10-21 09:04:36 UTC (rev 2973)
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+qemu -m 64 -boot d -cdrom $@ &


Property changes on: people/lazyboy/fai-dev-helpers/qemu-live-cd
___________________________________________________________________
Name: svn:executable
   + *




More information about the Fai-commit mailing list