Index: /drbl-hadoop-live/Makefile
===================================================================
--- /drbl-hadoop-live/Makefile	(revision 151)
+++ /drbl-hadoop-live/Makefile	(revision 152)
@@ -5,3 +5,5 @@
 	sudo lh clean --purge
 	sudo rm -rf config
-	sudo rm build.log error.log
+
+drbl-hadoop: clean
+	sudo ./create-hadoop-live-by-pkg -m http://free.nchc.org.tw/debian -s http://free.nchc.org.tw/debian-security -e unstable > build.log 2> error.log
Index: /drbl-hadoop-live/create-hadoop-live
===================================================================
--- /drbl-hadoop-live/create-hadoop-live	(revision 152)
+++ /drbl-hadoop-live/create-hadoop-live	(revision 152)
@@ -0,0 +1,732 @@
+#!/bin/bash
+# Author: Steven Shiau <steven _at_ nchc org tw>
+# License: GPL
+# Description: This script will create a DRBL live CD/USB flash drive iso/zip
+# This script works with live helper 1.0~a42-2 or later (Patched by DRBL team)
+
+#
+set -e
+
+#
+DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/opt/drbl/}"
+
+. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
+. $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
+. $DRBL_SCRIPT_PATH/sbin/ocs-functions
+
+# debian_mirror_url_def, debian_mirror_security_url_def, DRBL_REPOSITORY_URL_def and DRBL_GPG_KEY_URL are loaded from drbl-ocs.conf
+
+# debian_type can be minimal (about 67 MB for Etch)/minimal-net (about 85 MB for Etch).
+# We have to use standard, since if using minimal, it will ignore apt key from DRBL.
+#debian_type="minimal"
+debian_type="standard"
+DEBIAN_DIST_DEF="lenny"
+pkgs="$PKG_FROM_DBN_WHICH_OCS_LIVE_NEED drbl $PKG_FROM_DBN $PKG_TO_QUERY $PKG_FROM_DRBL"
+categories_default="main non-free"
+cpu_flavor_default="486"
+bootstrap_default="cdebootstrap"
+
+# The files in dir $ocs_live_script_dir/ will be copied to the dir live-hook-dir in dir chroot. The file "drbl-live-hook" is in $ocs_live_script_dir
+ocs_live_script_dir="$DRBL_SCRIPT_PATH/setup/files/ocs/live-hook"
+# The script inside $ocs_live_script_dir/ will be run when chroot. There are many files in $$ocs_live_script_dir/, we will just run one here.
+run_hook_script="hadoop-live-hook"
+
+#
+check_if_root
+#
+prog="$(basename $0)"
+full_cmd="$prog $*"
+
+# functions
+USAGE() {
+    echo "Usage:"
+    echo "To create a Debian live CD which is used a template for Clonezilla live:"
+    echo "$prog [OPTION]"
+    echo "OPTION:"
+    language_help_prompt_by_idx_no
+    echo "-b, --branch [s|stable|t|testing|u|unstable]  Specify the DRBL branch to be used in Live CD. Default is stable."
+    echo "-bt, --bootstrap BOOTSTRAP  Specify the bootsrap type as BOOTSTRAP (cdebootstrap or debootstrap). If not specified, $bootstrap_default will be used."
+    echo "-c, --categories CAT   Sepcify the category, e.g. 'main', 'main non-free', default is \'$categories_default\' if not specified."
+    echo "-d, --debian-dist [stable|testing|unstable|lenny|squeeze|sid...]  Assign Debian dist, the default is $DEBIAN_DIST_DEF if not assigned."
+    echo "-f, --arch-flavor ARCH  Assign the CPU architecture flavor as ARCH, e.g. 486 or 686. If it's not assigned, $cpu_flavor will be used."
+    echo "-g, --drbl-repo-url URL  Assign the DRBL repository URL instead of default one $DRBL_REPOSITORY_URL_def."
+    echo "-n, --live-kernel-pkg KERNEL_VER Assign kernel version as KERNEL_VER (KERNEL VER package must exist in repository. Ex. if KERNEL_VER is 2.6.20-1-486, then linux-image-2.6.20-1-486, squashfs-modules-2.6.20-1-486, and unionfs-modules-2.6.20-1-486 will be used."
+    echo "-i, --assign-version-no NO  Assign the version no as NO instead of date."
+    echo "-e, --drbl-live-branch [s|stable|t|testing|u|unstable|e|experimental]  specifies the DRBL live branch to be used in Live CD. Default is stable."
+    echo "-k, --package FILE  Specify package FILE to be installed in Live CD."
+    echo "-p, --packages-list FILE  specifies an external package list file (such as xfce, gnome, kde...), one package for each line"
+    echo "-m, --mirror-url URL  Assign the Debian repository URL instead of default one $debian_mirror_url_def. "
+    echo "-r, --rm-tmp-iso    Remove the first stage temp iso file"
+    echo "-s, --mirror-security-url URL  Assign the Debian security repository URL instead of default one $debian_mirror_security_url_def."
+    echo "-t, --target-media-file  [cd|iso|usb|zip|b|both] Assign the target media file as CD (cd or iso), USB flash drive (usb or zip) or both of them (b or both). Default is both"
+    echo "-u, --use-existing-tmp-iso  Use the existing first stage temp iso file"
+    echo "-x, --extra-boot-param  EXTRA_PARAM  Assign extra boot parameter EXTRA_PARAM for the kernel to read. These parameters are the same with that from live-initramfs. Ex. \"noprompt\" can be use to not prompt to eject the CD on reboot."
+    echo "-v, --verbose    Run lh helper in verbose mode"
+    echo "Ex: $0 -l en -d etch -p xfce -b u -k \"iceweasel-l10n-zh-tw x-ttcidfont-conf ttf-arphic-newsung gparted scim-chewing scim-tables-zh im-switch mlterm mlterm-im-scim discover1 xresprobe mdetect\" -e e -n 2.6.24-etchnhalf.1 -i 0.9.11-7"
+}
+#
+clean_tmp_dirs_files() {
+  [ -d "$stage1_iso_TMP" -a -n "$(echo $stage1_iso_TMP | grep "ocs-iso-tmp")" ] && rm -rf $stage1_iso_TMP
+  [ -d "$ISOSYSLNX_TMP" -a -n "$(echo $ISOSYSLNX_TMP | grep "isolnx-tmp")" ] && rm -rf $ISOSYSLNX_TMP
+  [ -d "$USB_TMP" -a -n "$(echo $USB_TMP | grep "ocs-usb-dev")" ] && rm -rf $USB_TMP
+  # clean the tmp iso.
+  [ "$rm_tmp_iso" = "yes" -a -f "$stage1_target_iso" ] && rm -f $stage1_target_iso
+} # end of clean_tmp_dirs_files
+#
+create_version_tag_in_live() {
+  local tag_file_in_abs_path="$1"
+  local ver_tag_="$2"
+  local drbl_v clonezilla_v
+  drbl_v="$(dpkg -l drbl | tail -n 1 | awk -F" " '{print $3}')"
+  clonezilla_v="$(dpkg -l clonezilla | tail -n 1 | awk -F" " '{print $3}')"
+  cat <<-TAG_END > $tag_file_in_abs_path
+$ver_tag_
+DRBL: $drbl_v
+Clonezilla: $clonezilla_v
+This DRBL live was created by:
+$full_cmd
+TAG_END
+}
+#
+create_drbl_live_iso(){
+  echo "$msg_delimiter_star_line"
+  echo "Creating DRBL server iso file..."
+  echo "$msg_delimiter_star_line"
+  #
+  # Possible kernel/initrd paths are /casper (created by casper) or /live (created by live-initramfs)
+  # Find the kernel and initrd in $stage1_iso_TMP/casper or $stage1_iso_TMP/live
+  # Ex: $stage1_iso_TMP/casper/vmlinuz1, /$stage1_iso_TMP/casper/initrd1.img
+  # $live_sys_files_dir_list is from drbl-ocs.conf.
+  # Possible kernel/initrd paths are /casper (created by casper) or /live (created by live-initramfs)
+  sys_files_dir=""
+  for i in $live_sys_files_dir_list; do
+    krnfile="$(find $stage1_iso_TMP/$i/ -maxdepth 1 -name "vmlinuz*" -print 2>/dev/null)"
+    if [ -n "$krnfile" ]; then
+      krnfile="$(basename $krnfile)"
+      sys_files_dir="$i"
+      irdfile="$(find $stage1_iso_TMP/$i/ -maxdepth 1 -name "initrd*" -print)"
+      irdfile="$(basename $irdfile)"
+      break
+    fi
+  done
+  BOOT_ITEM_DIR=$ISOSYSLNX_TMP/$sys_files_dir
+  [ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR
+
+  if [ -z "$sys_files_dir" ]; then
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+    echo "No system files from template live iso are found! Something went wrong!"
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+    echo "$msg_program_stop"
+    exit 1
+  fi
+  
+  if [ -z "$krnfile" -o -z "$irdfile" ]; then
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+     echo "Kernel and initrd files NOT found in path $stage1_iso_TMP/$sys_files_dir/!"
+     echo "$msg_program_stop"
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+     exit 1
+  fi
+
+  # Now we can insert the boot menu of isolinux
+  mkdir -p $ISOSYSLNX_TMP/syslinux $ISOSYSLNX_TMP/isolinux
+  # create isolinux menu
+  # isolinux should be rw, so we have to copy it, and exclude the one in iso image.
+  rsync -a --exclude f*.txt --exclude boot.cat --exclude isolinux.txt --exclude isolinux.bin --exclude splash.rle --exclude doc $stage1_iso_TMP/isolinux $ISOSYSLNX_TMP/
+  # We have to overwrite isolinux.bin since vesamenu.c32 should be same version with that.
+  # For isolinux
+  cp -af $isolinux_file $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $pxelinux_chain_file $ISOSYSLNX_TMP/isolinux/
+  # For syslinux
+  cp -af $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $pxelinux_chain_file $ISOSYSLNX_TMP/syslinux/
+
+  etherboot_zlilo="$($query_pkglist_cmd drbl-etherboot | grep -E "eb-.*-etherboot-pci.zlilo$")"
+  if [ -n "$etherboot_zlilo" ]; then
+    # We have to force it name as etherboot.zdsk, since isolinux only uses the "plain" ISO 9660 filenames, i.e. it does not support Rock Ridge or Joliet filenames.
+    # ref: http://syslinux.zytor.com/archives/2006-October/007440.html
+    # "-" will be regards as "_" if you want to use "-" for isolinux.
+    # In syslinux on vfat, etherboot.zlilo is too long, make it ever shorter as eb.zli
+    cp -af $etherboot_zlilo $BOOT_ITEM_DIR/eb.zli
+  fi
+  # Same reason, we have to use different name in isolinux
+  gpxe_lkn="$($query_pkglist_cmd gpxe 2>/dev/null | grep -E "gpxe.lkrn$")"
+  if [ -n "$gpxe_lkn" ]; then
+    # This is run in DRBL server
+    cp -af $gpxe_lkn $BOOT_ITEM_DIR/gpxe.lkn
+  fi
+  # Same reason, we have to use different name in isolinux
+  [ -e "$fdos_img_src" ] && cp -af $fdos_img_src $BOOT_ITEM_DIR/freedos.img
+  [ -e "$memtest86_file" ] && cp -af $memtest86_file $BOOT_ITEM_DIR/memtest
+
+  # Put the tag
+  # The VER_TAG is like drbl-live-xfce-20070315
+  VER_TAG="$(echo $real_target_iso | sed -e "s/.iso$//g")"
+  create_version_tag_in_live $ISOSYSLNX_TMP/DRBL-Live-Version "$VER_TAG"
+
+  # Excluding list for mkisofs
+  # We will create it like this:
+  # -x $stage1_iso_TMP/isolinux -x $stage1_iso_TMP/md5sum.txt -x $stage1_iso_TMP/casper/memtest 
+  mkiso_exclude_list="isolinux syslinux md5sum.txt doc utils"
+  for i in $live_sys_files_dir_list; do
+    if [ -e "$stage1_iso_TMP/$i/memtest" ]; then
+      mkiso_exclude_list="$mkiso_exclude_list $i/memtest"
+      break
+    fi
+  done
+  mkiso_exclude_opt=""
+  for i in $mkiso_exclude_list; do
+    mkiso_exclude_opt="$mkiso_exclude_opt -x $stage1_iso_TMP/$i"
+  done
+
+  # Find the boot param $boot_param
+  get_live_boot_param $stage1_iso_TMP/isolinux
+  # generate the menu
+  # For isolinux
+  ocs-live-boot-menu -s -l $lang_answer --title "DRBL Live" -f 785 -n "$version_no" -k /$sys_files_dir/$krnfile -i /$sys_files_dir/$irdfile -m $pxelinux_bg_img --boot-param "$boot_param $live_extra_boot_param" isolinux $ISOSYSLNX_TMP/isolinux/
+  # For syslinux
+  ocs-live-boot-menu -s -l $lang_answer --title "DRBL Live" -f 785 -n "$version_no" -k /$sys_files_dir/$krnfile -i /$sys_files_dir/$irdfile -m $pxelinux_bg_img --boot-param "$boot_param $live_extra_boot_param" syslinux $ISOSYSLNX_TMP/syslinux/
+
+  echo "Preparing syslinux.exe, syslinux, makeboot.bat and makeboot.sh in dir utils... "
+  put_syslinux_makeboot_for_usb_flash $ISOSYSLNX_TMP
+  
+  # $sys_files_dir maybe /casper, /live or /isolinux. If it is isolinux, we can not list them twice otherwise mkisofs will go wrong.
+  if [ "$sys_files_dir" != "isolinux" ]; then
+    sys_files_dir_graft_point="/isolinux/=$ISOSYSLNX_TMP/isolinux/ /syslinux/=$ISOSYSLNX_TMP/syslinux/ /$sys_files_dir/=$ISOSYSLNX_TMP/$sys_files_dir/"
+  else
+    sys_files_dir_graft_point="/isolinux/=$ISOSYSLNX_TMP/isolinux/ /syslinux/=$ISOSYSLNX_TMP/syslinux/" 
+  fi
+  # create the iso file
+  genisoimage \
+   -A "DRBL Live CD" \
+   -V "DRBL-live" \
+   -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" \
+   -r -J -l \
+   -b isolinux/isolinux.bin -c isolinux/boot.cat \
+   -no-emul-boot -boot-load-size 4 -boot-info-table \
+   -x $stage1_iso_TMP/isolinux \
+   -x $stage1_iso_TMP/md5sum.txt \
+   $mkiso_exclude_opt \
+   -graft-points $stage1_iso_TMP \
+    $sys_files_dir_graft_point \
+    /COPYING=$DRBL_SCRIPT_PATH/doc/COPYING \
+    /DRBL-Live-Version=$ISOSYSLNX_TMP/DRBL-Live-Version \
+    /utils=$ISOSYSLNX_TMP/utils \
+   > $real_target_iso
+  RC_ISO=$?
+  if [ "$RC_ISO" -eq 0 ]; then
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
+    echo "The $real_target_iso is created successfully!"
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+  else
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+    echo "The $real_target_iso is NOT created! Something went wrong!"
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+  fi
+} # end of create_drbl_live_iso
+#
+create_drbl_live_zip() {
+  # create temp dir for usb flash drive
+  echo "$msg_delimiter_star_line"
+  echo "Creating DRBL server zip file..."
+  echo "$msg_delimiter_star_line"
+  #
+  # Possible kernel/initrd paths are /casper (created by casper) or /live (created by live-initramfs)
+  # Find the kernel and initrd in $stage1_iso_TMP/casper or $stage1_iso_TMP/live
+  # Ex: $stage1_iso_TMP/casper/vmlinuz1, /$stage1_iso_TMP/casper/initrd1.img
+  # $live_sys_files_dir_list is from drbl-ocs.conf.
+  # Possible kernel/initrd paths are /casper (created by casper) or /live (created by live-initramfs)
+  sys_files_dir=""
+  for i in $live_sys_files_dir_list; do
+    krnfile="$(find $stage1_iso_TMP/$i/ -maxdepth 1 -name "vmlinuz*" -print 2>/dev/null)"
+    if [ -n "$krnfile" ]; then
+      krnfile="$(basename $krnfile)"
+      sys_files_dir="$i"
+      irdfile="$(find $stage1_iso_TMP/$i/ -maxdepth 1 -name "initrd*" -print)"
+      irdfile="$(basename $irdfile)"
+      break
+    fi
+  done
+
+  if [ -z "$sys_files_dir" ]; then
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+    echo "No system files from template live iso are found! Something went wrong!"
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+    echo "$msg_program_stop"
+    exit 1
+  fi
+  
+  if [ -z "$krnfile" -o -z "$irdfile" ]; then
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+     echo "Kernel and initrd files NOT found in path $stage1_iso_TMP/$sys_files_dir/!"
+     echo "$msg_program_stop"
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+     exit 1
+  fi
+
+  WD="$(pwd)"
+  USB_TMP="$(mktemp -d /tmp/ocs-usb-dev.XXXXXX)"
+  mkdir -p $USB_TMP/$sys_files_dir
+  mkdir -p $USB_TMP/syslinux/ $USB_TMP/isolinux/
+  echo "Copying files to temp working directory... This might take some time..."
+  rsync -av --exclude isolinux --exclude md5sum.txt --exclude doc $stage1_iso_TMP/*  $USB_TMP/
+  cp -af $DRBL_SCRIPT_PATH/doc/COPYING $USB_TMP/
+  # For syslinux
+  cp -af $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $pxelinux_chain_file $USB_TMP/syslinux/
+  # For isolinux
+  cp -af $isolinux_file $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $pxelinux_chain_file $USB_TMP/isolinux/
+  # ref: http://syslinux.zytor.com/archives/2006-October/007440.html
+  # "-" will be regards as "_" if you want to use "-" for isolinux.
+  # In syslinux on vfat, etherboot.zlilo is too long, make it ever shorter as eb.zli
+  etherboot_zlilo="$($query_pkglist_cmd drbl-etherboot | grep -E "eb-.*-etherboot-pci.zlilo$")"
+  if [ -n "$etherboot_zlilo" ]; then
+    # we have to force it name as etherboot.zdsk, since isolinux only uses the "plain" ISO 9660 filenames, i.e. it does not support Rock Ridge or Joliet filenames.
+    # ref: http://syslinux.zytor.com/archives/2006-October/007440.html
+    # "-" will be regards as "_" if you want to use "-" for isolinux.
+    # In syslinux on vfat, etherboot.zlilo is too long, make it ever shorter as eb.zli
+    cp -af $etherboot_zlilo $USB_TMP/$sys_files_dir/eb.zli
+  fi
+  [ -e "$fdos_img_src" ] && cp -af $fdos_img_src $USB_TMP/$sys_files_dir/freedos.img
+  [ -e "$memtest86_file" ] && cp -af $memtest86_file $USB_TMP/$sys_files_dir/memtest
+  cp -af $stage1_iso_TMP/$sys_files_dir/{$krnfile,$irdfile} $USB_TMP/$sys_files_dir/
+  # Put the tag
+  # The VER_TAG is like drbl-live-xfce-20070315
+  VER_TAG="$(echo $real_target_zip | sed -e "s/.zip$//g")"
+  create_version_tag_in_live $USB_TMP/DRBL-Live-Version "$VER_TAG" 
+
+  # Find the boot param $boot_param
+  get_live_boot_param $stage1_iso_TMP/isolinux
+  # generate the menu
+  # For syslinux
+  ocs-live-boot-menu -s -l $lang_answer --title "DRBL Live" -f 785 -n "$version_no" -k /$sys_files_dir/$krnfile -i /$sys_files_dir/$irdfile -m $pxelinux_bg_img --boot-param "$boot_param $live_extra_boot_param noprompt" syslinux $USB_TMP/syslinux/
+  # For isolinux
+  ocs-live-boot-menu -s -l $lang_answer --title "DRBL Live" -f 785 -n "$version_no" -k /$sys_files_dir/$krnfile -i /$sys_files_dir/$irdfile -m $pxelinux_bg_img --boot-param "$boot_param $live_extra_boot_param noprompt" isolinux $USB_TMP/isolinux/
+
+  echo "Preparing syslinux.exe, syslinux, makeboot.bat and makeboot.sh in dir utils... "
+  put_syslinux_makeboot_for_usb_flash $USB_TMP
+  # just store it. since big files, like squash flie and opt_drbl.tgz are compressed, it's not necessary to compress it again.
+  [ -e "$WD/$real_target_zip" ] && rm -f $WD/$real_target_zip
+  (cd $USB_TMP; zip -0 -r $WD/$real_target_zip *)
+  echo "The created release file is $real_target_zip. You can extract all the files into your pendrive, and run makeboot.bat from pendrive on MS windows."
+  [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
+  echo "Warning: DO NOT RUN makeboot.bat from your local hard drive!! It is intended to be run from your USB device."
+  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+  
+} # end of create_drbl_live_zip
+
+# default settings
+extra_pkgs=""
+pkg_list=""
+pkg_list_opt=""
+rm_tmp_iso="no"
+use_existing_stage1_iso="no"
+TARGET_MEDIA_FILE_DEF="both"
+# Parse command-line options
+while [ $# -gt 0 ]; do
+  case "$1" in
+    -l|--language)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              specified_lang="$1"
+              shift
+            fi
+	    [ -z "$specified_lang" ] && USAGE && exit 1
+            ;;
+    -b|--branch)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              drbl_branch="$1"
+              shift
+            fi
+	    [ -z "$drbl_branch" ] && USAGE && exit 1
+            ;;
+    -bt|--bootstrap)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              bootstrap="$1"
+              shift
+            fi
+	    [ -z "$bootstrap" ] && USAGE && exit 1
+            ;;
+    -c|--categories)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              categories="$1"
+              shift
+            fi
+	    [ -z "$categories" ] && USAGE && exit 1
+            ;;
+    -d|--debian-dist)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              debian_dist="$1"
+              shift
+            fi
+	    [ -z "$debian_dist" ] && USAGE && exit 1
+            ;;
+    -i|--assign-version-no)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              version_no="$1"
+              shift
+            fi
+	    [ -z "$version_no" ] && USAGE && exit 1
+            ;;
+    -k|--package)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              extra_pkgs="$1"
+              shift
+            fi
+	    [ -z "$extra_pkgs" ] && USAGE && exit 1
+            ;;
+    -n|--live-kernel-pkg)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              live_kernel_ver="$1"
+              shift
+            fi
+	    [ -z "$live_kernel_ver" ] && USAGE && exit 1
+            ;;
+    -e|--drbl-live-branch)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              drbl_live_branch="$1"
+              shift
+            fi
+	    [ -z "$drbl_live_branch" ] && USAGE && exit 1
+            ;;
+    -p|--packages-list)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              pkg_list="$pkg_list $1"
+              shift
+            fi
+	    [ -z "$pkg_list" ] && USAGE && exit 1
+            ;;
+    -f|--arch-flavor)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              cpu_flavor="$1"
+              shift
+            fi
+	    [ -z "$cpu_flavor" ] && USAGE && exit 1
+            ;;
+    -g|--drbl-repo-url)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              DRBL_REPOSITORY_URL="$1"
+              shift
+            fi
+	    [ -z "$DRBL_REPOSITORY_URL" ] && USAGE && exit 1
+            ;;
+    -m|--mirror-url)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              mirror_url="$1"
+              shift
+            fi
+	    [ -z "$mirror_url" ] && USAGE && exit 1
+            ;;
+    -s|--mirror-security-url)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              mirror_security_url="$1"
+              shift
+            fi
+	    [ -z "$mirror_security_url" ] && USAGE && exit 1
+            ;;
+    -t|--target-media-file)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              target_media_file="$1"
+              shift
+            fi
+	    [ -z "$target_media_file" ] && USAGE && exit 1
+            ;;
+    -r|--rm-tmp-iso)
+	    rm_tmp_iso="yes"
+            shift ;;
+    -u|--use-existing-tmp-iso)
+            use_existing_stage1_iso="yes"
+            shift ;;
+    -v|--verbose)
+	    verbose="on"
+            shift ;;
+    -x|--extra-boot-param)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              live_extra_boot_param="$1"
+              shift
+            fi
+            shift
+	    [ -z "$live_extra_boot_param" ] && USAGE && exit 1
+            ;;
+    -*)     echo "${0}: ${1}: invalid option" >&2
+            USAGE >& 2
+            exit 2 ;;
+    *)      break ;;
+  esac
+done
+
+#
+if [ "$use_existing_stage1_iso" = "no" ]; then
+  # if we use existing stage 1 iso file, then we do not have to check if lh exists. Otherwise we need make-live to create the stage 1 iso file
+  if ! type lh &>/dev/null; then
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+    echo "This script only works in Debian Etch or later!"
+    echo "If you are running Debian Etch or later, use 'apt-get install live-helper' to install the live-helper (version $lh_ver_required or later), then run $0 again."
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+    exit 1
+  fi
+  create_live_required_debian_based_prompt
+fi
+
+# we need zip to create the release file when target_mode is release_file
+if ! type zip &>/dev/null; then
+  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+  echo "Command zip not found!"
+  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+  echo "$msg_program_stop"
+  exit 1
+fi
+
+ask_and_load_lang_set $specified_lang
+
+[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
+echo "Creating DRBL live..." 
+[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+
+rm -rf debian-live/.stage/
+
+# Apply default settings if not assigned
+[ -z "$debian_dist" ] && debian_dist="$DEBIAN_DIST_DEF"
+[ -z "$categories" ] && categories="$categories_default"
+[ -z "$DRBL_REPOSITORY_URL" ] && DRBL_REPOSITORY_URL="$DRBL_REPOSITORY_URL_def"
+[ -z "$mirror_url" ] && mirror_url="$debian_mirror_url_def"
+[ -z "$mirror_security_url" ] && mirror_security_url="$debian_mirror_security_url_def"
+[ -z "$cpu_flavor" ] && cpu_flavor="$cpu_flavor_default"
+[ -z "$bootstrap" ] && bootstrap=$bootstrap_default
+
+# Append the extra packages
+[ -n "$extra_pkgs" ] && pkgs="$pkgs $extra_pkgs"
+
+echo "The packages to be included in this live CD:"
+echo "$msg_delimiter_star_line"
+echo "$pkgs"
+echo "$msg_delimiter_star_line"
+if [ -n "$pkg_list" ]; then
+  pkg_list_opt="$pkg_list_opt --packages-list $pkg_list"
+  echo "The packages list to be included in this live CD:"
+  echo "$msg_delimiter_star_line"
+  echo "$pkg_list"
+  echo "$msg_delimiter_star_line"
+fi
+
+#
+echo "Using Debian $debian_dist..."
+echo "Using Debian repository from: $mirror_url"
+echo "Using Debian security repository from: $mirror_security_url"
+echo "Using DRBL repository from: $DRBL_REPOSITORY_URL"
+
+#
+case "$drbl_branch" in
+  t|testing)
+     echo "Using DRBL testing branch..."
+     LIVE_REPOSITORY_SECTIONS_drbl="stable testing"
+     ;;
+  u|unstable)
+     echo "Using DRBL unstable branch..."
+     LIVE_REPOSITORY_SECTIONS_drbl="stable testing unstable"
+     ;;
+  *)
+     echo "Using DRBL stable branch..."
+     LIVE_REPOSITORY_SECTIONS_drbl="stable live-stable"
+     ;;
+esac
+case "$drbl_live_branch" in
+  t|testing)
+     echo "Using DRBL Live testing branch..."
+     LIVE_REPOSITORY_SECTIONS_drbl="$LIVE_REPOSITORY_SECTIONS_drbl live-stable live-testing"
+     ;;
+  u|unstable)
+     echo "Using DRBL Live unstable branch..."
+     LIVE_REPOSITORY_SECTIONS_drbl="$LIVE_REPOSITORY_SECTIONS_drbl live-stable live-testing live-unstable"
+     ;;
+  e|experimental)
+     echo "Using DRBL Live experimental branch..."
+     LIVE_REPOSITORY_SECTIONS_drbl="$LIVE_REPOSITORY_SECTIONS_drbl live-stable live-testing live-unstable live-experimental"
+     ;;
+  *)
+     echo "Using DRBL live stable branch..."
+     LIVE_REPOSITORY_SECTIONS_drbl="$LIVE_REPOSITORY_SECTIONS_drbl live-stable"
+     ;;
+esac
+
+if [ -z "$pkg_list" ]; then
+  nametag="standard"
+else
+  # choose the first one, and strip space.
+  #nametag="$(echo $pkg_list | awk -F" " '{print $1}' | sed -e "s/ //g")"
+  # strip the spaces in the beginning and end, replace other space with -
+  nametag="$(echo $pkg_list | sed -e "s/^ *//g" -e "s/ *$//g" -e "s/ /-/g")"
+fi
+  
+# if version_no is not assigned, use date (Ex. 20070409)
+[ -z "$version_no" ] && version_no="$(date +%Y%m%d)"
+stage1_target_iso="hadoop-live-${nametag}-stage1-${version_no}.iso"
+real_target_iso="hadoop-live-${nametag}-${version_no}.iso"
+real_target_zip="hadoop-live-${nametag}-${version_no}.zip"
+[ -z "$target_media_file" ] && target_media_file="$TARGET_MEDIA_FILE_DEF"
+echo "$msg_delimiter_star_line"
+
+if [ "$debian_dist" = "squeeze" -o "$debian_dist" = "sid" ]; then
+  # From around Oct/2009, the dummy package name "grub" is actually grub-pc, therefore we force to use grub-legacy and assume that if grub2 boot loader is used in the restored GNU/Linux, grub2 is available in the restored GNU/Linux so therefore we can use chroot to run it.
+  pkgs="$(LC_ALL=C echo $pkgs | sed -r -e "s/grub[[:space:]]+/grub-legacy /")"
+  # Since with squeeze or sid, we can use uvesafb to replace vesafb, we need v86d. Check https://bugs.launchpad.net/ubuntu/+source/v86d/+bug/189621 for more details.
+fi
+
+if [ "$verbose" = "on" ]; then
+  pref="bash -x"
+  export CDEBOOTSTRAP_OPTIONS="$CDEBOOTSTRAP_OPTIONS -v --debug"
+fi
+
+if [ "$use_existing_stage1_iso" = "no" ]; then
+  if [ -d "debian-live" ]; then
+    echo "Found dir debian-live, clean stale debian-live files..."
+    chroot debian-live/chroot umount /dev/pts &>/dev/null || true
+    chroot debian-live/chroot umount /proc &>/dev/null || true
+    chroot debian-live/chroot umount /sys &>/dev/null || true
+    (
+      cd debian-live/
+      lh clean
+    )
+  fi
+  rm -rf debian-live
+  mkdir debian-live
+  (
+  cd debian-live
+
+  $pref lh config --archive-areas "$categories"
+  $pref lh config --mirror-binary $mirror_url --mirror-binary-security $mirror_security_url 
+  $pref lh config --mirror-bootstrap $mirror_url
+  $pref lh config --mirror-chroot $mirror_url --mirror-chroot-security $mirror_security_url
+  $pref lh config --bootstrap-flavour $debian_type --packages "$pkgs" $pkg_list_opt --bootappend ip=frommedia
+  $pref lh config --apt aptitude --apt-recommends false --binary-indices false --bootstrap $bootstrap --tasksel none
+  $pref lh config --volatile false
+  $pref lh config --initramfs live-initramfs
+  $pref lh config --username user --bootappend username=user
+  # Enable cache-indices, by doing this, "apt-get upgrade" won't be run in lh chroot_sources after hook since we might assign older package version when building.
+  $pref lh config --cache-indices true
+
+  # This decide_live_kernel_related_pkgs_from_debian function will output "kernel_related_pkgs" and "export MKSQUASHFS_OPTIONS"
+  decide_live_kernel_related_pkgs_from_debian
+  $pref lh config --distribution $debian_dist --linux-packages "$kernel_related_pkgs"
+
+  # We force to use the specific CPU kernel.
+  $pref lh config --linux-flavours $cpu_flavor
+
+  # No memtest from debian, we will use the one from drbl since it's newer.
+  $pref lh config --memtest none
+
+  # Put files to be included
+  mkdir -p config/chroot_local-includes/live-hook-dir
+  for i in $ocs_live_script_dir; do
+    cp -pr $i/* config/chroot_local-includes/live-hook-dir/
+  done
+  cp $DRBL_SCRIPT_PATH/conf/drbl*.conf config/chroot_local-includes/live-hook-dir/
+
+  # Put hook file to be run
+  mkdir -p config/chroot_local-hooks
+  cp $ocs_live_script_dir/$run_hook_script config/chroot_local-hooks/
+
+  
+  # prepare drbl source list
+  cat << AddDRBLRepository > config/chroot_sources/drbl.chroot
+  deb $DRBL_REPOSITORY_URL drbl $LIVE_REPOSITORY_SECTIONS_drbl
+AddDRBLRepository
+  
+  # prepare drbl key
+  LC_ALL=C wget -O config/chroot_sources/drbl.chroot.gpg $DRBL_GPG_KEY_URL
+
+  $pref lh build
+  )
+  mv -f debian-live/binary.iso $stage1_target_iso
+else
+  echo "Use existing temp iso file: $stage1_target_iso"
+fi
+  # clean the dir debian-live if $stage1_target_iso is already created
+  if [ -f "$stage1_target_iso" -a -d "debian-live" ]; then
+    echo "Removing working dir debian-live in background..."
+    rm -rf debian-live &
+  fi
+# 
+[ ! -e "$stage1_target_iso" ] && echo "$stage1_target_iso does NOT exist!" && exit 1
+
+# mount the stage 1 iso file
+stage1_iso_TMP="$(mktemp -d /tmp/ocs-iso-tmp.XXXXXX)"
+trap "[ -d "$stage1_iso_TMP" ] && umount $stage1_iso_TMP &>/dev/null && clean_tmp_dirs_files" HUP INT QUIT TERM EXIT
+ISOSYSLNX_TMP="$(mktemp -d /tmp/isolnx-tmp.XXXXXX)"
+mount -o loop $stage1_target_iso $stage1_iso_TMP
+
+#
+case "$target_media_file" in
+  cd|CD|iso|ISO)
+     create_drbl_live_iso
+     ;;
+  usb|zip)
+     create_drbl_live_zip
+     ;;
+  b|both|BOTH)
+     create_drbl_live_iso
+     create_drbl_live_zip
+     ;;
+esac
+
+# unmount all iso file
+umount $stage1_iso_TMP &>/dev/null
+# Clean the tmp working directory
+echo "Cleaning tmp dirs..."
+clean_tmp_dirs_files
+
+#
+if type isohybrid &>/dev/null; then
+  if [ -e "$real_target_iso" ]; then
+    echo -n "Isohybriding $real_target_iso... "
+    isohybrid $real_target_iso
+    echo "done!"
+  fi
+fi
+# 
+case "$target_media_file" in
+  cd|CD|iso|ISO)
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
+     echo "$msg_burn_drbl_live_img_iso: $real_target_iso"
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+     ;;
+  usb|zip)
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
+     echo "$msg_burn_drbl_live_img_zip: $real_target_zip"
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+     ;;
+  b|both|BOTH)
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
+     echo "$msg_burn_drbl_live_img_iso: $real_target_iso"
+     echo "$msg_burn_drbl_live_img_zip: $real_target_zip"
+     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+     ;;
+esac
Index: /drbl-hadoop-live/create-hadoop-live-by-pkg
===================================================================
--- /drbl-hadoop-live/create-hadoop-live-by-pkg	(revision 152)
+++ /drbl-hadoop-live/create-hadoop-live-by-pkg	(revision 152)
@@ -0,0 +1,202 @@
+#!/bin/bash
+# Author:  Jazz Wang <jazz _at_ nchc org tw>
+#          Steven Shiau <steven _at_ nchc org tw>
+# License: GPL
+# Description: This script is a wrapper program to run create-hadoop-live. Here we assign the required packages to create such a live media.
+
+#
+set -e
+
+#
+DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/opt/drbl/}"
+. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
+. $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
+. $DRBL_SCRIPT_PATH/sbin/ocs-functions
+
+# Settings
+# debian_mirror_url_def, debian_mirror_security_url_def, DRBL_REPOSITORY_URL_def and DRBL_GPG_KEY_URL are loaded from drbl-ocs.conf
+# Based on Debian sid/lenny/etch...
+debian_dist_default="lenny"
+# DRBL branch in drbl-core: experimental, unstable, testing, stable
+drbl_branch_default="unstable"
+# Live branch in drbl-core: experimental, unstable, testing, stable
+live_branch_default="experimental"
+# Type: xfce, gnome, kde, standard
+de_type_default="xfce"
+cpu_flavor_default="486"
+bootstrap_default="cdebootstrap"
+
+# Common applications for all the version
+common_text_app="arj curlftpfs discover1 gpart mdetect boinc-client dnsutils bind9-host syslogd myrescue pmount vim acpi laptop-detect acpi-support hotkey-setup ipmitool"
+# Fonts
+font_pkgs="ttf-arphic-newsung ttf-kochi-gothic"
+# Common applications for the version with X
+common_GUI_app="$font_pkgs x-ttcidfont-conf leafpad conky gpicview isomaster hardinfo pcmanfm xarchiver xfburn iceweasel-l10n-es-es iceweasel-l10n-fr iceweasel-l10n-it iceweasel-l10n-ja iceweasel-l10n-zh-cn iceweasel-l10n-zh-tw scim-chewing scim-tables-ja scim-tables-zh im-switch xresprobe grandr wpagui swfdec-mozilla"
+
+# $debian_pkgs_for_gparted is from drbl.conf
+pkgs_for_xfce="mlterm mlterm-im-scim xnetcardconfig $common_text_app $common_GUI_app $debian_pkgs_for_gparted"
+pkgs_for_gnome="gnome-cups-manager $common_text_app $common_GUI_app $debian_pkgs_for_gparted"
+pkgs_for_kde="$common_text_app $common_GUI_app $debian_pkgs_for_gparted"
+pkgs_for_standard="$common_text_app"
+
+#
+check_if_root
+#
+prog="$(basename $0)"
+
+#
+USAGE() {
+   echo "$prog [OPTION]"
+   echo "OPTION:"
+   echo "-b, --branch [s|stable|t|testing|u|unstable]  specifies the DRBL branch to be used in Live CD. Default is stable."
+   echo "-bt, --bootstrap BOOTSTRAP  Specify the bootsrap type as BOOTSTRAP (cdebootstrap or debootstrap). If not specified, $bootstrap_default will be used."
+   echo "-d, --debian-dist [stable|testing|unstable|etch|lenny|sid...]  Assign Debian dist, the default is $DEBIAN_DIST_DEF if not assigned."
+   echo "-e, --drbl-live-branch [s|stable|t|testing|u|unstable|e|experimental]  specifies the DRBL live branch to be used in Live CD. Default is stable."
+   echo "-f, --arch-flavor ARCH  Assign the CPU architecture flavor as ARCH, e.g. 486 or 686. If it's not assigned, $cpu_flavor will be used."
+   echo "-g, --drbl-repo-url URL  Assign the DRBL repository URL instead of default one $DRBL_REPOSITORY_URL_def."
+   echo "-k, --package FILE  Specify package FILE to be installed in Live CD."
+   echo "-i, --assign-version-no NO  Assign the version no as NO instead of date."
+   echo "-m, --mirror-url URL  Assign the Debian repository URL instead of default one $debian_mirror_url_def. "
+   echo "-n, --live-kernel-pkg KERNEL_VER Assign kernel version as KERNEL_VER (KERNEL VER package must exist in repository. Ex. if KERNEL_VER is 2.6.20-1-486, then linux-image-2.6.20-1-486, squashfs-modules-2.6.20-1-486, and unionfs-modules-2.6.20-1-486 will be used."
+   echo "-s, --mirror-security-url URL  Assign the Debian security repository URL instead of default one $debian_mirror_security_url_def."
+   echo "-t, --de-type [xfce|gnome|kde|standard]   Specify the type to create DRBL live. Default is xfce"
+   echo "-x, --extra-boot-param  EXTRA_PARAM  Assign extra boot parameter EXTRA_PARAM for the kernel to read. These parameters are the same with that from live-initramfs. Ex. \"noprompt\" can be use to not prompt to eject the CD on reboot."
+   echo "Ex: $0 -m xfce -i my-version-1"
+}
+
+# Parse command-line options
+while [ $# -gt 0 ]; do
+  case "$1" in
+    -b|--branch)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              drbl_branch="$1"
+              shift
+            fi
+	    [ -z "$drbl_branch" ] && USAGE && exit 1
+            ;;
+    -d|--debian-dist)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              debian_dist="$1"
+              shift
+            fi
+	    [ -z "$debian_dist" ] && USAGE && exit 1
+            ;;
+    -e|--drbl-live-branch)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              live_branch="$1"
+              shift
+            fi
+	    [ -z "$live_branch" ] && USAGE && exit 1
+            ;;
+    -i|--assign-version-no)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              version_no="$1"
+              shift
+            fi
+	    [ -z "$version_no" ] && USAGE && exit 1
+            ;;
+    -f|--arch-flavor)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              cpu_flavor="$1"
+              shift
+            fi
+	    [ -z "$cpu_flavor" ] && USAGE && exit 1
+            ;;
+    -g|--drbl-repo-url)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              DRBL_REPOSITORY_URL="$1"
+              shift
+            fi
+	    [ -z "$DRBL_REPOSITORY_URL" ] && USAGE && exit 1
+            ;;
+    -k|--package)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              extra_pkgs="$1"
+              shift
+            fi
+	    [ -z "$extra_pkgs" ] && USAGE && exit 1
+            ;;
+    -m|--mirror-url)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              mirror_url="$1"
+              shift
+            fi
+	    [ -z "$mirror_url" ] && USAGE && exit 1
+            ;;
+    -s|--mirror-security-url)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              mirror_security_url="$1"
+              shift
+            fi
+	    [ -z "$mirror_security_url" ] && USAGE && exit 1
+            ;;
+    -n|--live-kernel-pkg)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              live_kernel_ver="$1"
+              shift
+            fi
+	    [ -z "$live_kernel_ver" ] && USAGE && exit 1
+            ;;
+    -t|--de-type)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              de_type="$1"
+              shift
+            fi
+	    [ -z "$de_type" ] && USAGE && exit 1
+            ;;
+    -x|--extra-boot-param)
+            shift
+            if [ -z "$(echo $1 |grep ^-.)" ]; then
+              # skip the -xx option, in case 
+              live_extra_boot_param="$1"
+              shift
+            fi
+            shift
+	    [ -z "$live_extra_boot_param" ] && USAGE && exit 1
+            ;;
+    -*)     echo "${0}: ${1}: invalid option" >&2
+            USAGE >& 2
+            exit 2 ;;
+    *)      break ;;
+  esac
+done
+
+#
+# Apply default settings if not assigned
+[ -z "$debian_dist" ] && debian_dist="$debian_dist_default"
+[ -z "$drbl_branch" ] && drbl_branch="$drbl_branch_default"
+[ -z "$live_branch" ] && live_branch="$live_branch_default"
+[ -z "$de_type" ] && de_type="$de_type_default"
+[ -n "$live_kernel_ver" ] && live_kernel_opt="-n $live_kernel_ver"
+[ -n "$version_no" ] && ver_no_opt="-i $version_no"
+[ -z "$DRBL_REPOSITORY_URL" ] && DRBL_REPOSITORY_URL="$DRBL_REPOSITORY_URL_def"
+[ -z "$mirror_url" ] && mirror_url="$debian_mirror_url_def"
+[ -z "$mirror_security_url" ] && mirror_security_url="$debian_mirror_security_url_def"
+[ -z "$cpu_flavor" ] && cpu_flavor="$cpu_flavor_default"
+[ -z "$bootstrap" ] && bootstrap=$bootstrap_default
+[ -n "$live_extra_boot_param" ] && live_extra_boot_param="-x $live_extra_boot_param"
+
+eval pkgs=\$pkgs_for_${de_type}
+time ./create-hadoop-live -l en --bootstrap $bootstrap -d $debian_dist -p $de_type -k "$pkgs $extra_pkgs" -b $drbl_branch -f $cpu_flavor -g $DRBL_REPOSITORY_URL -m $mirror_url -s $mirror_security_url -e $live_branch $live_extra_boot_param $live_kernel_opt $ver_no_opt 
Index: /drbl-hadoop-live/hadoop-live-hook
===================================================================
--- /drbl-hadoop-live/hadoop-live-hook	(revision 152)
+++ /drbl-hadoop-live/hadoop-live-hook	(revision 152)
@@ -0,0 +1,239 @@
+#!/bin/bash
+# Author: Steven Shiau <steven _at_ nchc org tw>
+# License: GPL
+# Program to create DRBL/Clonezilla server live. You'd better to have 2 or more NICs in the machine, and they are configured so the created Clonezilla server live has preset DRBL environment.
+
+#
+DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/opt/drbl/}"
+
+# load drbl setting
+. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
+# load config files
+. /live-hook-dir/ocs-live-hook.conf
+# load functions
+. /live-hook-dir/ocs-live-hook-functions 
+
+# locale_to_keep_for_X is loaded from ocs-live-hook.conf.
+locale_to_keep="$locale_to_keep_for_X"
+
+#
+clean_udev_persistent_net_rules
+
+# create a dummy /etc/fstab in Live CD so that nis/yp won't complain
+touch /etc/fstab
+
+#
+download_grub_1_2_deb_for_later_use
+
+#
+install_debian_extra_modules
+
+# clean some locales
+set_localepurge
+localepurge
+
+# Generate the locales. We will use "nolocales" to avoid these to be wipped by live-initramfs.
+locales_gen
+
+# If kexec tools is installed, disable the service. We do not need that for Clonezilla
+disable_kexec
+
+# Disable the "tips and tricks" on the startup after login.
+disable_xfce_startup_tips_and_tricks
+
+# Exclude live mount point in /etc/init.d/umountfs to avoid error messages when rebooting or halting.
+exclude_umount_live_mnt_point_in_umountfs
+
+# append the module so that it will be loaded, then gparted can grow filesystem
+# Ref: http://gparted.sourceforge.net/features.php
+append_mod_in_etc_modules
+
+# set root passwd, I do not like root without passwd.
+set_root_passwd
+
+# Append the PATH in system.
+append_drbl_clonezilla_PATH_in_system
+
+# We might need more /lib/udev/*_id than that initramfs-tools copies. E.g. for Live CD, we need cdrom_id, which udev (>= version 146 won't copy).
+copy_all_dev_id_prog_from_udev_lib
+
+# Put the DRBL live script in rcS.d
+cp_drbl_live_startup_to_rc.d
+
+# If mlterm is found with xfce installed, set default x-terminal-emulator as mlterm. Since xterm is not as good as mlterm in Traditional Chinese font.
+if dpkg -L xfce4 &>/dev/null && dpkg -L mlterm &>/dev/null; then
+  echo "Set mlterm as default x-terminal-emulator."
+  update-alternatives --set x-terminal-emulator /usr/bin/mlterm
+  # change the fg/bg color
+  perl -pi -e "s/^.*fg_color=.*/fg_color=white/g" /etc/mlterm/main
+  perl -pi -e "s/^.*bg_color=.*/bg_color=black/g" /etc/mlterm/main
+fi
+
+# We have to remove thunar-volman to avoid the partition is automatically mounted after a partition table is created. It will make Clonezilla fail due to partition busy.
+if dpkg -L thunar-volman &>/dev/null; then
+  apt-get -y --purge remove thunar-volman
+fi
+
+# preset some network setting
+guess_uplink_port="$(LC_ALL=C route -n | awk '/^0.0.0.0/ {print $8}' | sort | head -n 1)"
+case "$alias_eth0_for_drbl_clients" in
+  yes)
+    ethernet_drbl="eth0:1"
+    ifconfig $ethernet_drbl $alias_eth0_IP_addr netmask 255.255.255.0
+    ;;
+esac
+
+# Clear those automatically installed.
+if [ -n "$(LC_ALL=C apt-get --help 2>/dev/null | grep -i autoremove)" ]; then
+  apt-get -y autoremove
+fi
+
+# We need loopback device, just in case.
+cat <<-NET_END > /etc/network/interfaces
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+NET_END
+# Assign a default DNS
+# //NOTE// This won't work since live helper will remove /etc/resolv.conf.
+# Therefore here we comment this. To leave this in to make a note only.
+#assing_default_dns_server
+
+# Run drbl setup, we use DRBL SSI mode and clonezilla box mode
+if [ "$use_unfs" = "yes" ]; then
+  # Since unfs3 does not allow client to lock file, according to Pascal Schmidt <pascal.schmidt _at_ ewetel net>, we have to put "nolock" in client's /etc/fstab
+  perl -pi -e "s/^nfs_client_extra_opt=.*/nfs_client_extra_opt=nolock/g" $DRBL_SCRIPT_PATH/conf/drbl.conf
+fi
+
+# Change the VOL_LIMIT_DEFAULT as 2000 since we have no idea if user will mount FAT as $ocsroot or not.
+
+perl -pi -e 's/^VOL_LIMIT_DEFAULT=.*/VOL_LIMIT_DEFAULT="2000"  # Modified when creating DRBL live/g' $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
+
+# Get the installed kernel so that we can use drblsrv-offline directly.
+kernel_ver="$(unalias ls 2>/dev/null; ls /boot/vmlinuz-* | sort | tail -n 1)"
+kernel_ver="$(basename $kernel_ver | sed -e "s/vmlinuz-//g")"
+yes "" | drblsrv-offline -c -l en_US -s "$kernel_ver"
+
+# NOTE! All the setting about clients must be done before drblpush.
+# Run drblpush, now we use 1 for drbl client. The cient number is assigned in ocs-live-hook.conf and is applied to drbl-live.sh (it is run to start drbl service after the live cd is booted).
+yes "" | drblpush -l en_US -i -r 1 -z 1 -p 1 --not-add-start-drbl-srvi
+
+# post process
+# The /tftpboot/node_root/bin/hostname was renamed as hostname.orig by lh_chroot_hostname. Although later lh_chroot will deconfigure it, but we already copy them to /tftpboot/node_root/bin by drblpush. We have to move it back so that later drbl client can use the real hostname.
+mv -f $drbl_common_root/bin/hostname.orig $drbl_common_root/bin/hostname
+
+# stop all the services so that make-live can pack it.
+drbl-all-service stop
+
+# remove all the service in rc, we do not want all the services to automatically start at boot
+drbl-all-service del
+
+# we still have to add some modules in clients. We still have to do this although server's /etc/modules already has them, but drblpush will clean all to avoid some problem.
+for ih in $drblroot/*; do
+  for imod in $mod_loaded_at_startup; do
+    echo "$imod" >> $ih/etc/modules
+  done
+done
+
+# we clean the template node and tarballs: (1) save the space (2) if user uses different subnet for NIC, the template directory (Ex: /tftpboot/nodes/192.168.100.1) and tarball are useless. Since we will re-run drblpush in drbl-live.sh after drbl live boots. They will be created again.
+[ -d "$drblroot" -a -n "$drblroot" ] && rm -rf $drblroot/*
+[ -d "$drbl_common_root" -a -n "$drbl_common_root" ] && rm -rf $drbl_common_root/drbl_ssi/*.tgz
+
+# //NOTE// This is almost useless since squashfs will compress the file system, and the duplicated won't take too much space actully. Besides, without /tftpboot/node_root/{lib, usr}, DRBL will need more RAM (need by tmpfs) after running drblpush -i.
+# Remove /tftpboot/node_root/{lib, usr}, since when drblpush is run, they will be rebuild. Thanks to Orgad Shaneh for the inspiration. Ref: https://sourceforge.net/forum/forum.php?thread_id=3336278&forum_id=675794
+#[ -d "$drbl_common_root/lib" -a -n "$drbl_common_root" ] && rm -rf $drbl_common_root/lib
+#[ -d "$drbl_common_root/usr" -a -n "$drbl_common_root" ] && rm -rf $drbl_common_root/usr
+
+# Note! there is an issue about squashfs 3.1 + kernel nfs, we can use user space nfs instead:
+# http://lists.alioth.debian.org/pipermail/debian-live-devel/2006-September/000470.html 
+# This also has a benefit, the mounted /home/partimage is ready to be seen by client.
+# Before --purge nfs-kernel-server, we have to backup /etc/exports
+if [ "$use_unfs" = "yes" ]; then
+  cp -f /etc/exports /etc/exports.unfs3
+  apt-get --yes --purge remove nfs-kernel-server
+  apt-get --yes install unfs3
+  mv -f /etc/exports.unfs3 /etc/exports
+fi
+
+# do some dirty clean... no idea why "/etc/init.d/nfs-kernel-server stop" and "/"/etc/init.d/nfs-common stop" won't be able to release this:
+# nfsd on /proc/fs/nfsd type nfsd (rw)
+umount nfsd
+
+# get unifont.bgf for bterm, this is used in drbl live standard version.
+# This must be after drblsrv is run, since after that, we have clonezilla (so drbl-ocs.conf exists)
+(
+  # now with clonezilla installed, we can load variable $DEBIAN_ISO_ETC_PATH_DEF
+  . $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
+  uni_font_url="$DEBIAN_ISO_ETC_PATH_DEF/fonts/$uni_font_file"
+  echo "Download unifont.bgf from $uni_font_url and put it in $DRBL_SCRIPT_PATH/lib/..."
+  mkdir -p $DRBL_SCRIPT_PATH/lib/
+  cd $DRBL_SCRIPT_PATH/lib/
+  wget $wget_opt $uni_font_url
+)
+
+# For better security. This has to be after "drblsrv -i" and "drblpush -i" are run.
+echo "For better security, do not turn on ssh service..."
+remove_service_in_system ssh
+
+# Turn of boinc client service
+remove_service_in_system boinc-client
+
+# Remove unnecessary service
+remove_service_in_system mdadm-raid
+
+# Put start script
+mkdir -p /etc/drbl/
+cp -ar $DRBL_SCRIPT_PATH/setup/files/ocs/drbl-live.d /etc/drbl/
+
+# put some desktop icons in the account $autologin_account.
+mkdir -p /home/$autologin_account/Desktop
+chown -R $autologin_account.$autologin_account /home/$autologin_account/Desktop
+cp -a $DRBL_SCRIPT_PATH/setup/files/misc/desktop-icons/drbl-live/*.desktop /home/$autologin_account/Desktop
+chown $autologin_account.$autologin_account /home/$autologin_account/Desktop/*.desktop
+
+# Now we use S97start-drbl-live to do more, instead of just kbd config.
+# Put a service to config keyboard
+# cat <<-KBD_END > /etc/init.d/kbd-conf
+# #!/bin/bash
+# dpkg-reconfigure console-data
+# KBD_END
+# chmod 755 /etc/init.d/kbd-conf
+# update-rc.d kbd-conf start 97 S .
+
+# Put a service to config X
+# Since X 7.3 or later from Debian lenny, "dpkg-reconfigure xserver-xorg" only configure keyboard, no more VGA driver and resolution. We use grandr to let user to change the resolution. The problem will be if it fails to enter vesa mode, grander won't be able to run. 
+# Ref: http://forums.debian.net/viewtopic.php?t=26577
+#cp -a $drbl_setup_path/files/ocs/live-hook/Forcevideo-drbl-live /etc/init.d/
+#update-rc.d Forcevideo-drbl-live start 98 S .
+
+# Put a link for vol_id so that GParted can use it to read linux-swap labels
+if [ -e /lib/udev/vol_id ]; then
+  (cd /sbin; ln -fs /lib/udev/vol_id vol_id)
+fi
+
+# we need real /sbin/start-stop-daemon
+remove_cdebootstrap-helper-diverts
+
+# turn off alias IP address
+[ "$alias_eth0_for_drbl_clients" = "yes" ] && ifconfig eth0:1 down
+
+# install sun-java6-jdk
+cat << EOF | /usr/bin/debconf-set-selections
+sun-java6-bin   shared/accepted-sun-dlj-v1-1    select true
+sun-java6-jdk   shared/accepted-sun-dlj-v1-1    select true
+sun-java6-jre   shared/accepted-sun-dlj-v1-1    select true
+EOF
+apt-get -y install sun-java6-jdk
+
+# ///Note/// This should be the last one after any apt-get.
+# clean unnecessary backup file to save space
+clean_unnecessary_backup_file_in_boot
+
+### THE END ###
+# DO NOT PUT ANY SCRIPT AFTHER THIS!!!
+# kill this program before creating squashfs filesystem.
+rm -rf /live-hook-dir
