| 1 |
#! /bin/bash |
|---|
| 2 |
|
|---|
| 3 |
# create bootable iso image |
|---|
| 4 |
|
|---|
| 5 |
# compile osian kernel |
|---|
| 6 |
|
|---|
| 7 |
# Copyright (c) 2006, Jonas Zaddach & Brad DeMorrow |
|---|
| 8 |
# All rights reserved. |
|---|
| 9 |
# |
|---|
| 10 |
# Redistribution and use in source and binary forms, |
|---|
| 11 |
# with or without modification, are permitted provided |
|---|
| 12 |
# that the following conditions are met: |
|---|
| 13 |
# |
|---|
| 14 |
# * Redistributions of source code must retain the above copyright notice, |
|---|
| 15 |
# this list of conditions and the following disclaimer. |
|---|
| 16 |
# * Redistributions in binary form must reproduce the above copyright notice, |
|---|
| 17 |
# this list of conditions and the following disclaimer in the documentation |
|---|
| 18 |
# and/or other materials provided with the distribution. |
|---|
| 19 |
# * Neither the name of the <ORGANIZATION> nor the names of its contributors |
|---|
| 20 |
# may be used to endorse or promote products derived from this software |
|---|
| 21 |
# without specific prior written permission. |
|---|
| 22 |
# |
|---|
| 23 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|---|
| 24 |
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
|---|
| 25 |
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|---|
| 26 |
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
|---|
| 27 |
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|---|
| 28 |
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|---|
| 29 |
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|---|
| 30 |
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|---|
| 31 |
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|---|
| 32 |
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|---|
| 33 |
# POSSIBILITY OF SUCH DAMAGE. |
|---|
| 34 |
|
|---|
| 35 |
#split path variable into pieces |
|---|
| 36 |
ALL_PATH=`echo $PATH | sed -e 's/:/\n/g'` |
|---|
| 37 |
|
|---|
| 38 |
# make distributable (iso) |
|---|
| 39 |
|
|---|
| 40 |
#try to find mkisofs |
|---|
| 41 |
if [ "$CUSTOM_MKISOFS" == "" ] |
|---|
| 42 |
then |
|---|
| 43 |
for MY_PATH in $ALL_PATH |
|---|
| 44 |
do |
|---|
| 45 |
CUSTOM_MKISOFS=`find $MY_PATH -name mkisofs 2> /dev/null` |
|---|
| 46 |
if [ "$CUSTOM_MKISOFS" != "" ] |
|---|
| 47 |
then |
|---|
| 48 |
break |
|---|
| 49 |
fi |
|---|
| 50 |
done |
|---|
| 51 |
|
|---|
| 52 |
if [ "$CUSTOM_MKISOFS" == "" ] |
|---|
| 53 |
then |
|---|
| 54 |
echo 'mkisofs not found in your $PATH variable.' |
|---|
| 55 |
echo 'Please specify location of your mkisofs in $CUSTOM_MKISOFS.' |
|---|
| 56 |
exit |
|---|
| 57 |
fi |
|---|
| 58 |
fi |
|---|
| 59 |
|
|---|
| 60 |
echo "creating ISO ..." |
|---|
| 61 |
echo "using mkisofs: $CUSTOM_MKISOFS" |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
# test if gzip is installed |
|---|
| 65 |
gzip --help > /dev/null |
|---|
| 66 |
if [ "$?" == "0" ] |
|---|
| 67 |
then |
|---|
| 68 |
gzip -9 -c tmp/osian.bin > tmp/osian.gz |
|---|
| 69 |
else |
|---|
| 70 |
# if not just rename the file; kernel will be bigger on disk |
|---|
| 71 |
mv tmp/osian.bin tmp/osian.gz |
|---|
| 72 |
fi |
|---|
| 73 |
|
|---|
| 74 |
mkdir -p tmp/image/boot/grub |
|---|
| 75 |
# copy files one by one to make sure they exist |
|---|
| 76 |
cp dist/boot/menu.lst tmp/image/boot/grub |
|---|
| 77 |
cp dist/boot/grub tmp/image/boot/grub |
|---|
| 78 |
cp tmp/osian.gz tmp/image/boot |
|---|
| 79 |
|
|---|
| 80 |
$CUSTOM_MKISOFS -R -b boot/grub/grub -no-emul-boot \ |
|---|
| 81 |
-boot-load-size 4 -boot-info-table -o osian.iso tmp/image 2> /dev/null |
|---|
| 82 |
|
|---|
| 83 |
if [ "$?" != "0" ] |
|---|
| 84 |
then |
|---|
| 85 |
echo "Error creating ISO image. Check your mkisofs." |
|---|
| 86 |
fi |
|---|