Support TEMPLATE_DIRECTORY in config file
authorMichael Prokop <devnull@localhost>
Sat, 6 Oct 2007 15:35:00 +0000 (17:35 +0200)
committerMichael Prokop <devnull@localhost>
Sat, 6 Oct 2007 15:35:00 +0000 (17:35 +0200)
debian/changelog
etc/grml/grml-live.conf
grml-live

index e6c8688..063956f 100644 (file)
@@ -3,6 +3,8 @@ grml-live (0.0.4) unstable; urgency=low
   * The -t option for specifying the output directory has been
     renamed into -o. The option -t now specifies the place where
     templates for building the ISO can be found.
   * The -t option for specifying the output directory has been
     renamed into -o. The option -t now specifies the place where
     templates for building the ISO can be found.
+  * Option -t can be used for specifying the template directory.
+    TEMPLATE_DIRECTORY can be used in /etc/grml/grml-live.conf
   * Check for /var/run/fai/FAI_INSTALLATION_IN_PROGRESS and exit then.
   * /etc/grml/fai/config/hooks/instsoft.GRMLBASE:
     - disable pipeline workaround 
   * Check for /var/run/fai/FAI_INSTALLATION_IN_PROGRESS and exit then.
   * /etc/grml/fai/config/hooks/instsoft.GRMLBASE:
     - disable pipeline workaround 
index 7481914..7a3044f 100644 (file)
@@ -3,7 +3,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.
 # 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 29 10:46:18 CEST 2007 [mika]
+# Latest change: Sat Oct 06 17:34:28 CEST 2007 [mika]
 ################################################################################
 
 # Main output directory
 ################################################################################
 
 # Main output directory
@@ -93,6 +93,11 @@ GRML_FAI_CONFIG=/etc/grml/fai
 # It defaults to output of 'dpkg --print-architecture'
 # ARCH="i386"
 
 # It defaults to output of 'dpkg --print-architecture'
 # ARCH="i386"
 
+# Do you want to use your own templates? If so set the
+# template directory but please make sure it looks
+# likes the default directory [/usr/share/grml-live/templates]
+# TEMPLATE_DIRECTORY='/usr/share/grml-live/templates'
+
 # Do you want to download pageant, plink, pscp, psftp, putty and puttygen
 # using wget to store it inside $BUILD_OUTPUT/windows/?
 # Just unset it do skip download via wget or modify the download URL.
 # Do you want to download pageant, plink, pscp, psftp, putty and puttygen
 # using wget to store it inside $BUILD_OUTPUT/windows/?
 # Just unset it do skip download via wget or modify the download URL.
index c39e5d5..976f73d 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -178,9 +178,9 @@ shift $(($OPTIND - 1))  # set ARGV to the first not parsed commandline parameter
 
 # some misc checks before executing FAI {{{
 [ -n "$CLASSES" ] || bailout 1 "Error: \$CLASSES unset, please set it in $LIVE_CONF or
 
 # some misc checks before executing FAI {{{
 [ -n "$CLASSES" ] || bailout 1 "Error: \$CLASSES unset, please set it in $LIVE_CONF or
-specify it on the command line using the -c|--classes option."
+specify it on the command line using the -c option."
 [ -n "$OUTPUT" ] || bailout 1 "Error: \$OUTPUT unset, please set it in $LIVE_CONF or
 [ -n "$OUTPUT" ] || bailout 1 "Error: \$OUTPUT unset, please set it in $LIVE_CONF or
-specify it on the command line using the -t|--target option."
+specify it on the command line using the -o option."
 # }}}
 
 # ask user whether the setup is ok {{{
 # }}}
 
 # ask user whether the setup is ok {{{
@@ -308,12 +308,23 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
       cp /usr/lib/syslinux/isolinux.bin                    "$BUILD_OUTPUT"/boot/isolinux/
       cp /usr/lib/syslinux/memdisk                         "$BUILD_OUTPUT"/boot/isolinux/
       cp /usr/lib/syslinux/menu.c32                        "$BUILD_OUTPUT"/boot/isolinux/
       cp /usr/lib/syslinux/isolinux.bin                    "$BUILD_OUTPUT"/boot/isolinux/
       cp /usr/lib/syslinux/memdisk                         "$BUILD_OUTPUT"/boot/isolinux/
       cp /usr/lib/syslinux/menu.c32                        "$BUILD_OUTPUT"/boot/isolinux/
-      cp /usr/share/grml-live/templates/boot/isolinux/*    "$BUILD_OUTPUT"/boot/isolinux/
-      cp /usr/share/grml-live/templates/boot/isolinux/*    "$BUILD_OUTPUT"/boot/isolinux/
-      cp -a /usr/share/grml-live/templates/boot/grub       "$BUILD_OUTPUT"/boot/
 
 
+      if ! [ -d "${TEMPLATE_DIRECTORY}"/boot ] ; then
+         log "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting."
+         eerror "${TEMPLATE_DIRECTORY}/boot does not exist. Exiting." ; eend 1
+         bailout 8
+      fi
+      cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*               "$BUILD_OUTPUT"/boot/isolinux/
+      cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*               "$BUILD_OUTPUT"/boot/isolinux/
+      cp -a ${TEMPLATE_DIRECTORY}/boot/grub                  "$BUILD_OUTPUT"/boot/
+
+      if ! [ -d "${TEMPLATE_DIRECTORY}"/GRML ] ; then
+         log "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting."
+         eerror "${TEMPLATE_DIRECTORY}/GRML does not exist. Exiting." ; eend 1
+         bailout 9
+      fi
       [ -d "$BUILD_OUTPUT"/GRML ] || mkdir "$BUILD_OUTPUT"/GRML
       [ -d "$BUILD_OUTPUT"/GRML ] || mkdir "$BUILD_OUTPUT"/GRML
-      cp -a /usr/share/grml-live/templates/GRML/* "$BUILD_OUTPUT"/GRML/
+      cp -a ${TEMPLATE_DIRECTORY}/GRML/* "$BUILD_OUTPUT"/GRML/
 
       # adjust boot splash information:
       ISO_DATE="$(date +%Y-%m-%d)"
 
       # adjust boot splash information:
       ISO_DATE="$(date +%Y-%m-%d)"
@@ -334,7 +345,9 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
       sed -i "s/%GRML_NAME%/$GRML_NAME/"       "$BUILD_OUTPUT"/boot/grub/menu.lst
 
       # autostart for Windows:
       sed -i "s/%GRML_NAME%/$GRML_NAME/"       "$BUILD_OUTPUT"/boot/grub/menu.lst
 
       # autostart for Windows:
-      cp /usr/share/grml-live/templates/windows/autostart/* "$BUILD_OUTPUT"/
+      if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then
+         cp ${TEMPLATE_DIRECTORY}/windows/autostart/* "$BUILD_OUTPUT"/
+      fi
       # windows-binaries:
       if [ -n "$WINDOWS_BINARIES" ] ; then
          if [ -f "$BUILD_OUTPUT"/windows/putty.exe ] ; then
       # windows-binaries:
       if [ -n "$WINDOWS_BINARIES" ] ; then
          if [ -f "$BUILD_OUTPUT"/windows/putty.exe ] ; then