Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/ErmaC/ChameleonPrefPane/Resources/cdBootCreator.sh

  • Property svn:executable set to *
1#!/bin/sh
2
3# Copyright 2009 org.darwinx86.app. All rights reserved.
4#
5
6# Modified Nov 18th 2011 by Rekursor
7# Added 2 parameters to specify repectively :
8# $1 = Extra dir location
9# $2 = cdboot file dir location
10# Added error return codes to be able to better interface the script from the prefpane call
11# Fixed BootCD.iso would be generated in the current script working directory
12#
13
14
15# Directories
16if [[ $# < 1 ]];then
17extra="/Extra"
18else
19extra="$1"
20fi
21
22if [[ $# < 2 ]];then
23cdBootDir="${extra}"
24else
25cdBootDir="$2"
26fi
27
28echo "Extra dir is ${extra} and cdboot dir is ${cdBootDir}"
29mydir=`dirname $0`
30
31tempDir=/tmp
32finaldir=~/Desktop/Chameleon
33isodir=/tmp/newiso
34extradir=/tmp/newiso/Extra
35preDir=/tmp/newiso/Extra/Preboot
36prebootDir="${preDir}/Extra"
37bkpdir="${finaldir}/Previous-dmg"
38
39echo "Starting CD Boot ISO creation script..."
40
41#errors
42if ([ ! -f $extra/Extensions.mkext ] && [ ! -d $extra/Extensions ]);then
43echo "*** Error: no Extensions.mkext or Extensions folder. One of them is required"
44exit 1
45fi
46
47if [ ! -f $extra/org.chameleon.Boot.plist ];then
48 echo "*** Error: no org.chameleon.Boot.plist found. File required"
49 exit 1
50fi
51
52if [ ! -f $cdBootDir/cdboot ];then
53 echo "*** Error: no cdboot found. File required"
54 exit 1
55fi
56
57# Create a work directory
58echo " Creating folders ..."
59#copy Extra files to temp directory
60if ([ ! -d $prebootDir ]);then
61mkdir -p $prebootDir
62fi
63if ([ ! -d $bkpdir ]);then
64mkdir -p $bkpdir
65fi
66echo " Copying files ..."
67
68if [ -f $cdBootDir/cdboot ];then
69 cp -R $cdBootDir/cdboot $isodir
70fi
71
72if [ -f $extra/dsdt.aml ];then
73 cp -R $extra/dsdt.aml $prebootDir
74fi
75
76if [ -f $extra/DSDT.aml ];then
77cp -R $extra/DSDT.aml $prebootDir
78fi
79
80if [ -f $extra/NVIDIA.ROM ];then
81cp -R $extra/NVIDIA.ROM $prebootDir
82fi
83
84if [ -f $extra/smbios.plist ];then
85 cp -R $extra/smbios.plist $prebootDir
86fi
87
88if [ -f $extra/Extensions.mkext ];then
89 cp -R $extra/Extensions.mkext $prebootDir
90fi
91
92if [ -d $extra/Extensions ];then
93 cp -Rp $extra/Extensions $prebootDir
94fi
95
96if [ -f $extra/org.chameleon.Boot.plist ];then
97 cp -R $extra/org.chameleon.Boot.plist $prebootDir
98fi
99if [ -f $tempDir/org.chameleon.Boot.plist ];then
100 cp -R $tempDir/org.chameleon.Boot.plist $extradir
101fi
102
103echo " Files copied in temp folder"
104
105# ramdisk creator
106if [ -f $extradir/Preboot.dmg ];then
107rm $extradir/Preboot.dmg
108fi
109hdiutil create -srcfolder $preDir/ -layout GPTSPUD -fs HFS+ -format UDRW -volname Preboot $extradir/Preboot.dmg
110rm -R $preDir
111echo " Ram disk created"
112
113# boot cd creator
114hdiutil makehybrid -o $tempDir/BootCD.iso $isodir/ -iso -hfs -joliet -eltorito-boot $isodir/cdboot -no-emul-boot -hfs-volume-name "Boot CD" -joliet-volume-name "Boot CD"
115if [ ! -f $tempDir/BootCD.iso ];then
116echo "*** Error: couldn't Create ISO Image."
117exit 1
118else
119echo " Hybrid image created"
120fi
121
122# Create output and backup directories
123if [ -f $finaldir/BootCD.iso ];then
124 if [ ! -d $bkpdir ];then
125 mkdir -p $bkpdir
126 echo " Backup folder created"
127fi
128 mv -f $finaldir/BootCD.iso $bkpdir/BootCd-$(date +"%d-%y-%Hh%M").iso
129 echo " Previous ISO moved into backup folder"
130fi
131mv $tempDir/BootCD.iso $finaldir
132echo " ISO moved on desktop"
133
134# cleanup
135rm -rf $isodir/*
136echo " ISO created successfully"
137exit 0

Archive Download this file

Revision: 396