#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Description: This script can be run to create a DRBL live CD/USB flash drive iso/zip with complete packages as parameters.

mode=$1
ver_no="$2"

export PATH=$PATH:/opt/drbl/sbin:/opt/drbl/bin

# For lenny
dist="lenny"
kernel_opt=""  # auto
# For etchhhalf  Some NFS problem with 2.6.24-etchnhalf.1.  Do not use for 2.6.24-etchnhalf.1
# dist="etch"
# kernel_opt="-n 2.6.24-etchnhalf.1"

pkgs_for_gparted="ntfsprogs hfsutils jfsutils xfsprogs xfsdump reiserfsprogs reiser4progs parted partimage testdisk mc ntfs-3g dosfstools mtools lvm2 sdparm hdparm lsscsi pciutils hal"

# e: experimental, u: unstable, t: testing, s: stable
live_branch_opt="-e e"
[ -n "$ver_no" ] && ver_no_opt="-i $ver_no"
case "$mode" in
  xfce)
     time create-drbl-live -l en -d $dist -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 grandr boinc-client dnsutils bind9-host $pkgs_for_gparted" $live_branch_opt $kernel_opt $ver_no_opt
     ;;
   gnome)
     # with zh_tw, gnome
     time create-drbl-live -l en -d $dist -p gnome -b u -k "x-ttcidfont-conf iceweasel-l10n-zh-tw gparted ttf-arphic-newsung scim-chewing scim-tables-zh im-switch discover1 xresprobe mdetect grandr boinc-client dnsutils bind9-host gnome-cups-manager $pkgs_for_gparted" $live_branch_opt $kernel_opt $ver_no_opt
     ;;
   kde)
     time create-drbl-live -l en -d $dist -p kde -b u -k "x-ttcidfont-conf iceweasel-l10n-zh-tw gparted ttf-arphic-newsung scim-chewing scim-tables-zh im-switch discover1 xresprobe mdetect grandr boinc-client dnsutils bind9-host $pkgs_for_gparted" $live_branch_opt $kernel_opt $ver_no_opt
     ;;
   *)
     # standard
     #/opt/drbl/sbin/create-drbl-live -l en -d etch -b u $ver_no_opt
     # unstable drbl, experimental live
     time create-drbl-live -l en -d $dist -b u $live_branch_opt $kernel_opt $ver_no_opt
     ;;
esac
