But you can't use Hook-Files in a Single LH_CONFFILE,
and thats what i need!

hook files can be arbitrary binaries. There are ways to encode them
inside XLM, but why bother? Just add them as separate files.

Likewise the contents of the local include directory.

In my daily life with the autobuild system (just a few changes to to the wonderful webhelper) it is really a bless to keep your whole configuration (including lists and hooks) in a single file. I used a little hack to do this, see the included dirty.build if you are interested in dirty details.

I really like how the config file is used at the moment in live-helper. You probably need some non-live-helper informations for the build system (where to put the image, update an db entry, generate a webpage or whatever) and just throw them in there and use them as variables in the build script. I really want to keep them the way they are and don't want to replace them. But for build systems and archives I think that some kind of "extented config file" really is needed, too.

I'm pretty sure when you hear live-helper and xml in the same sentence your toe-nails are rolling back, thinking of the overhead (-: As a big fan of the command line tool xml2 my first thought was using it somehow in my private build system but than I could convince oliver to write a little shell parser to spare the depends. It works reliable and is small enough to include it.

In fact I think an extended (xml) config file could bring us a few nice new features like "export the configuration including the used package versions for later rebuilds", for support, in webservices allowing to upload whole config with hooks and everything (including evil hacking hooks ;-) )

A few points are waiting to be discussed like the problem with the potential binary files (could not only be hooks, also be local packages / is uuencode evil?) but I really would love to see things like all this in live-helper in a clean live-helperish way (-:

And of course because code says more than thousand words there is the function "xml.sh", the helper "lh_xml" (for im- and export) and an example config.xml attached to this mail.

a few details (but open for every kind of change/rewrite):
   - export will only write non-default values
   - only depends on hexdump (busybox version works too)
   - fast (enough)
- nothing implimented for binary yet (but there is uuencode in busybox, too)

Have fun trying out and see this as an attempt to wide out this discussion to "lh <-> xml".

thanks for your time
Simon


<live_helper>
 <common>
  <lh_cache_packages>False</lh_cache_packages>
  <lh_cache_stages>none</lh_cache_stages>
 </common>
 <bootstrap>
  <lh_mirror_bootstrap>http://ftp.de.debian.org/debian</lh_mirror_bootstrap>
  <lh_mirror_chroot>http://ftp.de.debian.org/debian</lh_mirror_chroot>
 </bootstrap>
 <chroot>
  <lh_language>de</lh_language>
  <lh_packages_lists>xfce</lh_packages_lists>
 </chroot>
 <binary>
  <lh_binary_images>usb-hdd</lh_binary_images>
  <lh_bootappend_live>locale=de_DE.UTF-8 keyb=de</lh_bootappend_live>
  <lh_debian_installer>live</lh_debian_installer>
 </binary>
 <files>
  <chroot>
   <local-hooks>
    <nvidia-legacy.sh><![CDATA[

#!/bin/sh

# This is a hook for live-helper(7) to install nvidia-kernel-legacy drivers
# To enable it, copy this hook into your config/chroot_localhooks directory.
#
# Note: This hook requires packages from the non-free section. Make sure you
# enabled it in your configuration.

# Building kernel module
which module-assistant || apt-get install --yes module-assistant nvidia-kernel-common
module-assistant update

for KERNEL in /boot/vmlinuz-*
do
	VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')"

	module-assistant --non-inter --quiet auto-install nvidia-kernel-legacy -l ${VERSION}
done

module-assistant clean nvidia-kernel-legacy

# Installing additional stuff
apt-get install --yes nvidia-glx-legacy nvidia-xconfig discover

# Fix #421028
if [ -f /usr/lib/xorg/modules/drivers/nvidia_drv.o ]
then
	cd /usr/lib/xorg/modules/drivers
	gcc -shared -o nvidia_drv.so nvidia_drv.o
	cd ${OLDPWD}
fi

# Adding init script
cat > /etc/init.d/nvidia-debian-live << EOF
#!/bin/sh
# script that modify xorg configuration enabling
# the nvidia proprietary module if the card is detected
# as an NVidia

if discover --type-summary display | grep -i nvidia
then
	# forcing depth to 24, bad detection on some card (e.g my GeForce4 440 Go)
	echo "Configuring Xorg for nvidia ..."
	nvidia-xconfig -d 24
else
	# not with nvidia h/w ? remove those GLX diversions
	# (FIXME)
	apt-get --quiet --yes remove nvidia-glx-legacy
fi
EOF

chmod 0755 /etc/init.d/nvidia-debian-live
update-rc.d nvidia-debian-live defaults

]]></nvidia-legacy.sh>
   </local-hooks>
   <local-packageslists>
    <test-packagelist><![CDATA[

# just an example
psutils vim ssh  


xpdf xosview


]]></test-packagelist>
   </local-packageslists>
  </chroot>
  <binary>
   <local-hooks>
    <qemu-launcher.sh><![CDATA[

#!/bin/sh

# This is a hook for live-helper(7) to install autorun4linuxCD.
# autorun4linuxCD was written by Franklin Piat <[EMAIL PROTECTED]>.
#
# To enable it, copy this hook into your config/binary_local-hooks directory.

cd binary

wget http://www.klabs.be/~fpiat/projects/autorun4linuxCD/autorun4linuxCD.tar.gz
tar xfz autorun4linuxCD.tar.gz
rm -f autorun4linuxCD.tar.gz

cd "${OLDPWD}"

]]></qemu-launcher.sh>
   </local-hooks>
  </binary>
 </files>
</live_helper>
BUILD="test-image23"
LH_BINARY_FILESYSTEM="fat16"
LH_BINARY_IMAGES="usb-hdd"
LH_BINARY_INDICES="enabled"
LH_BOOTAPPEND_LIVE="locale=de_DE.UTF-8 keyb=de"
LH_BOOTAPPEND_INSTALL="locale=de_DE.UTF-8 keyb=de"
LH_BOOTLOADER="syslinux"
LH_CHECKSUMS="enabled"
LH_CHROOT_BUILD="enabled"
LH_DEBIAN_INSTALLER="live"
LH_DEBIAN_INSTALLER_DISTRIBUTION="lenny"
LH_ENCRYPTION="disabled"
LH_HOSTNAME="debian"
LH_ISO_APPLICATION="Debian Live"
LH_ISO_PREPARER="live-helper $VERSION; 
http://packages.qa.debian.org/live-helper";
LH_ISO_PUBLISHER="Debian Live project; http://debian-live.alioth.debian.org/; 
debian-live-devel@lists.alioth.debian.org"
LH_ISO_VOLUME="Debian Live $(date +%Y%m%d-%H:%M)"
LH_MEMTEST="memtest86+"
LH_WIN32_LOADER="enabled"
LH_NET_ROOT_FILESYSTEM="nfs"
LH_NET_ROOT_PATH="/srv/debian-live"
LH_NET_ROOT_SERVER="192.168.1.1"
LH_NET_COW_FILESYSTEM="nfs"
LH_NET_TARBALL="gzip"
LH_SYSLINUX_TIMEOUT="0"
LH_SYSLINUX_MENU="disabled"
LH_SYSLINUX_MENU_LIVE_ENTRY="Start Debian Live"
LH_SYSLINUX_MENU_MEMTEST_ENTRY="Memory test"
LH_USERNAME="user"
LH_ARCHITECTURE="i386"
LH_DISTRIBUTION="lenny"
LH_MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian";
LH_MIRROR_CHROOT="http://ftp.de.debian.org/debian";
LH_MIRROR_CHROOT_SECURITY="http://security.debian.org/";
LH_MIRROR_BINARY="http://ftp.us.debian.org/debian/";
LH_MIRROR_BINARY_SECURITY="http://security.debian.org/";
LH_SECTIONS="main"
LH_CHROOT_FILESYSTEM="squashfs"
LH_UNION_FILESYSTEM="aufs"
LH_EXPOSED_ROOT="disabled"
LH_INTERACTIVE="disabled"
LH_LANGUAGE="de"
LH_LINUX_FLAVOURS="486 686"
LH_LINUX_PACKAGES="linux-image-2.6 ${LH_UNION_FILESYSTEM}-modules-2.6 
squashfs-modules-2.6"
LH_PACKAGES="loop-aes-utils"
LH_PACKAGES_LISTS="xfce"
LH_SECURITY="enabled"
LH_SYMLINKS="disabled"
LH_SYSVINIT="disabled"
LH_APT="apt"
LH_APT_PDIFFS="enabled"
LH_APT_RECOMMENDS="enabled"
LH_APT_SECURE="enabled"
LH_BOOTSTRAP="debootstrap"
LH_CACHE="enabled"
LH_CACHE_INDICES="disabled"
LH_CACHE_PACKAGES="False"
LH_CACHE_STAGES="none"
LH_DEBCONF_FRONTEND="noninteractive"
LH_DEBCONF_NOWARNINGS="yes"
LH_DEBCONF_PRIORITY="critical"
LH_INITRAMFS="auto"
LH_FDISK="fdisk"
LH_LOSETUP="losetup.orig"
LH_MODE="debian"
LH_USE_FAKEROOT="disabled"
LH_TASKSEL="aptitude"
LH_INCLUDES="/usr/share/live-helper/includes"
LH_TEMPLATES="/usr/share/live-helper/templates"
LH_QUIET="disabled"
APT_OPTIONS="--yes"
APTITUDE_OPTIONS="--assume-yes"
BUILD="test-image23"
LH_BINARY_FILESYSTEM="fat16"
LH_BINARY_IMAGES="usb-hdd"
LH_BINARY_INDICES="enabled"
LH_BOOTAPPEND_LIVE="locale=de_DE.UTF-8 keyb=de"
LH_BOOTAPPEND_INSTALL="locale=de_DE.UTF-8 keyb=de"
LH_BOOTLOADER="syslinux"
LH_CHECKSUMS="enabled"
LH_CHROOT_BUILD="enabled"
LH_DEBIAN_INSTALLER="live"
LH_DEBIAN_INSTALLER_DISTRIBUTION="lenny"
LH_ENCRYPTION="disabled"
LH_HOSTNAME="debian"
LH_ISO_APPLICATION="Debian Live"
LH_ISO_PREPARER="live-helper $VERSION; 
http://packages.qa.debian.org/live-helper";
LH_ISO_PUBLISHER="Debian Live project; http://debian-live.alioth.debian.org/; 
debian-live-devel@lists.alioth.debian.org"
LH_ISO_VOLUME="Debian Live $(date +%Y%m%d-%H:%M)"
LH_MEMTEST="memtest86+"
LH_WIN32_LOADER="enabled"
LH_NET_ROOT_FILESYSTEM="nfs"
LH_NET_ROOT_PATH="/srv/debian-live"
LH_NET_ROOT_SERVER="192.168.1.1"
LH_NET_COW_FILESYSTEM="nfs"
LH_NET_TARBALL="gzip"
LH_SYSLINUX_TIMEOUT="0"
LH_SYSLINUX_MENU="disabled"
LH_SYSLINUX_MENU_LIVE_ENTRY="Start Debian Live"
LH_SYSLINUX_MENU_MEMTEST_ENTRY="Memory test"
LH_USERNAME="user"
LH_ARCHITECTURE="i386"
LH_DISTRIBUTION="lenny"
LH_MIRROR_BOOTSTRAP="http://ftp.de.debian.org/debian";
LH_MIRROR_CHROOT="http://ftp.de.debian.org/debian";
LH_MIRROR_CHROOT_SECURITY="http://security.debian.org/";
LH_MIRROR_BINARY="http://ftp.us.debian.org/debian/";
LH_MIRROR_BINARY_SECURITY="http://security.debian.org/";
LH_SECTIONS="main"
LH_CHROOT_FILESYSTEM="squashfs"
LH_UNION_FILESYSTEM="aufs"
LH_EXPOSED_ROOT="disabled"
LH_INTERACTIVE="disabled"
LH_LANGUAGE="de"
LH_LINUX_FLAVOURS="486 686"
LH_LINUX_PACKAGES="linux-image-2.6 ${LH_UNION_FILESYSTEM}-modules-2.6 
squashfs-modules-2.6"
LH_PACKAGES="loop-aes-utils"
LH_PACKAGES_LISTS="xfce"
LH_SECURITY="enabled"
LH_SYMLINKS="disabled"
LH_SYSVINIT="disabled"
LH_APT="apt"
LH_APT_PDIFFS="enabled"
LH_APT_RECOMMENDS="enabled"
LH_APT_SECURE="enabled"
LH_BOOTSTRAP="debootstrap"
LH_CACHE="enabled"
LH_CACHE_INDICES="disabled"
LH_CACHE_PACKAGES="False"
LH_CACHE_STAGES="none"
LH_DEBCONF_FRONTEND="noninteractive"
LH_DEBCONF_NOWARNINGS="yes"
LH_DEBCONF_PRIORITY="critical"
LH_INITRAMFS="auto"
LH_FDISK="fdisk"
LH_LOSETUP="losetup.orig"
LH_MODE="debian"
LH_USE_FAKEROOT="disabled"
LH_TASKSEL="aptitude"
LH_INCLUDES="/usr/share/live-helper/includes"
LH_TEMPLATES="/usr/share/live-helper/templates"
LH_QUIET="disabled"
APT_OPTIONS="--yes"
APTITUDE_OPTIONS="--assume-yes"
LH_SOURCE="disabled"
LH_SOURCE_IMAGES="tar"
LH_SOURCE="disabled"
LH_SOURCE_IMAGES="tar"
#EXTENDED#./binary_local-hooks/qemu-launcher.sh##!/bin/sh
#EXTENDED#./binary_local-hooks/qemu-launcher.sh#
#EXTENDED#./binary_local-hooks/qemu-launcher.sh## This is a hook for 
live-helper(7) to install autorun4linuxCD.
#EXTENDED#./binary_local-hooks/qemu-launcher.sh## autorun4linuxCD was written 
by Franklin Piat <[EMAIL PROTECTED]>.
#EXTENDED#./binary_local-hooks/qemu-launcher.sh##
#EXTENDED#./binary_local-hooks/qemu-launcher.sh## To enable it, copy this hook 
into your config/binary_local-hooks directory.
#EXTENDED#./binary_local-hooks/qemu-launcher.sh#
#EXTENDED#./binary_local-hooks/qemu-launcher.sh#cd binary
#EXTENDED#./binary_local-hooks/qemu-launcher.sh#
#EXTENDED#./binary_local-hooks/qemu-launcher.sh#wget 
http://www.klabs.be/~fpiat/projects/autorun4linuxCD/autorun4linuxCD.tar.gz
#EXTENDED#./binary_local-hooks/qemu-launcher.sh#tar xfz autorun4linuxCD.tar.gz
#EXTENDED#./binary_local-hooks/qemu-launcher.sh#rm -f autorun4linuxCD.tar.gz
#EXTENDED#./binary_local-hooks/qemu-launcher.sh#
#EXTENDED#./binary_local-hooks/qemu-launcher.sh#cd "${OLDPWD}"
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh##!/bin/sh
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## This is a hook for 
live-helper(7) to install nvidia-kernel-legacy drivers
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## To enable it, copy this hook 
into your config/chroot_localhooks directory.
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh##
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## Note: This hook requires 
packages from the non-free section. Make sure you
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## enabled it in your 
configuration.
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## Building kernel module
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#which module-assistant || 
apt-get install --yes module-assistant nvidia-kernel-common
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#module-assistant update
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#for KERNEL in /boot/vmlinuz-*
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#do
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        VERSION="$(basename 
${KERNEL} | sed -e 's|vmlinuz-||')"
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        module-assistant 
--non-inter --quiet auto-install nvidia-kernel-legacy -l ${VERSION}
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#done
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#module-assistant clean 
nvidia-kernel-legacy
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## Installing additional stuff
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#apt-get install --yes 
nvidia-glx-legacy nvidia-xconfig discover
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## Fix #421028
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#if [ -f 
/usr/lib/xorg/modules/drivers/nvidia_drv.o ]
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#then
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        cd 
/usr/lib/xorg/modules/drivers
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        gcc -shared -o 
nvidia_drv.so nvidia_drv.o
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        cd ${OLDPWD}
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#fi
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## Adding init script
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#cat > 
/etc/init.d/nvidia-debian-live << EOF
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh##!/bin/sh
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## script that modify xorg 
configuration enabling
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## the nvidia proprietary module 
if the card is detected
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh## as an NVidia
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#if discover --type-summary 
display | grep -i nvidia
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#then
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        # forcing depth to 24, 
bad detection on some card (e.g my GeForce4 440 Go)
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        echo "Configuring Xorg 
for nvidia ..."
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        nvidia-xconfig -d 24
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#else
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        # not with nvidia h/w ? 
remove those GLX diversions
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        # (FIXME)
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#        apt-get --quiet --yes 
remove nvidia-glx-legacy
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#fi
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#EOF
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#chmod 0755 
/etc/init.d/nvidia-debian-live
#EXTENDED#./chroot_local-hooks/nvidia-legacy.sh#update-rc.d nvidia-debian-live 
defaults
#EXTENDED#./chroot_local-packageslists/test-packagelist## just an example
#EXTENDED#./chroot_local-packageslists/test-packagelist#psutils vim ssh  
#EXTENDED#./chroot_local-packageslists/test-packagelist#
#EXTENDED#./chroot_local-packageslists/test-packagelist#
#EXTENDED#./chroot_local-packageslists/test-packagelist#xpdf xosview
#EXTENDED#./chroot_local-packageslists/test-packagelist#
#!/bin/sh
#
# lh_xml(1) - clean up system build directories
# Copyright (C) 2006-2008 Daniel Baumann <[EMAIL PROTECTED]>
# Copyright (C) 2008 Simon Shiele <[EMAIL PROTECTED]>
# Copyright (C) 2008 Oliver Dippel <[EMAIL PROTECTED]>
#
# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.

