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 root privileges |
---|
13 | if [ `id -u` != 0 ]; then |
---|
14 | echo "[ERROR] This script must run as root or sudo !!" |
---|
15 | exit |
---|
16 | fi |
---|
17 | |
---|
18 | ## Check current distribution is debian-like or not |
---|
19 | if [ ! -f /etc/debian_version ]; then |
---|
20 | echo "[ERROR] This script must run on Debian or Ubuntu !!" |
---|
21 | exit |
---|
22 | fi |
---|
23 | |
---|
24 | ## If /usr/bin/lh is not found, install live-helper package first!! |
---|
25 | if [ ! -x /usr/bin/lh ]; then |
---|
26 | echo "[WARN] live-helper not found!! I will install it first for you!!" |
---|
27 | apt-get install -y live-helper |
---|
28 | fi |
---|
29 | |
---|
30 | ## [MEMO] following parameter is for live-helper ........... |
---|
31 | ### -b|--binary-images iso|net|tar|usb-hdd |
---|
32 | ### --binary-filesystem fat16|fat32|ext2 |
---|
33 | ### --binary-indices enabled|disabled |
---|
34 | ### --bootstrap-config FILE |
---|
35 | ### -f|--bootstrap-flavour minimal|standard |
---|
36 | ### --cache enabled|disabled |
---|
37 | ### --cache-indices enabled|disabled |
---|
38 | ### --categories CATEGORY|"CATEGORIES" |
---|
39 | ### -d|--distribution CODENAME |
---|
40 | ### --hostname NAME |
---|
41 | ### -m|--mirror-bootstrap URL |
---|
42 | ### --mirror-chroot URL |
---|
43 | ### --mirror-chroot-security URL |
---|
44 | ### --username NAME |
---|
45 | |
---|
46 | lh clean --binary |
---|
47 | # [Note] option '--categories' is only avaible at live-helper 1.0.3-2 |
---|
48 | lh config -b iso --binary-indices disabled -f minimal --cache enabled --cache-indices enabled -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 'net-tools wireless-tools ssh sudo xserver-xorg-video-vesa xinit xfonts-base x11-xserver-utils xterm openbox iceweasel dhcp3-client' -k 686 |
---|
49 | |
---|
50 | cp chroot-hook/* config/chroot_local-hooks/ |
---|
51 | cp binary-hook/* config/binary_local-hooks/ |
---|
52 | |
---|
53 | lh build |
---|
54 | |
---|
55 | if [ -f binary.iso ]; then |
---|
56 | filename=`date +"hadoop-live-%y%m%d%H%M"` |
---|
57 | mv binary.iso "$filename.iso" |
---|
58 | mv binary.packages "$filename.packages" |
---|
59 | fi |
---|