| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | ## Author: Jazz Yao-Tsung Wang <jazzwang.tw@gmail.com> |
|---|
| 4 | ## |
|---|
| 5 | ## v0.1 - 2010-05-23 - initial version |
|---|
| 6 | ## |
|---|
| 7 | ## Reference: |
|---|
| 8 | ## [1] http://live.debian.net/manual/html/packages.html#package-sources |
|---|
| 9 | ## [2] /opt/drbl/sbin/create-drbl-live (from drbl - http://drbl.sf.net) |
|---|
| 10 | ## [3] man lh_config and lh_build |
|---|
| 11 | |
|---|
| 12 | ## Check current distribution is debian-like or not |
|---|
| 13 | if [ ! -f /etc/debian_version ]; then |
|---|
| 14 | echo "[ERROR] This script must run on Debian or Ubuntu !!" |
|---|
| 15 | exit |
|---|
| 16 | fi |
|---|
| 17 | |
|---|
| 18 | ## If /usr/bin/lh is not found, install live-helper package first!! |
|---|
| 19 | if [ ! -x /usr/bin/lh ]; then |
|---|
| 20 | echo "[WARN] live-helper not found!! I will install it first for you!!" |
|---|
| 21 | apt-get install -y live-helper |
|---|
| 22 | fi |
|---|
| 23 | |
|---|
| 24 | ## [MEMO] following parameter is for live-helper ........... |
|---|
| 25 | ### -b|--binary-images iso|net|tar|usb-hdd |
|---|
| 26 | ### --binary-filesystem fat16|fat32|ext2 |
|---|
| 27 | ### --binary-indices enabled|disabled |
|---|
| 28 | ### --bootstrap-config FILE |
|---|
| 29 | ### -f|--bootstrap-flavour minimal|standard |
|---|
| 30 | ### --cache enabled|disabled |
|---|
| 31 | ### --cache-indices enabled|disabled |
|---|
| 32 | ### --categories CATEGORY|"CATEGORIES" |
|---|
| 33 | ### -d|--distribution CODENAME |
|---|
| 34 | ### --hostname NAME |
|---|
| 35 | ### -m|--mirror-bootstrap URL |
|---|
| 36 | ### --mirror-chroot URL |
|---|
| 37 | ### --mirror-chroot-security URL |
|---|
| 38 | ### --username NAME |
|---|
| 39 | |
|---|
| 40 | lh clean --binary |
|---|
| 41 | # [Note] option '--categories' is only avaible at live-helper 1.0.3-2 |
|---|
| 42 | lh config -b iso --binary-indices disabled -f minimal --cache enabled --cache-indices enabled --categories 'main non-free' -d lenny --hostname hadoop -m http://free.nchc.org.tw/debian --mirror-chroot http://free.nchc.org.tw/debian --mirror-chroot-security http://free.nchc.org.tw/debian-security --mirror-binary http://free.nchc.org.tw/debian --mirror-binary-security http://free.nchc.org.tw/debian-security --username hadoop --packages 'ssh sudo xserver-xorg-video-vesa xinit xfonts-base x11-xserver-utils xterm openbox iceweasel dhcp3-client' -k 686 |
|---|
| 43 | |
|---|
| 44 | # add non-free apt repository for chroot stage |
|---|
| 45 | echo << EOF > config/chroot_sources/non-free.chroot |
|---|
| 46 | deb http://free.nchc.org.tw/debian lenny non-free |
|---|
| 47 | EOF |
|---|
| 48 | |
|---|
| 49 | lh build |
|---|
| 50 | |
|---|
| 51 | if [ -f binary.iso ]; then |
|---|
| 52 | cp binary.iso `date +"hadoop-live-%y%m%d%H%M.iso"` |
|---|
| 53 | fi |
|---|