grml-live [-a <architecture>] [-c <classe[s]>] [-g <grml_name>] [-i <iso_name> ]
[-o <output_directory>] [-r <release_name>] [-s <suite>] [-t
-<template_directory>] [-v <version_number>] [-FVhuz]
+<template_directory>] [-v <version_number>] [-bFVhuz]
*******************************************************************************
Important! This document is growing as requested. If you have questions which
aren't answered by this document yet please let me know: <mika@grml.org>!
-This document currently applies to grml-live version 0.0.12.
+This document currently applies to grml-live version 0.0.13.
*******************************************************************************
Description
crosscompiling (like building a ppc system on x86) isn't possible due to the
nature and the need of working in a chroot.
+ -b::
+
+Build the ISO without updating the chroot via FAI. This option is useful for
+example when working on stable releases: if you have a working base
+system/chroot and do not want to execute any further updates (via "-u" option)
+but intend to only build the ISO. (Notice: This option requires a feature within
+FAI which is not yet part of the official FAI release yet.)
+
-c **CLASSES**::
Specify the CLASSES to be used for building the ISO via FAI. By default only
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2 or any later version.
-# Latest change: Sun Dec 09 18:18:27 CET 2007 [mika]
+# Latest change: Sun Dec 16 12:39:04 CET 2007 [mika]
################################################################################
# read configuration files, set some misc variables {{{
# exit on any error:
set -e
-GRML_LIVE_VERSION='0.0.12'
+GRML_LIVE_VERSION='0.0.13'
CMDLINE="$0 $@"
ISO_DATE="$(date +%Y-%m-%d)"
exit 1
fi
+if [ -r /var/run/fai/fai_chrootupdate_is_running ] ; then
+ echo "/usr/sbin/fai chrootupdate already running or was aborted before.">&2
+ echo "You may remove /var/run/fai/fai_chrootupdate_is_running and try again.">&2
+ exit 1
+fi
+
# make sure they are not set by default
VERBOSE=''
FORCE=''
UPDATE=''
+BUILD_ONLY=''
if [ -r /etc/grml/lsb-functions ] ; then
. /etc/grml/lsb-functions
# clean exit {{{
bailout() {
[ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_OUTPUT}/${MIRROR_DIRECTORY}"
- rm -f /var/run/fai/fai_softupdate_is_running /var/run/fai/FAI_INSTALLATION_IN_PROGRESS
+ rm -f /var/run/fai/fai_softupdate_is_running \
+ /var/run/fai/fai_chrootupdate_is_running \
+ /var/run/fai/FAI_INSTALLATION_IN_PROGRESS
[ -n "$1" ] && EXIT="$1" || EXIT="1"
[ -n "$2" ] && eerror "$2">&2
log "------------------------------------------------------------------------------"
Usage: $PN [-a <architecture>] [-c <classe[s]>] [-g <grml_name>] \\
[-i <iso_name> ] [-o <output_directory>] [-s <suite>] \\
[-t <template_directory>] [-s <suite>] \\
- [-v <version_number>] [-FVhu]
+ [-v <version_number>] [-bFVhu]
Usage examples:
# command line parsing {{{
-while getopts "a:C:c:g:i:o:r:s:t:v:FhuVz" opt; do
+while getopts "a:C:c:g:i:o:r:s:t:v:bFhuVz" opt; do
case "$opt" in
a) ARCH="$OPTARG" ;;
+ b) BUILD_ONLY=1 ;;
c) CLASSES="$OPTARG" ;;
C) CONFIG="$OPTARG" ;;
g) GRML_NAME="$OPTARG" ;;
rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last)"
rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last-dirinstall)"
rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last-softupdate)"
+ rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last-chrootupdate)"
rm -f /var/log/fai/"$HOSTNAME"/last \
/var/log/fai/"$HOSTNAME"/last-dirinstall \
+ /var/log/fai/"$HOSTNAME"/last-chrootupdate \
/var/log/fai/"$HOSTNAME"/last-softupdate
fi
fi
[ -n "$VERBOSE" ] && echo " Using VERBOSE mode."
[ -n "$SQUASHFS_ZLIB" ] && echo " Using ZLIB (instead od LZMA) compression."
[ -n "$UPDATE" ] && echo " Executing UPDATE instead of fresh installation."
+ [ -n "$BUILD_ONLY" ] && echo " Executing BUILD_ONLY instead of fresh installation or UPDATE."
echo
echo -n "Is this ok for you? [y/N] "
read a
if [ -n "$UPDATE" ] ; then
FAI_ACTION=softupdate
+elif [ -n "$BUILD_ONLY" ] ; then
+ FAI_ACTION=chrootupdate
else
FAI_ACTION=dirinstall
fi
-if [ -n "$UPDATE" ] ; then
+if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then
if ! [ -r "$CHROOT_OUTPUT/etc/grml_version" ] ; then
- log "Error: does not look like you have a working chroot. Updating not possible."
- eerror "Error: does not look like you have a working chroot. Updating not possible. (Drop -u option?)"
+ log "Error: does not look like you have a working chroot. Updating/building not possible."
+ eerror "Error: does not look like you have a working chroot. Updating/building not possible. (Drop -u/-b option?)"
eend 1
bailout 20
fi
fi
-if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" ] ; then
+if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then
log "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'"
ewarn "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'" ; eend 0
else
# i386:
if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
- if [ -d "$BUILD_OUTPUT"/boot -a -z "$UPDATE" ] ; then
+ if [ -d "$BUILD_OUTPUT"/boot -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then
log "$BUILD_OUTPUT/boot exists already, skipping stage 'boot'"
ewarn "$BUILD_OUTPUT/boot exists already, skipping stage 'boot'" ; eend 0
else
eerror 'Error: Unsupported ARCH, sorry. Want to support it? Contribute!' ; eend 1
fi
-if [ -f "$BUILD_OUTPUT"/live/grml.squashfs -a -z "$UPDATE" ] ; then
+if [ -f "$BUILD_OUTPUT"/live/grml.squashfs -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then
log "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'"
ewarn "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'" ; eend 0
else
BOOT_FILE="boot/grub/stage2_eltorito"
fi
-if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" ] ; then
+if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then
log "$ISO_OUTPUT exists already, skipping stage 'iso build'"
ewarn "$ISO_OUTPUT exists already, skipping stage 'iso build'" ; eend 0
else
--- /dev/null
+--- subroutines.orig 2007-12-16 11:20:12.000000000 +0000
++++ subroutines 2007-12-16 11:23:01.000000000 +0000
+@@ -294,6 +294,10 @@
+ echo Performing FAI system update. All data may be overwritten!
+ task softupdate
+ ;;
++ chrootupdate)
++ echo Performing FAI chroot update. All data may be overwritten!
++ task chrootupdate
++ ;;
+ sysinfo)
+ echo Showing system information.
+ task sysinfo
+@@ -568,6 +572,49 @@
+ }
+ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
++task_chrootupdate() {
++
++ local stamp=/var/run/fai/fai_chrootupdate_is_running
++
++ [ -f "$stamp" ] && die "Another fai chrootupdate is already running. Aborting."
++ echo $$ > $stamp
++ # if the system had been installed using fai < 3.0 disk_var.sh is found in /etc/fai
++ if [ ! -f /var/lib/fai/disk_var.sh -a -f /etc/fai/disk_var.sh ] ; then
++ mv /etc/fai/disk_var.sh /var/lib/fai/
++ fi
++ # the following copy operation is required to make $LOGDIR a reliable source
++ # for disk_var.sh
++ # use the last disk_var during update if available
++ [ -f /var/lib/fai/disk_var.sh ] && cp -p /var/lib/fai/disk_var.sh $LOGDIR
++
++ defnop wait_for_jobs
++ save_dmesg
++
++ task mirror
++ task debconf
++ task configure
++ date
++ echo "The $FAI_ACTION took $[$(cut -d . -f 1 /proc/uptime)-$start_seconds] seconds."
++
++ rm -f $stamp
++ # save again, because new messages could be created
++ save_dmesg
++ task savelog
++
++ if [ -f $stamp ]; then
++ echo "Error while executing commands in subshell."
++ echo -n "$stamp was not removed. PID of running process: "
++ cat $stamp
++ sendmon "TASKERROR chrootupdate 21"
++ die "Please look at the log files in $LOGDIR for errors."
++ fi
++ echo $FAI_CONFIG_SRC | grep -q ^nfs://
++ if [ $? -eq 0 ]; then
++ grep -q ^$FAI /etc/mtab && umount $FAI
++ fi
++}
++# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
++
+ catnc() {
+ # cat but no comment lines
+ egrep -v "^#" $@