[147] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | ## Author: Jazz Yao-Tsung Wang <jazzwang.tw@gmail.com> |
---|
| 4 | ## |
---|
[249] | 5 | ## v0.2 - 2012-10-09 - update for live-build |
---|
[147] | 6 | ## v0.1 - 2010-05-23 - initial version |
---|
| 7 | ## |
---|
| 8 | ## Reference: |
---|
| 9 | ## [1] http://live.debian.net/manual/html/packages.html#package-sources |
---|
| 10 | ## [2] /opt/drbl/sbin/create-drbl-live (from drbl - http://drbl.sf.net) |
---|
| 11 | ## [3] man lh_config and lh_build |
---|
| 12 | |
---|
[150] | 13 | ## Check root privileges |
---|
| 14 | if [ `id -u` != 0 ]; then |
---|
| 15 | echo "[ERROR] This script must run as root or sudo !!" |
---|
| 16 | exit |
---|
| 17 | fi |
---|
| 18 | |
---|
[149] | 19 | ## Check current distribution is debian-like or not |
---|
| 20 | if [ ! -f /etc/debian_version ]; then |
---|
| 21 | echo "[ERROR] This script must run on Debian or Ubuntu !!" |
---|
| 22 | exit |
---|
| 23 | fi |
---|
| 24 | |
---|
| 25 | ## If /usr/bin/lh is not found, install live-helper package first!! |
---|
[249] | 26 | if [ ! -x /usr/bin/lb ]; then |
---|
| 27 | echo "[WARN] live-build not found!! I will install it first for you!!" |
---|
| 28 | apt-get install -y live-build |
---|
[149] | 29 | fi |
---|
| 30 | |
---|
[249] | 31 | ## [MEMO] following parameter is for live-build ........... |
---|
[149] | 32 | ### -b|--binary-images iso|net|tar|usb-hdd |
---|
| 33 | ### --binary-filesystem fat16|fat32|ext2 |
---|
| 34 | ### --binary-indices enabled|disabled |
---|
| 35 | ### --bootstrap-config FILE |
---|
| 36 | ### -f|--bootstrap-flavour minimal|standard |
---|
| 37 | ### --cache enabled|disabled |
---|
| 38 | ### --cache-indices enabled|disabled |
---|
| 39 | ### --categories CATEGORY|"CATEGORIES" |
---|
| 40 | ### -d|--distribution CODENAME |
---|
| 41 | ### --hostname NAME |
---|
| 42 | ### -m|--mirror-bootstrap URL |
---|
| 43 | ### --mirror-chroot URL |
---|
[147] | 44 | ### --mirror-chroot-security URL |
---|
[149] | 45 | ### --username NAME |
---|
| 46 | |
---|
[249] | 47 | lb clean --binary |
---|
[149] | 48 | # [Note] option '--categories' is only avaible at live-helper 1.0.3-2 |
---|
[250] | 49 | lb config -b iso --binary-indices disabled -f minimal --cache enabled --cache-indices enabled -d squeeze --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 ssh sudo dhcp3-client' -k 686 |
---|
[149] | 50 | |
---|
[249] | 51 | lb build |
---|
[149] | 52 | |
---|
| 53 | if [ -f binary.iso ]; then |
---|
[150] | 54 | filename=`date +"hadoop-live-%y%m%d%H%M"` |
---|
[151] | 55 | mv binary.iso "$filename.iso" |
---|
| 56 | mv binary.packages "$filename.packages" |
---|
[149] | 57 | fi |
---|