source: drbl-hadoop-live/create-hadoop-live-by-pkg @ 248

Last change on this file since 248 was 152, checked in by jazz, 14 years ago
  • add create-hadoop-live-by-pkg, create-hadoop-live and hadoop-live-hook
    • create-hadoop-live-by-pkg will call create-hadoop-live then run hadoop-live-hook to generate drbl-hadoop Live CD.
  • modified Makefile
    • make drbl-hadoop
  • Property svn:executable set to *
File size: 8.3 KB
Line 
1#!/bin/bash
2# Author:  Jazz Wang <jazz _at_ nchc org tw>
3#          Steven Shiau <steven _at_ nchc org tw>
4# License: GPL
5# Description: This script is a wrapper program to run create-hadoop-live. Here we assign the required packages to create such a live media.
6
7#
8set -e
9
10#
11DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/opt/drbl/}"
12. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
13. $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
14. $DRBL_SCRIPT_PATH/sbin/ocs-functions
15
16# Settings
17# debian_mirror_url_def, debian_mirror_security_url_def, DRBL_REPOSITORY_URL_def and DRBL_GPG_KEY_URL are loaded from drbl-ocs.conf
18# Based on Debian sid/lenny/etch...
19debian_dist_default="lenny"
20# DRBL branch in drbl-core: experimental, unstable, testing, stable
21drbl_branch_default="unstable"
22# Live branch in drbl-core: experimental, unstable, testing, stable
23live_branch_default="experimental"
24# Type: xfce, gnome, kde, standard
25de_type_default="xfce"
26cpu_flavor_default="486"
27bootstrap_default="cdebootstrap"
28
29# Common applications for all the version
30common_text_app="arj curlftpfs discover1 gpart mdetect boinc-client dnsutils bind9-host syslogd myrescue pmount vim acpi laptop-detect acpi-support hotkey-setup ipmitool"
31# Fonts
32font_pkgs="ttf-arphic-newsung ttf-kochi-gothic"
33# Common applications for the version with X
34common_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"
35
36# $debian_pkgs_for_gparted is from drbl.conf
37pkgs_for_xfce="mlterm mlterm-im-scim xnetcardconfig $common_text_app $common_GUI_app $debian_pkgs_for_gparted"
38pkgs_for_gnome="gnome-cups-manager $common_text_app $common_GUI_app $debian_pkgs_for_gparted"
39pkgs_for_kde="$common_text_app $common_GUI_app $debian_pkgs_for_gparted"
40pkgs_for_standard="$common_text_app"
41
42#
43check_if_root
44#
45prog="$(basename $0)"
46
47#
48USAGE() {
49   echo "$prog [OPTION]"
50   echo "OPTION:"
51   echo "-b, --branch [s|stable|t|testing|u|unstable]  specifies the DRBL branch to be used in Live CD. Default is stable."
52   echo "-bt, --bootstrap BOOTSTRAP  Specify the bootsrap type as BOOTSTRAP (cdebootstrap or debootstrap). If not specified, $bootstrap_default will be used."
53   echo "-d, --debian-dist [stable|testing|unstable|etch|lenny|sid...]  Assign Debian dist, the default is $DEBIAN_DIST_DEF if not assigned."
54   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."
55   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."
56   echo "-g, --drbl-repo-url URL  Assign the DRBL repository URL instead of default one $DRBL_REPOSITORY_URL_def."
57   echo "-k, --package FILE  Specify package FILE to be installed in Live CD."
58   echo "-i, --assign-version-no NO  Assign the version no as NO instead of date."
59   echo "-m, --mirror-url URL  Assign the Debian repository URL instead of default one $debian_mirror_url_def. "
60   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."
61   echo "-s, --mirror-security-url URL  Assign the Debian security repository URL instead of default one $debian_mirror_security_url_def."
62   echo "-t, --de-type [xfce|gnome|kde|standard]   Specify the type to create DRBL live. Default is xfce"
63   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."
64   echo "Ex: $0 -m xfce -i my-version-1"
65}
66
67# Parse command-line options
68while [ $# -gt 0 ]; do
69  case "$1" in
70    -b|--branch)
71            shift
72            if [ -z "$(echo $1 |grep ^-.)" ]; then
73              # skip the -xx option, in case
74              drbl_branch="$1"
75              shift
76            fi
77      [ -z "$drbl_branch" ] && USAGE && exit 1
78            ;;
79    -d|--debian-dist)
80            shift
81            if [ -z "$(echo $1 |grep ^-.)" ]; then
82              # skip the -xx option, in case
83              debian_dist="$1"
84              shift
85            fi
86      [ -z "$debian_dist" ] && USAGE && exit 1
87            ;;
88    -e|--drbl-live-branch)
89            shift
90            if [ -z "$(echo $1 |grep ^-.)" ]; then
91              # skip the -xx option, in case
92              live_branch="$1"
93              shift
94            fi
95      [ -z "$live_branch" ] && USAGE && exit 1
96            ;;
97    -i|--assign-version-no)
98            shift
99            if [ -z "$(echo $1 |grep ^-.)" ]; then
100              # skip the -xx option, in case
101              version_no="$1"
102              shift
103            fi
104      [ -z "$version_no" ] && USAGE && exit 1
105            ;;
106    -f|--arch-flavor)
107            shift
108            if [ -z "$(echo $1 |grep ^-.)" ]; then
109              # skip the -xx option, in case
110              cpu_flavor="$1"
111              shift
112            fi
113      [ -z "$cpu_flavor" ] && USAGE && exit 1
114            ;;
115    -g|--drbl-repo-url)
116            shift
117            if [ -z "$(echo $1 |grep ^-.)" ]; then
118              # skip the -xx option, in case
119              DRBL_REPOSITORY_URL="$1"
120              shift
121            fi
122      [ -z "$DRBL_REPOSITORY_URL" ] && USAGE && exit 1
123            ;;
124    -k|--package)
125            shift
126            if [ -z "$(echo $1 |grep ^-.)" ]; then
127              # skip the -xx option, in case
128              extra_pkgs="$1"
129              shift
130            fi
131      [ -z "$extra_pkgs" ] && USAGE && exit 1
132            ;;
133    -m|--mirror-url)
134            shift
135            if [ -z "$(echo $1 |grep ^-.)" ]; then
136              # skip the -xx option, in case
137              mirror_url="$1"
138              shift
139            fi
140      [ -z "$mirror_url" ] && USAGE && exit 1
141            ;;
142    -s|--mirror-security-url)
143            shift
144            if [ -z "$(echo $1 |grep ^-.)" ]; then
145              # skip the -xx option, in case
146              mirror_security_url="$1"
147              shift
148            fi
149      [ -z "$mirror_security_url" ] && USAGE && exit 1
150            ;;
151    -n|--live-kernel-pkg)
152            shift
153            if [ -z "$(echo $1 |grep ^-.)" ]; then
154              # skip the -xx option, in case
155              live_kernel_ver="$1"
156              shift
157            fi
158      [ -z "$live_kernel_ver" ] && USAGE && exit 1
159            ;;
160    -t|--de-type)
161            shift
162            if [ -z "$(echo $1 |grep ^-.)" ]; then
163              # skip the -xx option, in case
164              de_type="$1"
165              shift
166            fi
167      [ -z "$de_type" ] && USAGE && exit 1
168            ;;
169    -x|--extra-boot-param)
170            shift
171            if [ -z "$(echo $1 |grep ^-.)" ]; then
172              # skip the -xx option, in case
173              live_extra_boot_param="$1"
174              shift
175            fi
176            shift
177      [ -z "$live_extra_boot_param" ] && USAGE && exit 1
178            ;;
179    -*)     echo "${0}: ${1}: invalid option" >&2
180            USAGE >& 2
181            exit 2 ;;
182    *)      break ;;
183  esac
184done
185
186#
187# Apply default settings if not assigned
188[ -z "$debian_dist" ] && debian_dist="$debian_dist_default"
189[ -z "$drbl_branch" ] && drbl_branch="$drbl_branch_default"
190[ -z "$live_branch" ] && live_branch="$live_branch_default"
191[ -z "$de_type" ] && de_type="$de_type_default"
192[ -n "$live_kernel_ver" ] && live_kernel_opt="-n $live_kernel_ver"
193[ -n "$version_no" ] && ver_no_opt="-i $version_no"
194[ -z "$DRBL_REPOSITORY_URL" ] && DRBL_REPOSITORY_URL="$DRBL_REPOSITORY_URL_def"
195[ -z "$mirror_url" ] && mirror_url="$debian_mirror_url_def"
196[ -z "$mirror_security_url" ] && mirror_security_url="$debian_mirror_security_url_def"
197[ -z "$cpu_flavor" ] && cpu_flavor="$cpu_flavor_default"
198[ -z "$bootstrap" ] && bootstrap=$bootstrap_default
199[ -n "$live_extra_boot_param" ] && live_extra_boot_param="-x $live_extra_boot_param"
200
201eval pkgs=\$pkgs_for_${de_type}
202time ./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 
Note: See TracBrowser for help on using the repository browser.