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
16if [[ $# < 2 ]];then
17cdBootDir="${extra}"
18else
19cdBootDir="$2"
20fi
21echo Extra dir is ${extra} cdBootDir is ${cdBootDir}
22mydir=`dirname $0`
23
24tempDir=/tmp
25finaldir=~/Desktop/Chameleon
26isodir=/tmp/newiso
27extradir=/tmp/newiso/Extra
28preDir=/tmp/newiso/Extra/Preboot
29prebootDir="${preDir}/Extra"
30backDir=$finaldir
31bkpdir="${finaldir}/Previous-dmg"
32
33echo "Starting script..."
34
35#errors
36if ([ ! -f $extra/Extensions.mkext ] && [ ! -d $extra/Extensions ]);then
37echo "- Error: no Extensions.mkext or Extensions folder. One of them is required"
38echo " ------------------------"
39exit 1
40fi
41
42if [ ! -f $extra/org.chameleon.Boot.plist ];then
43 echo "- Error: no org.chameleon.Boot.plist found. File required"
44 echo " ------------------------"
45 exit 1
46fi
47if [ ! -f $cdBootDir/cdboot ];then
48 echo "- Error: no cdboot found. File required"
49 echo " ------------------------"
50 exit 1
51fi
52
53# Create a work directory
54echo " - temps folders created"
55echo " - Checking files"
56#copy Extra files to temp directory
57if ([ ! -d $prebootDir ]);then
58mkdir -p $prebootDir
59fi
60if ([ ! -d $bkpdir ]);then
61mkdir -p $bkpdir
62fi
63
64if [ -f $cdBootDir/cdboot ];then
65 cp -R $cdBootDir/cdboot $isodir
66fi
67
68if [ -f $extra/dsdt.aml ];then
69 cp -R $extra/dsdt.aml $prebootDir
70fi
71
72if [ -f $extra/DSDT.aml ];then
73cp -R $extra/DSDT.aml $prebootDir
74fi
75
76if [ -f $extra/NVIDIA.ROM ];then
77cp -R $extra/NVIDIA.ROM $prebootDir
78fi
79
80if [ -f $extra/smbios.plist ];then
81 cp -R $extra/smbios.plist $prebootDir
82fi
83
84if [ -f $extra/Extensions.mkext ];then
85 cp -R $extra/Extensions.mkext $prebootDir
86fi
87
88if [ -d $extra/Extensions ];then
89 cp -Rp $extra/Extensions $prebootDir
90fi
91
92if [ -f $extra/org.chameleon.Boot.plist ];then
93 cp -R $extra/org.chameleon.Boot.plist $prebootDir
94fi
95if [ -f $tempDir/org.chameleon.Boot.plist ];then
96 cp -R $tempDir/org.chameleon.Boot.plist $extradir
97fi
98
99echo "- Files copied in temp folder"
100
101# ramdisk creator
102if [ -f $extradir/Preboot.dmg ];then
103rm $extradir/Preboot.dmg
104fi
105hdiutil create -srcfolder $preDir/ -layout GPTSPUD -fs HFS+ -format UDRW -volname Preboot $extradir/Preboot.dmg
106rm -R $preDir
107echo " - ram disk created"
108
109# boot cd creator
110hdiutil makehybrid -o BootCD.iso $isodir/ -iso -hfs -joliet -eltorito-boot $isodir/cdboot -no-emul-boot -hfs-volume-name "Boot CD" -joliet-volume-name "Boot CD"
111echo " - hybrid image created"
112
113# Create output and backup directories
114if [ -f $finaldir/BootCD.iso ];then
115 if [ ! -d $bkpdir ];then
116 mkdir $backDir
117 mkdir $bkpdir
118 echo " - backup folder created"
119fi
120 mv -f $finaldir/BootCD.iso $bkpdir/BootCd-$(date +"%d-%y-%Hh%M").iso
121 echo " - previous ISO moved into backup folder"
122fi
123mv BootCD.iso $finaldir
124echo " - ISO moved on desktop"
125
126# cleanup
127echo " - Perform cleaning"
128echo " - ISO created succefully"
129echo " ------------------------"
130exit 0

Archive Download this file

Revision: 349