Skip to content

Commit

Permalink
Add initial support for option -C
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Prokop committed Nov 25, 2007
1 parent d09708b commit 130429e
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 18 deletions.
3 changes: 3 additions & 0 deletions debian/changelog
Expand Up @@ -10,6 +10,9 @@ grml-live (0.0.10) unstable; urgency=low
* Log the executed FAI command line to /var/log/grml-live.log.
* No longer update chroot system via instsoft.GRMLBASE as FAI
should do that now.
* New option '-C <configuration_file>' for specifying a configuration
file. Needs heavy testing though, because the files are updated
during runtime it isn't as easy as expected to be. :-/
* Do not enable apt-listbugs if the binary is not available.
[Testing: issue340]
* Add keychain package to GRML_MEDIUM.
Expand Down
22 changes: 19 additions & 3 deletions docs/grml-live.txt
Expand Up @@ -17,7 +17,7 @@ grml-live [-a <architecture>] [-c <classe[s]>] [-g <grml_name>] [-i <iso_name> ]
*******************************************************************************
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.6.
This document currently applies to grml-live version 0.0.10.
*******************************************************************************

Description
Expand Down Expand Up @@ -72,6 +72,22 @@ can specify a class providing a grml-kernel (see
/etc/grml/fai/config/package_config/ for a full list). So instead of GRML_SMALL
you can also use GRML_MEDIUM and GRML_FULL instead.

-C **CONFIGURATION_FILE**::

The specified file is used as configuration file for grml-live. By default
/etc/grml/grml-live.conf is used for main configuration. If a file named
/etc/grml/grml-live.local exists it is used as well (sourced after reading
/etc/grml/grml-live.conf to allow overriding settings). As a last option the
specified configuration file is sourced so it is possible to override settings
of /etc/grml/grml-live.conf as well as of /etc/grml/grml-live.local. Please
notice that all configuration files have to be adjusted during execution of
grml-live, so please make sure you use /etc/grml/grml-live.conf as a base for
your own configuration file. Please also notice that the configuration file
specified via this option is **not** (yet) supported inside the
scripts/hooks/classes at /etc/grml/fai/config. Instead use
/etc/grml/grml-live.conf and/or /etc/grml/grml-live.local for configuration
stuff used inside /etc/grml/fai/config.

-F::

Force execution and do not prompt for acknowledgment of configuration.
Expand Down Expand Up @@ -107,7 +123,7 @@ Specify the Debian suite you want to use for your live-system. Defaults to

-t **TEMPLATE_DIRECTORY**::

Specify place of the templates used for building the ISO. By default
Specify place of the templates used for building the ISO. By default
(and if not manually specified) this is /usr/share/grml-live/templates/.

-u::
Expand Down Expand Up @@ -336,7 +352,7 @@ FAQ
Help, I'm using Debian etch and I don't have FAI version >3.2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wget http://www.informatik.uni-koeln.de/fai/download/etch/fai-client_3.2.3_all.deb \
wget http://www.informatik.uni-koeln.de/fai/download/etch/fai-client_3.2.3_all.deb \
http://www.informatik.uni-koeln.de/fai/download/etch/fai-server_3.2.3_all.deb \
http://www.informatik.uni-koeln.de/fai/download/etch/fai-doc_3.2.3_all.deb
dpkg -i fai-client_3.2.3_all.deb fai-server_3.2.3_all.deb fai-doc_3.2.3_all.deb
Expand Down
5 changes: 3 additions & 2 deletions etc/grml/fai/config/hooks/instsoft.GRMLBASE
Expand Up @@ -4,7 +4,7 @@
# 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: Mon Nov 12 11:14:32 CET 2007 [mika]
# Latest change: Sun Nov 25 18:28:54 CET 2007 [mika]
################################################################################

set -u
Expand All @@ -14,7 +14,8 @@ set -e
echo grml_chroot > $target/etc/debian_chroot

HOSTNAME=''
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
[ -n "$HOSTNAME" ] || HOSTNAME=grml
echo "$HOSTNAME" > $target/etc/hostname

Expand Down
3 changes: 2 additions & 1 deletion etc/grml/fai/config/scripts/GRMLBASE/05-hostname
Expand Up @@ -11,7 +11,8 @@ set -u
set -e

HOSTNAME=''
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
[ -n "$HOSTNAME" ] || HOSTNAME=grml
echo "$HOSTNAME" > $target/etc/hostname

Expand Down
3 changes: 2 additions & 1 deletion etc/grml/fai/config/scripts/GRMLBASE/20-sudo
Expand Up @@ -11,7 +11,8 @@ set -u
set -e

USERNAME=''
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
[ -n "$USERNAME" ] || USERNAME=grml

if [ -r /etc/grml/fai/files/etc/sudoers ] ; then
Expand Down
3 changes: 2 additions & 1 deletion etc/grml/fai/config/scripts/GRMLBASE/21-usersetup
Expand Up @@ -11,7 +11,8 @@ set -u
set -e

USERNAME=''
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
[ -n "$USERNAME" ] || USERNAME=grml

if grep -q "$USERNAME:x:1000" $target/etc/group ; then
Expand Down
3 changes: 2 additions & 1 deletion etc/grml/fai/config/scripts/GRMLBASE/30-fstab
Expand Up @@ -11,7 +11,8 @@ set -u
set -e

USERNAME=''
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
[ -n "$USERNAME" ] || USERNAME=grml

