Add initial zsh completion for grml-live.
[grml-live.git] / grml-live
index 0f412af..7d15c60 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -1,10 +1,10 @@
-#!/bin/sh
+#!/bin/bash
 # Filename:      grml-live
 # Purpose:       build process script for generating a (grml based) Linux Live-ISO
 # 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: Sat Sep 15 22:32:11 CEST 2007 [mika]
+# Latest change: Sun Sep 16 23:53:24 CEST 2007 [mika]
 ################################################################################
 
 # read configuration files, set some misc variables {{{
@@ -56,14 +56,14 @@ usage()
   echo "
 $PN - build process script for generating a (grml based) Linux Live-ISO
 
-Usage: $PN [-c <classe[s]>] [-t <target_directory>] [-F] [-h|--help] [additional_arguments_for_fai]
+Usage: $PN [-c <classe[s]>] [-t <target_directory>] [-s <suite> [-Fvh]
 
 Usage examples:
 
     $PN
     $PN -c GRML,I386 -t /dev/shm/grml
     $PN -c GRML,GRML_X,I386 -t /grml/
-    $PN -c GRML,I386
+    $PN -s sid -c GRML,I386
 
 More details: man grml-live
               /usr/share/doc/grml-live/grml-live.html
@@ -76,18 +76,23 @@ http://grml.org/bugs/
 
 # command line parsing {{{
 
-while getopts ?t:f:Fhv: opt; do
+while getopts "c:s:t:Fhv" opt; do
   case "$opt" in
     c) CLASSES="$OPTARG" ;;
+    # f) FLAVOUR="$OPTARG" ;; # TODO
     F) FORCE=1 ;;
     h) usage ; bailout 0 ;;
-    t) TARGET="$OPTARG" ;;
+    s) SUITE="$OPTARG" ;;
+    t) TARGET="$OPTARG"
+       CHROOT_TARGET="$TARGET/grml_chroot"
+       BUILD_TARGET="$TARGET/grml_cd"
+       ISO_TARGET="$TARGET/grml_isos"
+       ;;
     v) VERBOSE="-v" ;;
     ?) echo "invalid option -$OPTARG" >&2; bailout 1 ;;
   esac
 done
 shift $(($OPTIND - 1))  # set ARGV to the first not parsed commandline parameter
-# FAI_ARGS="$*"
 
 # }}}
 
@@ -108,7 +113,9 @@ if [ -z "$FORCE" ] ; then
    [ -n "$CHROOT_TARGET" ] && echo "  chroot target:     $CHROOT_TARGET"
    [ -n "$BUILD_TARGET" ]  && echo "  build target:      $BUILD_TARGET"
    [ -n "$ISO_TARGET" ]    && echo "  ISO target:        $ISO_TARGET"
-   [ -n "$FAI_ARGS" ] && echo "  additional arguments for FAI: $FAI_ARGS"
+   [ -n "$SUITE" ]         && echo "  Debian suite:      $SUITE"
+   [ -n "$FAI_ARGS" ]      && echo "  additional arguments for FAI: $FAI_ARGS"
+   [ -n "$VERBOSE" ]       && echo "  Using VERBOSE mode."
    echo
    echo -n "Is this ok for you? [y/N] "
    read a
@@ -124,6 +131,14 @@ if [ -n "$GRML_LIVE_SOURCES" ] ; then
    echo "$GRML_LIVE_SOURCES" > /etc/grml/fai/apt/sources.list
 fi
 
+# we assume that it is set to 'etch' by default
+if [ -n "$SUITE" ] ; then
+   sed -i "s#etch #$SUITE #"   /etc/grml/fai/make-fai-nfsroot.conf
+   sed -i "s#etch #$SUITE #"   /etc/grml/grml-live.conf
+   sed -i "s# etch # $SUITE #" /etc/grml/grml-live.conf
+   sed -i "s# etch # $SUITE #" /etc/grml/fai/apt/sources.list
+fi
+
 if [ -n "$FAI_DEBOOTSTRAP" ] ; then
    sed -i "s#^FAI_DEBOOTSTRAP#FAI_DEBOOTSTRAP=$FAI_DEBOOTSTRAP#" /etc/grml/fai/make-fai-nfsroot.conf
 fi
@@ -131,6 +146,7 @@ fi
 
 # CHROOT_TARGET - execute FAI {{{
 [ -n "$CHROOT_TARGET" ] || CHROOT_TARGET="$TARGET/grml_chroot"