set -e

# Including common functions
LH_BASE="${LH_BASE:-/usr/share/live-helper}"

for FUNCTION in "${LH_BASE}"/functions/*.sh
do
        . "${FUNCTION}"
done

# Setting static variables
DESCRIPTION="import and export live-helper configs as xml"
HELP=""
USAGE="${PROGRAM} [--import XML_FILE] [--build] [--export]"

#Arguments "[EMAIL PROTECTED]"

# Reading configuration files
Read_conffile config/all config/common config/bootstrap config/chroot 
config/binary config/source
Set_defaults

rm -f .lock

if [ -z "${*}" ]
then
        Usage
fi


IMPORT=""
EXPORT="0"
BUILD="0"
while ! [ -z "$1" ]
do
        case "${1}" in
                --import)
                        shift 1
                        if [ -r "$1" ]
                        then
                                IMPORT="$1"
                                shift 1
                        else
                                Usage
                        fi
                        ;;
                --export)
                        shift 1
                        EXPORT="1"
                        ;;
                --build)
                        shift 1
                        BUILD="1"
                        ;;
                -h|--help)
                        shift 1
                        Help
                        ;;

                -u|--usage)
                        shift 1
                        Usage
                        ;;

                -v|--version)
                        shift 1
                        Version
                        ;;
                *)
                        Usage
                        exit 1
                        ;;
        esac
done

if [ "$EXPORT" = "1" ]
then
        XML_Export
elif ! [ -z "$IMPORT" ]
then
        Echo_message "Importing Configuration: `basename "$IMPORT"`..."
        rm -rf config
        mkdir -p "config"
        lh_config
        XML_Import "$IMPORT"
fi

if [ "$BUILD" = "1" ]
then
        lh_clean
        rm -rf .stage cache/stages_bootstrap
        lh_bootstrap
        lh_chroot
        lh_binary
fi



Attachment: xml.sh
Description: Bourne shell script

_______________________________________________
debian-live-devel mailing list
debian-live-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/debian-live-devel

Reply via email to