if [ -r /etc/grml/fai/files/etc/fstab ] ; then
Expand Down
3 changes: 2 additions & 1 deletion etc/grml/fai/config/scripts/GRMLBASE/34-hosts
Expand Up @@ -11,7 +11,8 @@ set -u
set -e

HOSTNAME=''
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
[ -n "$HOSTNAME" ] || HOSTNAME=grml

if [ -r /etc/grml/fai/files/etc/hosts ] ; then
Expand Down
3 changes: 2 additions & 1 deletion etc/grml/fai/config/scripts/GRMLBASE/95-package-information
Expand Up @@ -8,7 +8,8 @@
################################################################################

HOSTNAME=''
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
[ -n "$HOSTNAME" ] || HOSTNAME=grml

if ! [ -d /var/log/fai/"$HOSTNAME"/last/ ] ; then
Expand Down
3 changes: 2 additions & 1 deletion etc/grml/fai/config/scripts/GRMLBASE/96-apt-listbugs
Expand Up @@ -29,7 +29,8 @@ fi
if ifclass RELEASE ; then

HOSTNAME=''
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
[ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
[ -n "$HOSTNAME" ] || HOSTNAME=grml

if [ -r /etc/resolv.conf ] ; then
Expand Down
51 changes: 45 additions & 6 deletions grml-live
Expand Up @@ -4,7 +4,7 @@
# 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 Nov 25 17:16:07 CET 2007 [mika]
# Latest change: Sun Nov 25 18:29:07 CET 2007 [mika]
################################################################################

# read configuration files, set some misc variables {{{
Expand Down Expand Up @@ -95,6 +95,14 @@ if [ -n "$ZERO_LOGFILE" ] ; then
echo -n > $LOGFILE
fi

if [ -n "$ZERO_FAI_LOGFILE" ] ; then
if [ -d /var/log/fai/"$HOSTNAME" ] ; then
rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink last)"
rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink last-softupdate)"
rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink last-dirinstall)"
fi
fi

NFSROOT_CONF=/etc/grml/fai/make-fai-nfsroot.conf

# }}}
Expand Down Expand Up @@ -179,10 +187,11 @@ http://grml.org/bugs/

# command line parsing {{{

while getopts "a:c:g:i:o:r:s:t:v:FhuV" opt; do
while getopts "a:C:c:g:i:o:r:s:t:v:FhuV" opt; do
case "$opt" in
a) ARCH="$OPTARG" ;;
c) CLASSES="$OPTARG" ;;
C) CONFIG="$OPTARG" ;;
g) GRML_NAME="$OPTARG" ;;
i) ISO_NAME="$OPTARG" ;;
o) OUTPUT="$OPTARG"
Expand Down Expand Up @@ -218,6 +227,7 @@ if [ -z "$FORCE" ] ; then
echo
echo " FAI classes: $CLASSES"
echo " main directory: $OUTPUT"
[ -n "$CONFIG" ] && echo " configuration: $CONFIG"
[ -n "$CHROOT_OUTPUT" ] && echo " chroot target: $CHROOT_OUTPUT"
[ -n "$BUILD_OUTPUT" ] && echo " build target: $BUILD_OUTPUT"
[ -n "$ISO_OUTPUT" ] && echo " ISO target: $ISO_OUTPUT"
Expand All @@ -241,6 +251,26 @@ if [ -z "$FORCE" ] ; then
echo
fi

# read local (non-packaged) configuration:
LOCAL_CONFIG=/etc/grml/grml-live.local
if [ -r "$LOCAL_CONFIG" ] ; then
log "Sourcing $LOCAL_CONFIG"
. $LOCAL_CONFIG
else
LOCAL_CONFIG=''
fi

if [ -n "$CONFIG" ] ; then
if ! [ -f "$CONFIG" ] ; then
log "Sorry, $CONFIG could not be read. Exiting. [$(date)]"
eerror "Sorry, $CONFIG could not be read. Exiting."
bailout 1
else
log "Sourcing $CONFIG"
. $CONFIG
fi
fi

start_seconds=$(cut -d . -f 1 /proc/uptime)
log "------------------------------------------------------------------------------"
log "Starting grml-live [${GRML_LIVE_VERSION}] run on $(date)"
Expand Down Expand Up @@ -271,10 +301,15 @@ fi

# does this suck? YES!
if [ -n "$SUITE" ] ; then
sed -i "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF

DIST="\|\ etch\ \|\ stable\ \|\ lenny\ \|\ testing\ \|\ sid\ \|\ unstable\ "
sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $LIVE_CONF
for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
if [ -n "$file" ] ; then
sed -i "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF
DIST="\|\ etch\ \|\ stable\ \|\ lenny\ \|\ testing\ \|\ sid\ \|\ unstable\ "
sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $file
fi
done

sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list
# notice: activate grml-live pool only if we are building against unstable:
if grep -qe unstable -qe sid /etc/grml/fai/apt/sources.list ; then
Expand All @@ -286,7 +321,11 @@ if [ -n "$SUITE" ] ; then
sed -i 's/.*grml-live.*/# removed grml-live repository/' /etc/grml/fai/apt/sources.list
fi

sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" $LIVE_CONF
for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
if [ -n "$file" ] ; then
sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file"
fi
done
sed -i "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" $NFSROOT_CONF
fi

Expand Down

0 comments on commit 130429e

Please sign in to comment.