+
 if [ -d "$CHROOT_TARGET" ] ; then
    echo "  [x] $CHROOT_TARGET exists already, skipping the stage 'fai dirnstall'"
 else
@@ -146,31 +162,37 @@ fi
 [ -n "$BUILD_TARGET" ] || BUILD_TARGET="$TARGET/grml_cd"
 mkdir -p "$BUILD_TARGET" || bailout 6 "Problem with creating $BUILD_TARGET for stage ARCH"
 
-# x86:
-if [ "$ARCH" = x86 ] ; then
+# i386:
+[ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)"
+if [ "$ARCH" = i386 ] ; then
    if [ -d "$BUILD_TARGET"/boot/isolinux ] ; then
       echo "  [x] $BUILD_TARGET/boot/isolinux exists already - skipping stage 'boot/isolinux'"
       continue
    else
+      # booting stuff:
       mkdir -p "$BUILD_TARGET"/boot/isolinux
       mkdir "$BUILD_TARGET"/GRML
-      cp /boot/memtest86+.bin                                       "$BUILD_TARGET"/boot/isolinux/memtest
-      cp "$CHROOT_TARGET"/boot/initrd*                              "$BUILD_TARGET"/boot/isolinux/initrd.gz
-      cp "$CHROOT_TARGET"/boot/vmlinuz*                             "$BUILD_TARGET"/boot/isolinux/linux26
-      cp /usr/lib/syslinux/chain.c32                                "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/lib/syslinux/isolinux.bin                             "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/lib/syslinux/memdisk                                  "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/lib/syslinux/menu.c32                                 "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/share/grml-live/x86_files/boot/isolinux/allinone.img  "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/share/grml-live/x86_files/boot/isolinux/balder10.imz  "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/share/grml-live/x86_files/boot/isolinux/boot-beep.msg "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/share/grml-live/x86_files/boot/isolinux/boot.msg      "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/share/grml-live/x86_files/boot/isolinux/f*            "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/share/grml-live/x86_files/boot/isolinux/isolinux.cfg  "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/share/grml-live/x86_files/boot/isolinux/logo.16       "$BUILD_TARGET"/boot/isolinux/
-      cp /usr/share/grml-live/x86_files/boot/isolinux/syslinux.cfg  "$BUILD_TARGET"/boot/isolinux/
-      # minirt26.gz
-      # boot.cat
+      cp /boot/memtest86+.bin                                        "$BUILD_TARGET"/boot/isolinux/memtest
+      cp "$CHROOT_TARGET"/boot/initrd*                               "$BUILD_TARGET"/boot/isolinux/initrd.gz
+      cp "$CHROOT_TARGET"/boot/vmlinuz*                              "$BUILD_TARGET"/boot/isolinux/linux26
+      cp /usr/lib/syslinux/chain.c32                                 "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/lib/syslinux/isolinux.bin                              "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/lib/syslinux/memdisk                                   "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/lib/syslinux/menu.c32                                  "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/share/grml-live/i386_files/boot/isolinux/allinone.img  "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/share/grml-live/i386_files/boot/isolinux/balder10.imz  "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/share/grml-live/i386_files/boot/isolinux/boot-beep.msg "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/share/grml-live/i386_files/boot/isolinux/boot.msg      "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/share/grml-live/i386_files/boot/isolinux/f*            "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/share/grml-live/i386_files/boot/isolinux/isolinux.cfg  "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/share/grml-live/i386_files/boot/isolinux/logo.16       "$BUILD_TARGET"/boot/isolinux/
+      cp /usr/share/grml-live/i386_files/boot/isolinux/syslinux.cfg  "$BUILD_TARGET"/boot/isolinux/
+      # autostart for Windows:
+      cp /usr/share/grml-live/windows/autostart/autorun.bat          "$BUILD_TARGET"/
+      cp /usr/share/grml-live/windows/autostart/autorun.inf          "$BUILD_TARGET"/
+      cp /usr/share/grml-live/windows/autostart/autorun.pif          "$BUILD_TARGET"/
+      cp /usr/share/grml-live/windows/autostart/cdrom.ico            "$BUILD_TARGET"/
+      # windows-binaries:
       if [ -n "$WINDOWS_BINARIES" ] ; then
          if [ -d "$BUILD_TARGET"/windows ] ; then
             echo "  [x] $BUILD_TARGET/windows exists already - skipping stage 'WINDOWS_BINARIES'"