Chameleon Applications

Chameleon Applications Svn Source Tree

Root/trunk/ChameleonPrefPane/Resources/cdBootCreator.sh

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

Archive Download this file

Revision: 368