Adding 2 counts
Hi,
How can i sum each count, the final result being count(*) + count(*)?
like:
select count(*) from table_1
+
select count(*) from table_2
The result should be the sum of the two counts.
Thanks
SQL> ed
Wrote file afiedt.buf
1 select sum(cnt) from
2 (select count(*) cnt from user_objects
3 union all
4 select count(*) cnt from all_objects
5* )
SQL> /
SUM(CNT)
18707or
SQL> ed
Wrote file afiedt.buf
1* select (select count(*) from all_objects) + (select count(*) from user_objects) cnt from dual
SQL> /
CNT
18707
Similar Messages
-
Creating text file from SQL with adding counter in Filename.
Hi,
I have a requirement for creating the Tesxt files from Oracle DB which i can achieve by ODISQLUNLOAD.
But tricky part is that i want have a file name+ counter such that Counter should start with 1 for the first file of the day, then 2,... and reset to 1 for every new date.
e.g. file0001, file0002,file0003,file0004,.... file0100 and so on for one day.
But when i will create a file on next day it should be created as again file0001, file0002,file0003,file0004,.... file0100 and so on.
I may be able to achieve this using some variables but unable to think how could i achieve this.
Any help would be appreciated.
Thanks and Regards,
MaheshHi Mahesh,
If the files are loaded as one batch process, for instance, by executing a single package, you could perform a looping function and store the counter as a variable. It would be very similar to the blog post here: https://blogs.oracle.com/dataintegration/entry/using_variables_in_odi_creatin - but you would be using the #counter variable in your filename. Each day that the package is run, the counter starts at 1.
Hope this will fit your needs.
Enjoy!
Michael R. -
Adding count from two select statements
Hi,
How to add counts from two select statements in a single SQL statement.
For ex: I have
SELECT COUNT(DISTINCT COL1) FROM table1
and
SELECT COUNT(DISTINCT COL2) FROM table2.
I want to add the counts from these two sqls in a single select query. How to do this.
Thanks & Regards,
Sunil.select ((SELECT COUNT(DISTINCT COL1) FROM table1) + (SELECT COUNT(DISTINCT COL2) FROM table2)) as "total" from dual;
regards, -
I am attempting to query a little Oracle table. I want to get all checks that have a (maximum line number + total discount lines > 0) > 10
In the table there are these fields: discount amount, line number, check number, system date.
So say there are 35 lines on the check. Of these 35 lines, 15 of them have values > 0 in the discount line field. I need to add up the total lines (35) plus the discount lines > 0 (15) = 50.
Can this be done with one query?
This is the query I have now. However, it gives me a result of 47, not of 50. Actually, I'm a bit confused as to why it gives me 47.
select count(disc_ln_am) + max(doc_actg_ln_no) as Total, chk_no, doc_id, curr_sys_dt
from ad_doc_actg
where ad_doc_actg.chk_no = '00000000001'
group by chk_no, doc_id, curr_sys_dt
having (count(disc_ln_am) + max(doc_actg_ln_no)) > 10
I'd greatly appreciate help. Thanks in advance.
Message was edited by:
user526450Your query works for me.
SQL> select *
2 from ad_doc_actg
3 order by DOC_ACTG_LN_NO;
CHK_NO DOC_ID CURR_SYS_ DISC_LN_AMT DOC_ACTG_LN_NO
00000000001 42 22-AUG-06 1.23 1
00000000001 42 22-AUG-06 2
00000000001 42 22-AUG-06 1.23 3
00000000001 42 22-AUG-06 4
00000000001 42 22-AUG-06 1.23 5
00000000001 42 22-AUG-06 6
00000000001 42 22-AUG-06 1.23 7
00000000001 42 22-AUG-06 8
00000000001 42 22-AUG-06 1.23 9
00000000001 42 22-AUG-06 10
00000000001 42 22-AUG-06 1.23 11
00000000001 42 22-AUG-06 12
00000000001 42 22-AUG-06 1.23 13
00000000001 42 22-AUG-06 14
00000000001 42 22-AUG-06 1.23 15
00000000001 42 22-AUG-06 16
00000000001 42 22-AUG-06 1.23 17
00000000001 42 22-AUG-06 18
00000000001 42 22-AUG-06 1.23 19
00000000001 42 22-AUG-06 20
00000000001 42 22-AUG-06 1.23 21
00000000001 42 22-AUG-06 22
00000000001 42 22-AUG-06 1.23 23
00000000001 42 22-AUG-06 24
00000000001 42 22-AUG-06 1.23 25
00000000001 42 22-AUG-06 26
00000000001 42 22-AUG-06 1.23 27
00000000001 42 22-AUG-06 28
00000000001 42 22-AUG-06 1.23 29
00000000001 42 22-AUG-06 30
00000000001 42 22-AUG-06 31
00000000001 42 22-AUG-06 32
00000000001 42 22-AUG-06 33
00000000001 42 22-AUG-06 34
00000000001 42 22-AUG-06 35
35 rows selected.
SQL> select count(disc_ln_amt) + max(doc_actg_ln_no) as Total, chk_no, doc_id, curr_sys_dt
2 from ad_doc_actg
3 where ad_doc_actg.chk_no = '00000000001'
4 group by chk_no, doc_id, curr_sys_dt
5 having (count(disc_ln_amt) + max(doc_actg_ln_no)) > 10
6 ;
TOTAL CHK_NO DOC_ID CURR_SYS_
50 00000000001 42 22-AUG-06However, I would use sum instead of count. If disc_ln_amt is ever a 0.00, count() will give you the wrong results.
SQL> select chk_no
2 ,doc_id
3 ,curr_sys_dt
4 ,(disc_count + max_line) total
5 from
6 (
7 select sum(case
8 when nvl(disc_ln_amt,0) > 0 then 1
9 else 0
10 end
11 ) disc_count
12 ,max(doc_actg_ln_no) max_line
13 ,chk_no
14 ,doc_id
15 ,curr_sys_dt
16 from ad_doc_actg
17 where ad_doc_actg.chk_no = '00000000001'
18 group by chk_no
19 ,doc_id
20 ,curr_sys_dt
21 )
22 where disc_count + max_line > 10
23 ;
CHK_NO DOC_ID CURR_SYS_ TOTAL
00000000001 42 22-AUG-06 50Yes, it's a little more verbose.
Message was edited by:
Eric H -
Adding count total column .
Hi,
I'm dealing with 9.2.0.8 so some restrictions may apply :).
here is the case
SQL> create table t (id number) ;
Table created.
SQL> insert into t values(1);
1 row created.
SQL> insert into t values(1);
1 row created.
SQL> insert into t values(1);
1 row created.
SQL> insert into t values(2);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t;
ID
1
1
1
2
SQL> select count(*), id , ratio_to_report(count(*)) over () *100 pct , count(*) over () from t group by id;
COUNT(*) ID PCT COUNT(*)OVER()
3 1 75 2
1 2 25 2
but I need last column as all rows in table so should be
SQL> select count(*), id , ratio_to_report(count(*)) over () *100 pct , count(*) over () from t group by id;
COUNT(*) ID PCT COUNT(*)OVER()
3 1 75 4
1 2 25 4
how to rewrite that, ratio_to_report gives percentage which is quite good but need all rows .Regards
GregGHi,
Do you need this?
select count(*)
,id
,ratio_to_report(count(*)) over () *100 as pct
,sum(count(*)) over()
from t
group by id; -
Hello all-
I know this has been discussed numerous times but I can't seem to get it working!
I'm trying to start simple first and here is what I am trying to accomplish at this time:
I have three "rectangle" boxes (on the stage), each a symbol(names below) and different color.
blueBox
redBox
greenBox
I have three "text" boxes above them on the stage.
blueCounter
redCounter
greenCounter
I have three variables in the compositionReady action on the stage:
sym.setVariable("redCount", 0);
sym.setVariable("blueCount", 0);
sym.setVariable("greenCount", 0);
What I want to have happen is when you click on the text box for any of the boxes, the box performs an animation and a number gets incremented by one, showing on the stage after the "text" boxes from above:
blueCounter 2
redCounter 5
greenCounter 1
I have the following code in an "onClick" action for the greenCounter text that calls the appropriately colored box:
sym.$("greenBox").show(); // it is hidden on the stage at first-this works fine
var counter = sym.getVariable("greenCount");
counter++;
sym.$("counter").html("green Count: " + counter);
sym.setVariable("greenCount", counter);
But, of course, I'm not seeing anything appear after the "Green Count:" text on the stage (or the other two)... (except the animation does play)...
I know I'm missing something elementary and if I can get that figured out, I can move on to what I really want to do with this functionality, now and in the future :-)
Any ideas?
Thanks!
JamesI've got another question:
Is there a "list" of Edge "restricted code names" (for better lack of words)?
Playing with the code example you sent, I'm still fighting to add the other two "colored boxes".
I was trying to change the following and it breaks, which lead me to believe it is a restricted word used by Edge:
var counter = sym.getVariable("greenCount");
// insert code to be run when the composition is fully loaded here
sym.$('greenCounter').click(function(){
sym.$("greenBox").show(); // it is hidden on the stage at first-this works fine
sym.$("greenCounter").html("green Count: " + counter);
counter++;
I was trying to change the variable "counter" to "greenCounter", redCounter", "blueCounter" but the "counter" broke for the green box. It shows on the page but doesn't increment past 0.
James -
How to determine the cursor record count before the "open cursor"?
Is it possible to determine the record count of an explicit cursor without running a count()? Say, my cursor definition is something like this,
CURSOR cur_vehicle
IS
SELECT os.order_id, os.order_item, vs.part_id
vs.part_num,
vs.iso_num,
vs.model_yr
vs.dealer_cde,
vs.cust_cde,
px.plant_cd
FROM parts_source vs,
orders_source os,
plant_tbl_crossref px
wHERE os.order_id = vs.order_id
AND vs.part_id = os.part_id
AND vs.plant_cde = px.plant_cde
ORDER BY os.order_id;
I want to log the count of records returned by the above cursor prior to the first fetch, without running a count(1) for the query in cursor select.
I know adding " Count(1) over(order by null) " in the cursor SELECT will bring it. But that does not help me log the record count to some log file or table before opening the cursor for processing.
To conclude, my objective is to update the record count of cursor in some table before processingsarvan wrote:
Is it possible to determine the record count of an explicit cursor without running a count()?
..snipped..No. The only way to do it correctly is inside that select.
Each select is a consistent read. Which means that if this is done as 2 select statements, the 1st select can see a different version of the data than the 2nd select statement. does. So if you want a count and that to be consistent and on the same version of the data than the select, it has to be done as part of the select.
Also consider what a cursor is. It is not a result set of sorts that is created in memory upfront - with a convenient interface that tells you the size/number of rows of that result set.
A cursor is basically a program that reads database data as input and produce output. A fetch from a cursor is an instruction for this program to execute and output data.
There's no data set that is created by the cursor from which the count can be determined. The cursor program does have state variables - like +%RowCount+ that specifies how many rows the cursor has thus far output. And you need to run that cursor to the end (no more output) in order to determine the total number of rows output by the cursor. -
OLAP Analysis Count Distinct?
If this query is better suited to the OLAP forum, please let me know.
I am creating an Enrollment cube that has a dimension of Student with a Student_ID attribute. The fact table contains a measure column called Students, with each record having a value of 1. This results in getting a total SUM of students for a specific semester in an analysis in BI. However, this SUM aggregation does not distinctly identify students, resulting in a student that attends 4 semesters being counted as 4 students for the entire academic year. Adding COUNT(DISTINCT Student.Student_ID) to the analysis worked with an earlier test cube that I had created, but when I try to perform it on my updated cube it will only give me a COUNT(DISTINCT) for All Time, even when looking at the Semester or Academic Year levels. The only appreciable difference in my updated cube is that it has more dimensions.Yes, you can post your query on the OLAP forum because this forum is on Oracle BI Applications (pre packages applications using OBEE + DAC + Informatica).
Regards,
Benoit -
Given a table that looks like this:
ALLOC_NUMBER ALLOC_PCT
88888 2.71428571
88888 0
87777 -2.7142857
85555 11.0429273
I want to group by alloc_number and determine if the sum of the alloc_pct in that group is > 0. If so, return a count of all alloc_numbers in the table that satisfy that condition, w/o duplicates.
If I write:
SELECT alloc_number
FROM alloc_transfer
GROUP BY alloc_number
HAVING SUM(alloc_pct) > 0;
It lists the alloc numbers that I want to count, but how do I get the count instead? Just adding COUNT to the Select clause will not work because that will give a count within the group, not for the whole table.
Thanks.
Edited by: Prohan on Feb 8, 2010 2:39 PMHi,
Prohan wrote:
As an aside, it looks like it doesn't even matter what the inner aggregate function is; i. e., I could have written:
SELECT COUNT (SUM(alloc_pct))
FROM alloc_transfer
GROUP BY alloc_number
HAVING SUM(alloc_pct) > 0;
The point is simply to bring back a result, any result, for the GROUP of alloc_numbers. Then the outer aggregate function simply counts the number of results that were returned by the inner one; the number of results being equivalent, of course, to the number of alloc_numbers, which is what I'm trying to count.Exactly!
The argument to COUNT must be an aggregate function. Any aggregate function will do, but be careful if it can return NULL.
For example, if you had a column called comment_txt that was almost always NULL, then you wouldn't want the inner aggregate function to be MAX (comment_txt); if every row in a group had NULL comment_txt, then MAX (comment_txt) would be NULL, and the group would not get counted, regardless of alloc_pct.
I chose COUNT for the inner aggregate function, because it never returns NULL. COUNT ignores NULLs, but if it encounters nothing except NULLs, it returns 0, not NULL.
SUM can return NULL, but it's okay to use "SUM (alloc_pct)" in this query, because, if it happened to be NULL, the row would be discarded by the HAVING clause.
Knowing that, can you think of a way to make the query even shorter?
Lose the HAVING clause.
If the SELECT clause is "SELECT COUNT (SUM(alloc_pct))", then the results will be the same if we omit "HAVING SUM(alloc_pct) > 0". The rows discarded by that HAVING clause won't be counted anyway.
Edited by: Frank Kulash on Feb 9, 2010 12:54 PM -
Counter channels detection through a labview VI
Hey
We are having a PCI-6036E card which has 2 counter inputs and this device with counter channels is communicating with the program creadted in Labview.
We want to upgrade that card with add on counter card of PCI-6624. I even modified the program like increasing the counter channels in the program. Now with functional generator i give frequency as input and that i can read in the MAX through counter channels.
So when it comes to the program, it is reading only the 0 channel(i mean the first channel) and for the rest of the channels i see NAN. I am messed up and going through the source code but i see no error in the program.
If i messed up the description i can come back again with better explanation. Can anyone guide me to solve this issue.
Thank you in advance
-KiritHey
Thank you for the concern.
I will try to answer ur questions...
What type of signal are you sending from the function generator to the counter input channels of your PCI-6624?
Frequency signal with current of 2.5mA. By this i can read the frequency what ever i give in Functional generator through MAX.
Frequency level is from 100 - 1500 HZ
Have you tried just verifying the operation in MAX using a counter input test panel for the channels of your PCI-6624
Above signal i reading it through test panel of PCI-6624 card in MAX
What type of indicator is it in your program where the NANs show up when you run your program?
It is numeric indicator i guess. This you can see in to digitals-rpt.VI
I dont know what else i can do to explain the problem. You can come up with any questions for clarification after going through the llb file.
I guess, the logic i am missing in adding counter channels in the code is in( to digitals-rpt.vi)
Pls go through the *.llb file
Thanks a lot
-Kirit
Attachments:
ver4.33.llb 979 KB -
SIU error in 10.6.6
Hello,
I'm using SIU to create a Net Restore image however I'm getting a error message when it starts to create the system.dmg (No Space left on Disk). I have checked the amount of space on the drive (over 100GB) free. The image I'm trying to create a 16GB image. I bolded the part where it fails.
Here is the Debug log it is quiet long.
Starting image creation.
Workflow Started (2011-06-21 13:06:41 -0400)
Mac OS X Server 10.6.7 (10J869), System Image Utility 10.6.7 (448)
Starting action: Define Image Source (1.2)
Finished running action: Define Image Source
Starting action: Create Image (1.5.4)
Starting image creation process...
Create NetInstall Image
Initiating NetInstall from Restore Media.
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
mountPoint="/tmp/mnt.bcFq7u"
++ mountPoint=/tmp/mnt.bcFq7u
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
mkextPathKey="/System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mk ext"
++ mkextPathKey=/System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mk ext
sourceVol="/Volumes/Macintosh HD"
++ sourceVol='/Volumes/Macintosh HD'
skipFileChecksumKey="0"
++ skipFileChecksumKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
destPath="/Library/NetBoot/NetBootSP0/Dev_Image"
++ destPath=/Library/NetBoot/NetBootSP0/Dev_Image
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
. "$1/createCommon.sh"
+ . /tmp/niutemp.ZbrIcFvw/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright 2007 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 long name
# $2 short name
# $3 isAdminUser key
# $4 password hash
# $5 user picture path
# $6 Language string
local databasePath="/Local/Target/Users/${2}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -search /Local/Target/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -create $databasePath || exit 1
# Add long name
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${1}" || exit 1
# Add PrimaryGroupID
if [ "${3}" == 1 ]; then
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 80 || exit 1
else
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20 || exit 1
fi
# Add UniqueID
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i} || exit 1
# Add Home Directory entry
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath dsAttrTypeNative:home /Users/${2} || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath authentication_authority ";ShadowHash;" || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${5}" || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath passwd "*" || exit 1
# Add shell
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash" || exit 1
# lookup generated uid
genUID=`/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${2} GeneratedUID` || exit 1
genUID=${genUID:14:36}
# make sure the shadow/hash directory exists
if [ ! -e "${mountPoint}/var/db/shadow/hash" ] ; then
/bin/mkdir -p "${mountPoint}/var/db/shadow/hash" || exit 1
/bin/chmod -R 700 "${mountPoint}/var/db/shadow" || exit 1
fi
# to copy our password hash in there...
echo "${4}" > "${mountPoint}/var/db/shadow/hash/$genUID"
/bin/chmod 600 "${mountPoint}/var/db/shadow/hash/$genUID" || exit 1
# Create Home directory
if [ -e "/System/Library/User Template/${6}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${6}.lproj/" "${mountPoint}/Users/${2}" || exit 1
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${mountPoint}/Users/${2}" || exit 1
fi
/usr/sbin/chown -R $i:$i "${mountPoint}/Users/${2}" || exit 1
# If they exist, apply any Append.bom changes
ApplyAppendBom()
local tempDir="$1"
local srcVol="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$tempDir/Append.bom" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Applying Append.bom additions from System Image Utility"
fi
/usr/bin/ditto $opt -bom "$tempDir/Append.bom" "$srcVol" "${mountPoint}" || exit 1
fi
if [ -e "$srcVol/Library/Application Support/Apple/System Image Utility/Append.bom" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Applying Append.bom additions from $srcVol"
fi
/usr/bin/ditto $opt -bom "$srcVol/Library/Application Support/Apple/System Image Utility/Append.bom" "$srcVol" "${mountPoint}" || exit 1
fi
# Copies a list of packages (full paths contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/System/Installation/Packages/${leafName}" || exit 1
fi
done < "${theFile}"
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/System/Installation/Packages/${SUB_PATH}${leafName}" || exit 1
fi
done < "${theFile}"
# Create the dyld shared cache files
CreateDyldCaches()
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating dyld shared cache files"
# This spews too much for verbose mode... only enable for debug
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-debug"
fi
fi
/usr/bin/update_dyld_shared_cache -root "${mountPoint}" -universal_boot -force $opt
# Validate or create the destination directory and mount point
CreateOrValidateDestination()
local destDir="$1"
if [ ! -d "$destDir" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at $destDir"
fi
/bin/mkdir -p "$destDir" || exit 1
fi
# Create mount point
if [ ! -d "${mountPoint}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating mountpoint for in $destDir"
fi
/bin/mkdir -p "${mountPoint}" || exit 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
local count="${#userFullName[*]}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassHash[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
done
# "touch"
/usr/bin/touch "${mountPoint}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${mountPoint}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mountPoint}"
fi
fi
# Finally detach the image and dispose the mountPoint directory
/usr/bin/hdiutil detach "${mountPoint}" || retry_hdiutil_detach "${mountPoint}" || exit 1
/bin/rmdir "${mountPoint}" || exit 1
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="$1"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || exit 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || exit 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$tempDir/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "$tempDir/bindingNames.plist" "${mountPoint}/etc/bindingNames.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/etc/bindingNames.plist"
/bin/chmod 644 "${mountPoint}/etc/bindingNames.plist"
fi
if [ -e "$tempDir/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "$tempDir/sharingNames.plist" "${mountPoint}/etc/sharingNames.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/etc/sharingNames.plist"
/bin/chmod 644 "${mountPoint}/etc/sharingNames.plist"
fi
if [ -e "$tempDir/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "$tempDir/NetBootClientHelper" "${mountPoint}/usr/sbin/NetBootClientHelper" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${mountPoint}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "$tempDir/com.apple.NetBootClientHelper.plist" "${mountPoint}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist " || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist "
/bin/chmod 644 "${mountPoint}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist "
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${mountPoint}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
# Create an installer package in /System/Installation/Packages/ wrapping the supplied script
InstallerPackageFromScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script $scriptName"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/$scriptName.pkg/Contents/Resources"
/bin/mkdir $opt "${tempDir}/emptyDir" || exit 1
cd "${tempDir}/emptyDir"
# Create Archive.pax.gz
/bin/pax -w -x cpio -f "$tempDir/$scriptName.pkg/Contents/Archive.pax" .
/usr/bin/gzip "$tempDir/$scriptName.pkg/Contents/Archive.pax"
# Create the Archive.bom file
/usr/bin/mkbom "$tempDir/emptyDir/" "$tempDir/$scriptName.pkg/Contents/Archive.bom"
# Create the Info.plist
/bin/cat > "$tempDir/$scriptName.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.server.SystemImageUtility.$scriptName</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "$tempDir/$scriptName.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "$tempDir/$scriptName.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "$tempDir/$scriptName.pkg/Contents/Resources/postflight"
# copy the package to the Packages directory
/usr/bin/ditto $opt "$tempDir/$scriptName.pkg" "${mountPoint}/System/Installation/Packages/$scriptName.pkg" || exit 1
# clean up
/bin/rm -r "$tempDir/emptyDir"
/bin/rm -r "$tempDir/$scriptName.pkg"
# If it exists, install the PowerManagement.plist onto the install image
InstallPowerManagementPlist()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/com.apple.PowerManagement.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing PowerManagement plist to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/com.apple.PowerManagement.plist" "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist"
/bin/chmod 644 "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist"
fi
# If it exists, install the InstallerStatusNotifications.bundle and progress emitter onto the install image
InstallProgressPieces()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/InstallerStatusNotifications.bundle" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing progress announcer to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/InstallerStatusNotifications.bundle" "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle" || exit 1
/usr/sbin/chown -R root:wheel "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle"
/bin/chmod 755 "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle"
fi
if [ -e "$tempDir/com.apple.ProgressEmitter.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing status emitter to image"
fi
/usr/bin/ditto $opt "$tempDir/progress_emitter" "${mountPoint}/usr/sbin/progress_emitter" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/usr/sbin/progress_emitter"
/bin/chmod 555 "${mountPoint}/usr/sbin/progress_emitter"
/usr/bin/ditto $opt "$tempDir/com.apple.ProgressEmitter.plist" "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist"
/bin/chmod 644 "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist"
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in .../System/Installation/Packages/
InstallScriptsFromFile()
local tempDir="$1"
local theFile="$2"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
InstallerPackageFromScript "$tempDir" "${FILE}"
fi
done < "${theFile}"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount || exit 1
# copy the NBImageInfo.plist file
/usr/bin/ditto $opt "$tempDir/NBImageInfo.plist" "$destDir/NBImageInfo.plist" || exit 1
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# rename the folder to .nbi
if [ ! -e "$destDir.nbi" ]; then
/bin/mv $opt "$destDir" "$destDir.nbi" || exit 1
else
local parentDir=`dirname "${destDir}"`
local targetName=`basename "${destDir}"`
for ((i=2; i<1000; i++)); do
if [ ! -e "${parentDir}/${targetName}_$i.nbi" ]; then
/bin/mv $opt "$destDir" "${parentDir}/${targetName}_$i.nbi" || exit 1
break
fi
done
fi
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local destDir="$1"
local opt=""
local arch_x86_64=`/usr/bin/file -b "${mountPoint}/mach_kernel" | /usr/bin/sed -ne 's/.*\(x86_64\)):.*/\1/p'`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# Insure the kext cache on our source volume (the boot shell) is up to date
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Updating kext cache on source volume"
fi
/usr/sbin/kextcache -update-volume "${mountPoint}" || exit 1
# Copy the i386 and, if it exists, the x86_64 architecture
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing Intel architecture"
fi
# Prepare the kernel
/bin/mkdir $opt "$destDir/i386" || exit 1
/usr/bin/lipo -extract i386 "${mountPoint}/mach_kernel" -output "$destDir/i386/mach.macosx" || exit 1
# Build kext cache
/usr/sbin/kextcache -a i386 -s -l -n -z -mkext2 "$destDir/i386/mach.macosx.mkext" "${mountPoint}/System/Library/Extensions" || exit 1
# If the x86_64 architecture exists, copy it
if [ "${arch_x86_64}" = "x86_64" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing x86_64 architecture"
fi
# Prepare the kernel
/bin/mkdir $opt "$destDir/i386/x86_64" || exit 1
/usr/bin/lipo -extract x86_64 "${mountPoint}/mach_kernel" -output "$destDir/i386/x86_64/mach.macosx" || exit 1
# Build kext cache
/usr/sbin/kextcache -a x86_64 -s -l -n -z -mkext2 "$destDir/i386/x86_64/mach.macosx.mkext" "${mountPoint}/System/Library/Extensions" || exit 1
fi
# Create the i386 and x86_64 boot loaders on the boot image
PrepareBootLoader()
local srcVol="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing boot loader"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# Copy the i386 and, by default, the x86_64 architecture
if [ -e "${mountPoint}/usr/standalone/i386/boot.efi" ]; then
/usr/bin/ditto $opt "${mountPoint}/usr/standalone/i386/boot.efi" "$destDir/i386/booter" || exit 1
else
/usr/bin/ditto $opt "$srcVol/usr/standalone/i386/boot.efi" "$destDir/i386/booter" || exit 1
fi
# If it exists, install the partitioning application and data onto the install image
ProcessAutoPartition()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/PartitionInfo.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Partitioning application and data to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/PartitionInfo.plist" "${mountPoint}/System/Installation/PartitionInfo.plist" || exit 1
/usr/bin/ditto $opt "$tempDir/AutoPartition.app" "${mountPoint}/System/Installation/AutoPartition.app" || exit 1
# Tell the installer to run the Partitioning application
/bin/echo "#!/bin/sh
/System/Installation/AutoPartition.app/Contents/MacOS/AutoPartition" > "${mountPoint}/private/etc/rc.cdrom.postWS"
# Due to the way rc.install sources the script, it needs to be executable
/usr/sbin/chown root:wheel "${mountPoint}/private/etc/rc.cdrom.postWS"
/bin/chmod 755 "${mountPoint}/private/etc/rc.cdrom.postWS"
fi
# If it exists, install the InstallPreferences.plist onto the install image
ProcessInstallPreferences()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/InstallPreferences.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing InstallPreferences.plist to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/InstallPreferences.plist" "${mountPoint}/System/Installation/Packages/InstallPreferences.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/System/Installation/Packages/InstallPreferences.plist"
/bin/chmod 644 "${mountPoint}/System/Installation/Packages/InstallPreferences.plist"
fi
# If it exists, install the minstallconfig.xml onto the install image
ProcessMinInstall()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/minstallconfig.xml" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing minstallconfig.xml to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/minstallconfig.xml" "${mountPoint}/etc/minstallconfig.xml" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/etc/minstallconfig.xml"
/bin/chmod 644 "${mountPoint}/etc/minstallconfig.xml"
fi
# untar the OSInstall.mpkg so it can be modified
untarOSInstallMpkg()
local tempDir="$1"
local opt=""
# we might have already done this, so check for it first
if [ ! -d "${tempDir}/OSInstall_pkg" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "uncompressing OSInstall.mpkg"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/bin/mkdir "${tempDir}/OSInstall_pkg"
cd "${tempDir}/OSInstall_pkg"
/usr/bin/xar $opt -xf "${mountPoint}/System/Installation/Packages/OSInstall.mpkg"
# make Distribution writeable
/bin/chmod 777 "${tempDir}/OSInstall_pkg"
/bin/chmod 666 "${tempDir}/OSInstall_pkg/Distribution"
fi
handler ()
echo "Terminated. Cleaning up. Unmounting $destPath"
# detach the disk and remove the mount folder
DetachAndRemoveMount
# Remove the items we created
/bin/rm -r "$destPath/i386"
/bin/rm "$destPath/$dmgTarget.dmg"
/bin/rm "$destPath/System.dmg"
# Finally, remove the directory IF empty
/bin/rmdir "$destPath"
exit 1
InstallNetBootClientHelper()
local tempDir="$1"
local destDir="${mountPoint}/System/Installation/Packages/SIUExtras"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${destDir}/bindingNames.plist" || exit 1
/usr/sbin/chown root:wheel "${destDir}/bindingNames.plist"
/bin/chmod 644 "${destDir}/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${destDir}/sharingNames.plist" || exit 1
/usr/sbin/chown root:wheel "${destDir}/sharingNames.plist"
/bin/chmod 644 "${destDir}/sharingNames.plist"
fi
# This is required, make sure it's here
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${destDir}/NetBootClientHelper" || exit 1
/usr/sbin/chown root:wheel "${destDir}/NetBootClientHelper"
/bin/chmod 555 "${destDir}/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${destDir}/com.apple.NetBootClientHelper.plist" || exit 1
/usr/sbin/chown root:wheel "${destDir}/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${destDir}/com.apple.NetBootClientHelper.plist"
/usr/bin/ditto $opt "${tempDir}/installClientHelper.sh" "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh"
/bin/chmod 555 "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh"
trap "handler" TERM INT
+ trap handler TERM INT
# Set up for script debugging
debug_opt=""
+ debug_opt=
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
debug_opt="-v"
fi
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ debug_opt=-v
# See if the source volume was overridden (NetRestore from install media workflow)
isRestoreFromInstallMedia="NO"
+ isRestoreFromInstallMedia=NO
if [ ! -z "${3:-}" ]; then
sourceVol="${3}"
isRestoreFromInstallMedia="YES"
fi
+ '[' '!' -z '' ']'
# Prepare the destination
CreateOrValidateDestination "$destPath"
+ CreateOrValidateDestination /Library/NetBoot/NetBootSP0/Dev_Image
+ local destDir=/Library/NetBoot/NetBootSP0/Dev_Image
+ '[' '!' -d /Library/NetBoot/NetBootSP0/Dev_Image ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating working path at /Library/NetBoot/NetBootSP0/Dev_Image'
Creating working path at /Library/NetBoot/NetBootSP0/Dev_Image
+ /bin/mkdir -p /Library/NetBoot/NetBootSP0/Dev_Image
+ '[' '!' -d /tmp/mnt.bcFq7u ']'
# If the sourceVol is the boot drive we have an asr:// type source
if [ "$sourceVol" == "/" ]; then
# Create an empty image to skip the ASR volume creation
/usr/bin/touch "${destPath}/System.dmg"
fi
+ '[' '/Volumes/Macintosh HD' == / ']'
# Look for an existing System.dmg
if [ ! -e "$destPath/System.dmg" ]; then
# update progress information
echo "${progressPrefix}_imagingSource_"
# Create an image of the source volume
# /usr/bin/hdiutil create "$destPath/System" -srcfolder "$sourceVol" -format UDBZ -uid 0 -gid 80 -mode 1775 -ov -puppetstrings || exit 1
if [ "${blockCopyDeviceKey}" == 1 ] ; then
theDevice=`/usr/sbin/diskutil info "$sourceVol" | grep "Device Identifier:" | awk '{print $3}'`
/usr/sbin/diskutil umount "${theDevice}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating block-level image of $theDevice"
fi
/usr/bin/hdiutil create "$destPath/System" -srcdevice "${theDevice}" -uid 0 -gid 80 -mode 1775 -ov -puppetstrings || exit 1
/usr/sbin/diskutil mount "${theDevice}"
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating image of $sourceVol"
fi
/usr/bin/hdiutil create "$destPath/System" -srcfolder "${sourceVol}" -fsargs "-c a=16384,c=8192,e=1280" -uid 0 -gid 80 -mode 1775 -ov -puppetstrings || exit 1
fi
# update progress information
echo "${progressPrefix}_preparingASR_"
# "Scan the image for restore"
asr_opt="--filechecksum"
if [ "${skipFileChecksumKey}" == 1 ] ; then
asr_opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Preparing image for restore without file checksums"
fi
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Preparing image for restore"
fi
fi
/usr/sbin/asr imagescan --source "$destPath/System.dmg" $asr_opt || exit 1
fi
+ '[' '!' -e /Library/NetBoot/NetBootSP0/Dev_Image/System.dmg ']'
+ echo _progress_imagingSource_
+ '[' 0 == 1 ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating image of /Volumes/Macintosh HD'
Creating image of /Volumes/Macintosh HD
+ /usr/bin/hdiutil create /Library/NetBoot/NetBootSP0/Dev_Image/System -srcfolder '/Volumes/Macintosh HD' -fsargs '-c a=16384,c=8192,e=1280' -uid 0 -gid 80 -mode 1775 -ov -puppetstrings
PERCENT:0.000000
PERCENT:0.330451
PERCENT:0.332470
PERCENT:0.344677
PERCENT:0.377071
PERCENT:0.422909
PERCENT:0.459435
PERCENT:0.489441
PERCENT:0.518527
PERCENT:0.565020
PERCENT:0.623910
PERCENT:0.685802
PERCENT:0.744207
PERCENT:0.794040
PERCENT:0.841389
PERCENT:0.921185
PERCENT:0.985307
PERCENT:1.046925
PERCENT:1.105213
PERCENT:1.175296
PERCENT:1.230995
PERCENT:1.293341
PERCENT:1.352126
PERCENT:1.406514
PERCENT:1.473987
PERCENT:1.522076
PERCENT:1.585543
PERCENT:1.643091
PERCENT:1.717444
PERCENT:1.794418
PERCENT:1.862271
PERCENT:1.936603
PERCENT:1.994204
PERCENT:2.052249
PERCENT:2.111711
PERCENT:2.173170
PERCENT:2.214875
PERCENT:2.261125
PERCENT:2.305547
PERCENT:2.349017
PERCENT:2.390067
PERCENT:2.426858
PERCENT:2.464494
PERCENT:2.501401
PERCENT:2.544618
PERCENT:2.585044
PERCENT:2.616508
PERCENT:2.653373
PERCENT:2.684488
PERCENT:2.714250
PERCENT:2.744013
PERCENT:2.775128
PERCENT:2.805567
PERCENT:2.842241
PERCENT:2.896164
PERCENT:2.947551
PERCENT:3.077877
PERCENT:3.189032
PERCENT:3.255416
PERCENT:3.318238
PERCENT:3.385203
PERCENT:3.447032
PERCENT:3.501008
PERCENT:3.556358
PERCENT:3.596298
PERCENT:3.640265
PERCENT:3.701312
PERCENT:3.740216
PERCENT:3.751684
PERCENT:3.756873
PERCENT:3.759463
PERCENT:3.771110
PERCENT:3.832558
PERCENT:3.878956
PERCENT:3.921570
PERCENT:3.966489
PERCENT:4.017378
PERCENT:4.063142
PERCENT:4.108230
PERCENT:4.145591
PERCENT:4.192771
PERCENT:4.235164
PERCENT:4.266099
PERCENT:4.307170
PERCENT:4.339046
PERCENT:4.361928
PERCENT:4.408115
PERCENT:4.481009
PERCENT:4.546252
PERCENT:4.608429
PERCENT:4.672034
PERCENT:4.743332
PERCENT:4.808416
PERCENT:4.873353
PERCENT:4.936820
PERCENT:4.938119
PERCENT:4.964922
PERCENT:5.001111
PERCENT:5.047287
PERCENT:5.097353
PERCENT:5.156835
PERCENT:5.215133
PERCENT:5.275134
PERCENT:5.325294
PERCENT:5.386827
PERCENT:5.434113
PERCENT:5.478503
PERCENT:5.503984
PERCENT:5.529995
PERCENT:5.571034
PERCENT:5.621808
PERCENT:5.664380
PERCENT:5.703200
PERCENT:5.741238
PERCENT:5.787234
PERCENT:5.833463
PERCENT:5.900407
PERCENT:5.969592
PERCENT:6.021909
PERCENT:6.068772
PERCENT:6.125062
PERCENT:6.181723
PERCENT:6.232296
PERCENT:6.298521
PERCENT:6.352899
PERCENT:6.395819
PERCENT:6.423500
PERCENT:6.466389
PERCENT:6.512131
PERCENT:6.545339
PERCENT:6.606682
PERCENT:6.679429
PERCENT:6.731269
PERCENT:6.774930
PERCENT:6.810389
PERCENT:6.839253
PERCENT:6.869015
PERCENT:6.899454
PERCENT:6.931246
PERCENT:6.961008
PERCENT:6.992123
PERCENT:7.021167
PERCENT:7.055696
PERCENT:7.085416
PERCENT:7.120241
PERCENT:7.170761
PERCENT:7.212403
PERCENT:7.268651
PERCENT:7.318632
PERCENT:7.369744
PERCENT:7.417505
PERCENT:7.458164
PERCENT:7.470160
PERCENT:7.475867
PERCENT:7.481638
PERCENT:7.491499
PERCENT:7.500853
PERCENT:7.531027
PERCENT:7.565736
PERCENT:7.605169
PERCENT:7.634698
PERCENT:7.643978
PERCENT:7.658616
PERCENT:7.672662
PERCENT:7.730052
PERCENT:7.760406
PERCENT:7.793488
PERCENT:7.824518
PERCENT:7.858973
PERCENT:7.892022
PERCENT:7.927841
PERCENT:7.968045
PERCENT:8.000407
PERCENT:8.045262
PERCENT:8.094852
PERCENT:8.149515
PERCENT:8.210488
PERCENT:8.273025
PERCENT:8.323418
PERCENT:8.375428
PERCENT:8.427924
PERCENT:8.490250
PERCENT:8.565670
PERCENT:8.627298
PERCENT:8.680439
PERCENT:8.725358
PERCENT:8.787376
PERCENT:8.862871
PERCENT:8.912630
PERCENT:8.966120
PERCENT:9.012793
PERCENT:9.057658
PERCENT:9.096415
PERCENT:9.129918
PERCENT:9.178705
PERCENT:9.227861
PERCENT:9.266333
PERCENT:9.308345
PERCENT:9.361263
PERCENT:9.424857
PERCENT:9.499887
PERCENT:9.545059
PERCENT:9.599288
PERCENT:9.646638
PERCENT:9.692550
PERCENT:9.727226
PERCENT:9.763742
PERCENT:9.810225
PERCENT:9.853104
PERCENT:9.910747
PERCENT:9.951141
PERCENT:9.995256
PERCENT:10.040577
PERCENT:10.083592
PERCENT:10.136913
PERCENT:10.181578
PERCENT:10.206372
PERCENT:10.246799
PERCENT:10.280430
PERCENT:10.328043
PERCENT:10.392324
PERCENT:10.472670
PERCENT:10.533674
PERCENT:10.593759
PERCENT:10.647778
PERCENT:10.717702
PERCENT:10.754556
PERCENT:10.824459
PERCENT:10.888666
PERCENT:10.937548
PERCENT:10.983829
PERCENT:11.017809
PERCENT:11.058732
PERCENT:11.094836
PERCENT:11.126088
PERCENT:11.162361
PERCENT:11.225385
PERCENT:11.275323
PERCENT:11.329130
PERCENT:11.394361
PERCENT:11.471062
PERCENT:11.535733
PERCENT:11.612612
PERCENT:11.682283
PERCENT:11.753645
PERCENT:11.836474
PERCENT:11.894647
PERCENT:11.954995
PERCENT:12.034379
PERCENT:12.098396
PERCENT:12.174778
PERCENT:12.242145
PERCENT:12.303551
PERCENT:12.362283
PERCENT:12.429439
PERCENT:12.483446
PERCENT:12.549735
PERCENT:12.612674
PERCENT:12.679227
PERCENT:12.704836
PERCENT:12.753516
PERCENT:12.795972
PERCENT:12.842898
PERCENT:12.888060
PERCENT:12.936762
PERCENT:12.984745
PERCENT:13.025341
PERCENT:13.073324
PERCENT:13.124553
PERCENT:13.179184
PERCENT:13.215287
PERCENT:13.253325
PERCENT:13.301361
PERCENT:13.356119
PERCENT:13.425706
PERCENT:13.482789
PERCENT:13.537082
PERCENT:13.594757
PERCENT:13.650952
PERCENT:13.692056
PERCENT:13.741434
PERCENT:13.777073
PERCENT:13.818260
PERCENT:13.869943
PERCENT:13.917990
PERCENT:13.958998
PERCENT:13.992628
PERCENT:14.019610
PERCENT:14.045769
PERCENT:14.063990
PERCENT:14.090888
PERCENT:14.122478
PERCENT:14.163212
PERCENT:14.184804
PERCENT:14.211777
PERCENT:14.238241
PERCENT:14.269240
PERCENT:14.299003
PERCENT:14.320542
PERCENT:14.349734
PERCENT:14.381219
PERCENT:14.421297
PERCENT:14.447888
PERCENT:14.476689
PERCENT:14.505807
PERCENT:14.535051
PERCENT:14.565448
PERCENT:14.593667
PERCENT:14.620893
PERCENT:14.648340
PERCENT:14.659987
PERCENT:14.683557
PERCENT:14.708509
PERCENT:14.743028
PERCENT:14.775845
PERCENT:14.804307
PERCENT:14.836828
PERCENT:14.867267
PERCENT:14.896427
PERCENT:14.942888
PERCENT:14.988821
PERCENT:15.033634
PERCENT:15.084059
PERCENT:15.140878
PERCENT:15.192380
PERCENT:15.235977
PERCENT:15.291169
PERCENT:15.336923
PERCENT:15.379177
PERCENT:15.422595
PERCENT:15.457980
PERCENT:15.495701
PERCENT:15.519449
PERCENT:15.534785
PERCENT:15.557276
PERCENT:15.573425
PERCENT:15.596920
PERCENT:15.626196
PERCENT:15.658135
PERCENT:15.709142
PERCENT:15.761205
PERCENT:15.805120
PERCENT:15.837376
PERCENT:15.867783
PERCENT:15.898052
PERCENT:15.938902
PERCENT:15.977246
PERCENT:16.006142
PERCENT:16.039043
PERCENT:16.076828
PERCENT:16.118132
PERCENT:16.166315
PERCENT:16.208761
PERCENT:16.260401
PERCENT:16.312073
PERCENT:16.347237
PERCENT:16.377337
PERCENT:16.408558
PERCENT:16.443066
PERCENT:16.475386
PERCENT:16.508106
PERCENT:16.551186
PERCENT:16.600660
PERCENT:16.654604
PERCENT:16.709595
PERCENT:16.751976
PERCENT:16.792297
PERCENT:16.846622
PERCENT:16.886679
PERCENT:16.951826
PERCENT:17.006182
PERCENT:17.058310
PERCENT:17.087934
PERCENT:17.121290
PERCENT:17.155798
PERCENT:17.180391
PERCENT:17.209425
PERCENT:17.241999
PERCENT:17.272343
PERCENT:17.299536
PERCENT:17.333113
PERCENT:17.365623
PERCENT:17.393675
PERCENT:17.424980
PERCENT:17.464888
PERCENT:17.500750
PERCENT:17.533175
PERCENT:17.563910
PERCENT:17.604324
PERCENT:17.648970
PERCENT:17.701307
PERCENT:17.751530
PERCENT:17.804735
PERCENT:17.848850
PERCENT:17.893927
PERCENT:17.942587
PERCENT:17.991415
PERCENT:18.037951
PERCENT:18.073950
PERCENT:18.126234
PERCENT:18.165962
PERCENT:18.231174
PERCENT:18.296015
PERCENT:18.351259
PERCENT:18.411524
PERCENT:18.452785
PERCENT:18.511623
PERCENT:18.551510
PERCENT:18.591894
PERCENT:18.634487
PERCENT:18.682070
PERCENT:18.732018
PERCENT:18.779251
PERCENT:18.827276
PERCENT:18.874636
PERCENT:18.910814
PERCENT:18.941633
PERCENT:18.978233
PERCENT:19.024231
PERCENT:19.062649
PERCENT:19.106775
PERCENT:19.170019
PERCENT:19.247248
PERCENT:19.300409
PERCENT:19.336979
PERCENT:19.373505
PERCENT:19.413414
PERCENT:19.447910
PERCENT:19.491201
PERCENT:19.525360
PERCENT:19.555799
PERCENT:19.588266
PERCENT:19.622511
PERCENT:19.707962
PERCENT:19.824982
PERCENT:19.909735
PERCENT:20.054043
PERCENT:20.103888
PERCENT:20.145952
PERCENT:20.178747
PERCENT:20.227692
PERCENT:20.276680
PERCENT:20.319410
PERCENT:20.351467
PERCENT:20.396681
PERCENT:20.442551
PERCENT:20.496019
PERCENT:20.552658
PERCENT:20.615185
PERCENT:20.686356
PERCENT:20.741388
PERCENT:20.801294
PERCENT:20.849077
PERCENT:20.884579
PERCENT:20.923313
PERCENT:20.957705
PERCENT:20.989529
PERCENT:21.020643
PERCENT:21.050406
PERCENT:21.080051
PERCENT:21.108461
PERCENT:21.135519
PERCENT:21.164604
PERCENT:21.194366
PERCENT:21.223822
PERCENT:21.258045
PERCENT:21.295290
PERCENT:21.327261
PERCENT:21.364559
PERCENT:21.401478
PERCENT:21.437908
PERCENT:21.472544
PERCENT:21.505508
PERCENT:21.536623
PERCENT:21.566385
PERCENT:21.599033
PERCENT:21.634207
PERCENT:21.669043
PERCENT:21.704512
PERCENT:21.736757
PERCENT:21.769459
PERCENT:21.800499
PERCENT:21.835123
PERCENT:21.866282
PERCENT:21.901127
PERCENT:21.933563
PERCENT:21.971867
PERCENT:21.997908
PERCENT:22.042551
PERCENT:22.086973
PERCENT:22.139690
PERCENT:22.182327
PERCENT:22.233143
PERCENT:22.264711
PERCENT:22.300045
PERCENT:22.332554
PERCENT:22.364134
PERCENT:22.406580
PERCENT:22.425795
PERCENT:22.466696
PERCENT:22.509956
PERCENT:22.549652
PERCENT:22.599918
PERCENT:22.638189
PERCENT:22.686426
PERCENT:22.728470
PERCENT:22.751236
PERCENT:22.756985
PERCENT:22.759405
PERCENT:22.772131
PERCENT:22.788090
PERCENT:22.807770
PERCENT:22.824648
PERCENT:22.840786
PERCENT:22.854769
PERCENT:22.868721
PERCENT:22.887300
PERCENT:22.900841
PERCENT:22.916842
PERCENT:22.935781
PERCENT:22.968842
PERCENT:23.005674
PERCENT:23.040932
PERCENT:23.075714
PERCENT:23.109642
PERCENT:23.144773
PERCENT:23.165932
PERCENT:23.194151
PERCENT:23.226324
PERCENT:23.254236
PERCENT:23.288153
PERCENT:23.315125
PERCENT:23.341314
PERCENT:23.364355
PERCENT:23.415319
PERCENT:23.478796
PERCENT:23.524887
PERCENT:23.562788
PERCENT:23.625019
PERCENT:23.669535
PERCENT:23.733932
PERCENT:23.813126
PERCENT:23.890957
PERCENT:23.949467
PERCENT:24.026896
PERCENT:24.090933
PERCENT:24.151756
PERCENT:24.224335
PERCENT:24.296648
PERCENT:24.362429
PERCENT:24.422874
PERCENT:24.487377
PERCENT:24.552755
PERCENT:24.612396
PERCENT:24.678051
PERCENT:24.753504
PERCENT:24.815861
PERCENT:24.870344
PERCENT:24.910707
PERCENT:24.940956
PERCENT:24.980379
PERCENT:25.021873
PERCENT:25.060345
PERCENT:25.115503
PERCENT:25.190819
PERCENT:25.246031
PERCENT:25.311855
PERCENT:25.377510
PERCENT:25.432257
PERCENT:25.482269
PERCENT:25.537006
PERCENT:25.600801
PERCENT:25.676252
PERCENT:25.734795
PERCENT:25.759695
PERCENT:25.795122
PERCENT:25.824356
PERCENT:25.860365
PERCENT:25.880753
PERCENT:25.925852
PERCENT:25.967735
PERCENT:26.007740
PERCENT:26.057795
PERCENT:26.114603
PERCENT:26.180586
PERCENT:26.247742
PERCENT:26.299942
PERCENT:26.359846
PERCENT:26.407354
PERCENT:26.450750
PERCENT:26.497423
PERCENT:26.556948
PERCENT:26.600239
PERCENT:26.659426
PERCENT:26.726591
PERCENT:26.801188
PERCENT:26.851063
PERCENT:26.885750
PERCENT:26.924423
PERCENT:26.969509
PERCENT:26.999853
PERCENT:27.047415
PERCENT:27.092861
PERCENT:27.109295
PERCENT:27.152153
PERCENT:27.203371
PERCENT:27.251026
PERCENT:27.301006
PERCENT:27.339531
PERCENT:27.381226
PERCENT:27.426853
PERCENT:27.513287
PERCENT:27.579679
PERCENT:27.617992
PERCENT:27.653282
PERCENT:27.682951
PERCENT:27.712923
PERCENT:27.759142
PERCENT:27.827208
PERCENT:27.871777
PERCENT:27.915215
PERCENT:27.970638
PERCENT:28.020599
PERCENT:28.066351
PERCENT:28.134796
PERCENT:28.186817
PERCENT:28.270164
PERCENT:28.332289
PERCENT:28.382683
PERCENT:28.415890
PERCENT:28.473925
PERCENT:28.538914
PERCENT:28.601091
PERCENT:28.666546
PERCENT:28.725584
PERCENT:28.779697
PERCENT:28.833038
PERCENT:28.891273
PERCENT:28.924736
PERCENT:28.975245
PERCENT:29.027763
PERCENT:29.074520
PERCENT:29.130630
PERCENT:29.208450
PERCENT:29.275236
PERCENT:29.328926
PERCENT:29.393091
PERCENT:29.454836
PERCENT:29.538458
PERCENT:29.597961
PERCENT:29.638641
PERCENT:29.673275
PERCENT:29.713671
PERCENT:29.763716
PERCENT:29.832762
PERCENT:29.885555
PERCENT:29.938517
PERCENT:29.991171
PERCENT:30.042643
PERCENT:30.103878
PERCENT:30.147993
PERCENT:30.201569
PERCENT:30.260754
PERCENT:30.319719
PERCENT:30.371147
PERCENT:30.421413
PERCENT:30.466501
PERCENT:30.514475
PERCENT:30.561897
PERCENT:30.602249
PERCENT:30.649134
PERCENT:30.692341
PERCENT:30.749752
PERCENT:30.803410
PERCENT:30.864868
PERCENT:30.925852
PERCENT:31.003471
PERCENT:31.067118
PERCENT:31.131071
PERCENT:31.198364
PERCENT:31.263998
PERCENT:31.334694
PERCENT:31.389822
PERCENT:31.448341
PERCENT:31.506069
PERCENT:31.567497
PERCENT:31.624443
PERCENT:31.684803
PERCENT:31.743587
PERCENT:31.784817
PERCENT:31.830286
PERCENT:31.868820
PERCENT:31.916666
PERCENT:31.988419
PERCENT:32.054432
PERCENT:32.115871
PERCENT:32.147610
PERCENT:32.160366
PERCENT:32.163452
PERCENT:32.171116
PERCENT:32.182297
PERCENT:32.217102
PERCENT:32.269154
PERCENT:32.296452
PERCENT:32.357258
PERCENT:32.430584
PERCENT:32.517673
PERCENT:32.580791
PERCENT:32.621544
PERCENT:32.656391
PERCENT:32.664772
PERCENT:32.666801
PERCENT:32.668007
PERCENT:32.668957
PERCENT:32.706509
PERCENT:32.719318
PERCENT:32.770813
PERCENT:32.787045
PERCENT:32.806248
PERCENT:32.813194
PERCENT:32.819702
PERCENT:32.825687
PERCENT:32.838665
PERCENT:32.854813
PERCENT:32.864243
PERCENT:32.872780
PERCENT:32.898041
PERCENT:32.928005
PERCENT:32.956585
PERCENT:32.972816
PERCENT:32.988605
PERCENT:33.010189
PERCENT:33.018559
PERCENT:33.035564
PERCENT:33.059101
PERCENT:33.086552
PERCENT:33.097893
PERCENT:33.124199
PERCENT:33.147110
PERCENT:33.163864
PERCENT:33.195168
PERCENT:33.220978
PERCENT:33.241596
PERCENT:33.264721
PERCENT:33.294590
PERCENT:33.324471
PERCENT:33.353355
PERCENT:33.386448
PERCENT:33.416260
PERCENT:33.446056
PERCENT:33.477909
PERCENT:33.504871
PERCENT:33.534760
PERCENT:33.565762
PERCENT:33.596272
PERCENT:33.627441
PERCENT:33.657055
PERCENT:33.687019
PERCENT:33.718513
PERCENT:33.752598
PERCENT:33.781483
PERCENT:33.811935
PERCENT:33.840355
PERCENT:33.869503
PERCENT:33.899021
PERCENT:33.932949
PERCENT:33.963165
PERCENT:33.991344
PERCENT:34.018093
PERCENT:34.064331
PERCENT:34.114388
PERCENT:34.171207
PERCENT:34.217415
PERCENT:34.222256
PERCENT:34.251995
PERCENT:34.307461
PERCENT:34.364956
PERCENT:34.409367
PERCENT:34.457191
PERCENT:34.504215
PERCENT:34.549431
PERCENT:34.561913
PERCENT:34.563107
PERCENT:34.572544
PERCENT:34.585690
PERCENT:34.602940
PERCENT:34.607708
PERCENT:34.609123
PERCENT:34.618614
PERCENT:34.644012
PERCENT:34.692799
PERCENT:34.815693
PERCENT:34.852474
PERCENT:34.895164
PERCENT:34.933266
PERCENT:34.973396
PERCENT:35.011475
PERCENT:35.036522
PERCENT:35.052345
PERCENT:35.066116
PERCENT:35.078102
PERCENT:35.085659
PERCENT:35.134701
PERCENT:35.192131
PERCENT:35.223255This chunk of the process looks problematic...
+ echo 'Creating a Base System BOM'
Creating a Base System BOM
/bin/rm ${1}/rawBom.txt > /dev/null 2>&1
+ /bin/rm /tmp/niutemp.ZbrIcFvw/rawBom.txt
/usr/sbin/pkgutil --volume "${sourceVol}" --lsbom com.apple.pkg.BaseSystem > ${1}/rawBom.txt
+ /usr/sbin/pkgutil --volume '/Volumes/Macintosh HD' --lsbom com.apple.pkg.BaseSystem
2011-06-21 14:26:22.185 pkgutil[3344:903] PackageKit: *** Missing bundle identifier: /Volumes/Macintosh HD/Library/Receipts/vpn.pkg
# Look for any files added via a combo or security update
pkgList=`/usr/sbin/pkgutil --volume "${sourceVol}" --group-pkgs "com.apple.dvd-boot.pkg-group"`
/usr/sbin/pkgutil --volume "${sourceVol}" --group-pkgs "com.apple.dvd-boot.pkg-group"
++ /usr/sbin/pkgutil --volume '/Volumes/Macintosh HD' --group-pkgs com.apple.dvd-boot.pkg-group
2011-06-21 14:26:23.417 pkgutil[3345:903] PackageKit: *** Missing bundle identifier: /Volumes/Macintosh HD/Library/Receipts/vpn.pkg
No packages found in group 'com.apple.dvd-boot.pkg-group' on '/Volumes/Macintosh HD'.
The warning from PackageKit indicates that something is possibly wrong with the vpn package.
The next (and larger) problem is the "No packages found in group..." line. This suggests that the volume you are trying to image from (presumably also 10.6.7) was not created using the Combo updater.
I would run the 10.6.7 combo update on "Macintosh HD" and try this again. -
System image utility fails "Unknown error has occurred"
Hi,
I can create disk images from 10.8.3 clients but when i'm putting them through system utility on the 10.8 server it fails after hours of running.
The log is set to debug and shows the image creates upto 83% then jumps to 100% and later shows unknown errors and failed to create image from restore souce.
I've created several disk images and saved them to different locations on the server as the source and final image.
Below i've put in the debug log. Someone please help!!
Workflow Started (2012-01-02 13:56:58 +0000)
OS X Server 10.8.3 (12D78), System Image Utility 10.8.3 (624)
Starting action: Define Image Source (1.4)
Finished running action: Define Image Source
Starting action: Create Image (1.7.2)
Starting image creation process...
Create NetRestore Image
Initiating NetRestore from installed volume.
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
imageFormatKey="UDZO"
++ imageFormatKey=UDZO
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
potentialRecoveryDevice="disk3s3"
++ potentialRecoveryDevice=disk3s3
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
destPath="/Volumes/Macintosh HD/Library/NetBoot/NetBootSP0/NetRestore of Macintosh 10-8_2.nbi"
++ destPath='/Volumes/Macintosh HD/Library/NetBoot/NetBootSP0/NetRestore of Macintosh 10-8_2.nbi'
skipReorderingKey="0"
++ skipReorderingKey=0
sourceVol="/Volumes/Macintosh HD 1"
++ sourceVol='/Volumes/Macintosh HD 1'
postInstallHelperKey="1"
++ postInstallHelperKey=1
. "${1}/createCommon.sh"
+ . /tmp/niutemp.YPRmigsL/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright © 2007-2012 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 volume whose local node database to modify
# $2 long name
# $3 short name
# $4 isAdminUser key
# $5 password data
# $6 password hint
# $7 user picture path
# $8 Language string
local databasePath="/Local/Default/Users/${3}"
local targetVol="${1}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -search /Local/Default/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -create $databasePath
if [ $? != 0 ]; then
echo "Failed to create '${databasePath}'."
return 1
fi
# Add long name
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${2}"
if [ $? != 0 ]; then
echo "Failed to set the RealName."
return 1
fi
# Set up the users group information
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20
if [ $? != 0 ]; then
echo "Failed to set the PrimaryGroupID."
return 1
fi
# Add some additional stuff if the user is an admin
if [ "${4}" == 1 ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/admin" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the admin group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserveradm" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserveradm group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserverusr" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserverusr group."
return 1
fi
fi
# Add UniqueID
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i}
if [ $? != 0 ]; then
echo "Failed to set the UniqueID."
return 1
fi
# Add Home Directory entry
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath NFSHomeDirectory /Users/${3}
if [ $? != 0 ]; then
echo "Failed to set the NFSHomeDirectory."
fi
if [ "${6}" != "" ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath AuthenticationHint "${6}"
if [ $? != 0 ]; then
echo "Failed to set the AuthenticationHint."
return 1
fi
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${7}"
if [ $? != 0 ]; then
echo "Failed to set the picture."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -passwd $databasePath "${5}"
if [ $? != 0 ]; then
echo "Failed to set the passwd."
return 1
fi
# Add shell
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash"
if [ $? != 0 ]; then
echo "Failed to set the UserShell."
return 1
fi
# Create Home directory
if [ -e "/System/Library/User Template/${8}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${8}.lproj/" "${targetVol}/Users/${3}"
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${targetVol}/Users/${3}"
fi
if [ $? != 0 ]; then
echo "Failed to copy the User Template."
return 1
fi
/usr/sbin/chown -R $i:$i "${targetVol}/Users/${3}"
if [ $? != 0 ]; then
echo "Failed to set ownership on the User folder."
return 1
fi
# Copies a list of files (full paths contained in the file at $1) from source to the path specified in $2
CopyEntriesFromFileToPath()
local theFile="$1"
local theDest="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${theDest}/${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/Packages/${SUB_PATH}${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Create an installer package in ${1} wrapping the supplied script ${2}
CreateInstallPackageForScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local entryDir=`pwd`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script ${scriptName}"
opt="-v"
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/${scriptName}.pkg/Contents/Resources" || return 1
/bin/mkdir $opt "${tempDir}/emptyDir" || return 1
# Create Archive.pax.gz
cd "${tempDir}/emptyDir"
/bin/pax -w -x cpio -f "${tempDir}/${scriptName}.pkg/Contents/Archive.pax" .
/usr/bin/gzip "${tempDir}/${scriptName}.pkg/Contents/Archive.pax"
cd "${entryDir}"
# Create the Archive.bom file
/usr/bin/mkbom "${tempDir}/emptyDir/" "${tempDir}/${scriptName}.pkg/Contents/Archive.bom" || return 1
# Create the Info.plist
/bin/cat > "${tempDir}/${scriptName}.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.SystemImageUtility.${scriptName}</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "${tempDir}/${scriptName}.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "${tempDir}/${scriptName}.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "${tempDir}/${scriptName}.pkg/Contents/Resources/postflight"
# clean up
/bin/rm -r "${tempDir}/emptyDir"
return 0
# Validate or create the requested directory
CreateOrValidatePath()
local targetDir="$1"
if [ ! -d "${targetDir}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${targetDir}"
fi
/bin/mkdir -p "${targetDir}" || return 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
# $1 volume whose local node database to modify
local count="${#userFullName[*]}"
local targetVol="${1}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${targetVol}" "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassword[$index]}" "${userPassHint[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
if [ $? != 0 ]; then
echo "Failed to create the User '${userUnixName[$index]}'."
return 1
fi
#suppress the Apple ID request
DisableAppleIDRequestForUser "${targetVol}" "${userUnixName[$index]}"
done
# "touch"
/usr/bin/touch "${targetVol}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${targetVol}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
local theMount="${1}"
local mountLoc=`mount | grep "${theMount}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${theMount}"
fi
fi
# Finally detach the mount (if it's actually mounted) and dispose the mountPoint directory
if [ "${mountLoc}" != "" ]; then
/usr/bin/hdiutil detach "${theMount}" || retry_hdiutil_detach "${theMount}" || return 1
fi
/bin/rmdir "${theMount}" || return 1
return 0
# Turn off the Apple ID request that happens on first boot after installing the OS
DisableAppleIDRequestForUser()
local targetUserLib="${1}/Users/${2}/Library"
# Only do this if the file doesn't exist
if [ ! -e "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Disabling Apple ID request for user '${2}'"
fi
/usr/libexec/PlistBuddy -c "Add :DidSeeCloudSetup bool 1" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :LastSeenCloudProductVersion string 10.8" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
fi
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
opt="-v"
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${targetVol}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
return 0
# If any exist, install configuration profiles to the install image
InstallConfigurationProfiles()
local tempDir="${1}"
local targetVol="${2}"
local profilesDir="${targetVol}/var/db/ConfigurationProfiles"
if [ -e "${tempDir}/configProfiles.txt" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Configuration Profiles"
fi
/bin/mkdir -p "${profilesDir}/Setup" || return 1
# Make sure the perms are correct
/usr/sbin/chown root:wheel "${profilesDir}"
/bin/chmod 755 "${profilesDir}"
/usr/sbin/chown root:wheel "${profilesDir}/Setup"
/bin/chmod 755 "${profilesDir}/Setup"
/usr/bin/touch "${profilesDir}/.profilesAreInstalled"
CopyEntriesFromFileToPath "${tempDir}/configProfiles.txt" "${profilesDir}/Setup" || return 1
# Enable MCX debugging
if [ 1 == 1 ]; then
if [ -e "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" ]; then
/usr/libexec/PlistBuddy -c "Delete :debugOutput" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Delete :collateLogs" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
/usr/libexec/PlistBuddy -c "Add :debugOutput string -2" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :collateLogs string 1" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in $3
InstallScriptsFromFile()
local tempDir="${1}"
local theFile="${2}"
local targetDir="${3}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
CreateInstallPackageForScript "$tempDir" "${FILE}" || return 1
# copy the resulting package to the Packages directory
local leafName=`basename "${FILE}"`
/usr/bin/ditto $opt "${tempDir}/${leafName}.pkg" "${targetDir}/${leafName}.pkg" || return 1
# clean up
/bin/rm -r "${tempDir}/${leafName}.pkg"
fi
done < "${theFile}"
return 0
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="${1}"
local destDir="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
opt="-v"
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
if [ $? != 0 ]; then
echo "Failed to detach and clean up the mount at '${mountPoint}'."
return 1
fi
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -e "$srcVol/private/var/vm/sleepimage" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing sleepimage on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/sleepimage"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*" > /dev/null 2>&1
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*" > /dev/null 2>&1
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
opt="-v"
fi
# Insure the kext cache on our source volume (the boot shell) is up to date
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Updating kext cache on source volume"
fi
/usr/sbin/kextcache -update-volume "${srcDir}" || return 1
# Copy the i386 and, if it exists, the x86_64 architecture
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing the kext cache to the boot image"
fi
# make sure this doesn't exist
if [ -e "${destDir}/i386" ]; then
/bin/rm -rf "${destDir}/i386"
fi
# Install kextcaches to the nbi folder
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating a kernelcache for the boot shell"
fi
/bin/mkdir -p $opt "${destDir}/i386/x86_64" || return 1
/usr/sbin/kextcache -arch x86_64 -L -N -S -z -K "${srcDir}/mach_kernel" -c "${destDir}/i386/x86_64/kernelcache" "${srcDir}/System/Library/Extensions" || return 1I am seeing a very similar output trying to make a netrestore image of a 10.8.4 Macbook Air on a 10.8.4 Mac Mini running OSX Server. Gets to 84% and then shows the -1 progress and then just hangs until I cancel it (I haven't tried leaving it over night but left it that way for hours).
Did you ever figure out what was going on or have a workaround to create an image?
Thanks! -
System Image Utility always fails, why?
Hi everyone,
on my clean and fresh install of 10.7.4 Server the System Image Utility always fails to create an image. I want to create a NetInstall image and have put the OS X Lion Installer in /Applications. I can select it in SIU and choose to create a NetInstall image. It asks for the admin pw and always presents an error at the very end: Image creation failed. An unknown error has occured.
If I select to create a NetBoot image instead it fails directly after clicking on the Create button with this slightly different message: Image creation failed. An error has occured. At least it’s no unknown error…
Any ideas what might be causing this? I have succesfully created NetInstall images with 10.6 Server and 10.8 Server, but 10.7 Server somehow won’t play nice.
Thanks
BjörnHi Brian,
I first deleted the Installer and redownloaded it from the App Store, just to make sure there was no problem with it. Even though I now have the 10.7.4 Installer (had 10.7.0 before) nothing has changed. I then went on to set the log level as suggested. I now get different errors based on the chosen log level.
Log level set to debug:
Image creation failed.
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
Log level set to verbose:
Image creation failed.
An unknown error has occurred.
I did not see anything helpful in the logs unfortunately. The only noticeable thing mentioned was: Failed to create image from installer media.
Any additional ideas? I will attach both logs here, just in case.
VERBOSE LOG:
Starting image creation.
Workflow Started (2012-09-08 14:08:00 +0200)
Mac OS X Server 10.7.4 (11E53), System Image Utility 10.7.3 (543)
Starting action: Define Image Source (1.3)
Finished running action: Define Image Source
Starting action: Create Image (1.6.2)
Starting image creation process...
Create NetInstall Image
Initiating NetInstall from Installer media.
Creating working path at /Users/vm/Desktop/NetInstall of Install Mac OS X Lion
Creating disk image (Size: 4062 MB)
Finalizing disk image.
created: /Users/vm/Desktop/NetInstall of Install Mac OS X Lion/NetInstall.dmg
Attaching disk image
Copying /Volumes/Mac OS X Install ESD
Preparing the kernel and boot loader for the boot image
/Users/vm/Desktop/NetInstall of Install Mac OS X Lion/i386
/Users/vm/Desktop/NetInstall of Install Mac OS X Lion/i386/x86_64
Copying /Volumes/Mac OS X Install ESD/boot.efi
Copying /Volumes/Mac OS X Install ESD/System/Library/CoreServices/PlatformSupport.plist
Performing post install cleanup
Detaching disk image
"disk4" unmounted.
"disk4" ejected.
Correcting permissions. 501:20 /Users/vm/Desktop/NetInstall of Install Mac OS X Lion
Script is done.
Failed to create image from installer media.
An unknown error has occurred.
NetInstall creation failed.
Image creation process finished...
Stopping image creation.
Image creation failed.
DEBUG LOG:
Starting image creation.
Workflow Started (2012-09-08 13:59:22 +0200)
Mac OS X Server 10.7.4 (11E53), System Image Utility 10.7.3 (543)
Starting action: Define Image Source (1.3)
Finished running action: Define Image Source
Starting action: Create Image (1.6.2)
Starting image creation process...
Create NetInstall Image
Initiating NetInstall from Installer media.
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
destVolFSType="HFS+"
++ destVolFSType=HFS+
installSource="/Volumes/Mac OS X Install ESD"
++ installSource='/Volumes/Mac OS X Install ESD'
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
destPath="/Users/vm/Desktop/NetInstall of Install Mac OS X Lion"
++ destPath='/Users/vm/Desktop/NetInstall of Install Mac OS X Lion'
dmgVolName="NetInstall"
++ dmgVolName=NetInstall
. "${1}/createCommon.sh"
+ . /tmp/niutemp.Yv8Z6Mqx/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright © 2007-2011 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 volume whose local node database to modify
# $2 long name
# $3 short name
# $4 isAdminUser key
# $5 password data
# $6 password hint
# $7 user picture path
# $8 Language string
local databasePath="/Local/Default/Users/${3}"
local targetVol="${1}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -search /Local/Default/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -create $databasePath
if [ $? != 0 ]; then
echo "Failed to create '${databasePath}'."
return 1
fi
# Add long name
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${2}"
if [ $? != 0 ]; then
echo "Failed to set the RealName."
return 1
fi
# Add PrimaryGroupID
if [ "${4}" == 1 ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 80
else
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20
fi
if [ $? != 0 ]; then
echo "Failed to set the PrimaryGroupID."
return 1
fi
# Add UniqueID
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i}
if [ $? != 0 ]; then
echo "Failed to set the UniqueID."
return 1
fi
# Add Home Directory entry
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath NFSHomeDirectory /Users/${3}
if [ $? != 0 ]; then
echo "Failed to set the NFSHomeDirectory."
fi
if [ "${6}" != "" ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath AuthenticationHint "${6}"
if [ $? != 0 ]; then
echo "Failed to set the AuthenticationHint."
return 1
fi
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${7}"
if [ $? != 0 ]; then
echo "Failed to set the picture."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -passwd $databasePath "${5}"
if [ $? != 0 ]; then
echo "Failed to set the passwd."
return 1
fi
# Add shell
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash"
if [ $? != 0 ]; then
echo "Failed to set the UserShell."
return 1
fi
# Create Home directory
if [ -e "/System/Library/User Template/${8}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${8}.lproj/" "${targetVol}/Users/${3}"
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${targetVol}/Users/${3}"
fi
if [ $? != 0 ]; then
echo "Failed to copy the User Template."
return 1
fi
/usr/sbin/chown -R $i:$i "${targetVol}/Users/${3}"
if [ $? != 0 ]; then
echo "Failed to set ownership on the User folder."
return 1
fi
# Copies a list of files (full paths contained in the file at $1) from source to the path specified in $2
CopyEntriesFromFileToPath()
local theFile="$1"
local theDest="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${theDest}/${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/Packages/${SUB_PATH}${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Create an installer package in ${1} wrapping the supplied script ${2}
CreateInstallPackageForScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local entryDir=`pwd`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script ${scriptName}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/${scriptName}.pkg/Contents/Resources" || return 1
/bin/mkdir $opt "${tempDir}/emptyDir" || return 1
# Create Archive.pax.gz
cd "${tempDir}/emptyDir"
/bin/pax -w -x cpio -f "${tempDir}/${scriptName}.pkg/Contents/Archive.pax" .
/usr/bin/gzip "${tempDir}/${scriptName}.pkg/Contents/Archive.pax"
cd "${entryDir}"
# Create the Archive.bom file
/usr/bin/mkbom "${tempDir}/emptyDir/" "${tempDir}/${scriptName}.pkg/Contents/Archive.bom" || return 1
# Create the Info.plist
/bin/cat > "${tempDir}/${scriptName}.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.server.SystemImageUtility.${scriptName}</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "${tempDir}/${scriptName}.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "${tempDir}/${scriptName}.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "${tempDir}/${scriptName}.pkg/Contents/Resources/postflight"
# clean up
/bin/rm -r "${tempDir}/emptyDir"
return 0
# Validate or create the requested directory
CreateOrValidatePath()
local targetDir="$1"
if [ ! -d "${targetDir}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${targetDir}"
fi
/bin/mkdir -p "${targetDir}" || return 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
# $1 volume whose local node database to modify
local count="${#userFullName[*]}"
local targetVol="${1}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${targetVol}" "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassword[$index]}" "${userPassHint[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
if [ $? != 0 ]; then
echo "Failed to create the User '${userUnixName[$index]}'."
return 1
fi
done
# "touch"
/usr/bin/touch "${targetVol}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${targetVol}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
local theMount="${1}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${theMount}"
fi
fi
# Finally detach the image and dispose the mountPoint directory
/usr/bin/hdiutil detach "${theMount}" || retry_hdiutil_detach "${theMount}" || return 1
/bin/rmdir "${theMount}" || return 1
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${targetVol}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
return 0
# If any exist, install configuration profiles to the install image
InstallConfigurationProfiles()
local tempDir="${1}"
local targetVol="${2}"
local profilesDir="${targetVol}/var/db/ConfigurationProfiles"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/configProfiles.txt" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Configuration Profiles"
fi
/bin/mkdir -p "${profilesDir}/Setup" || return 1
# Make sure the perms are correct
/usr/sbin/chown root:wheel "${profilesDir}"
/bin/chmod 755 "${profilesDir}"
/usr/sbin/chown root:wheel "${profilesDir}/Setup"
/bin/chmod 755 "${profilesDir}/Setup"
/usr/bin/touch "${profilesDir}/.profilesAreInstalled"
CopyEntriesFromFileToPath "${tempDir}/configProfiles.txt" "${profilesDir}/Setup" || return 1
# Enable MCX debugging
if [ 1 == 1 ]; then
if [ -e "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" ]; then
/usr/libexec/PlistBuddy -c "Delete :debugOutput" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Delete :collateLogs" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
/usr/libexec/PlistBuddy -c "Add :debugOutput string -2" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :collateLogs string 1" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in $3
InstallScriptsFromFile()
local tempDir="${1}"
local theFile="${2}"
local targetDir="${3}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
CreateInstallPackageForScript "$tempDir" "${FILE}" || return 1
# copy the resulting package to the Packages directory
local leafName=`basename "${FILE}"`
/usr/bin/ditto $opt "${tempDir}/${leafName}.pkg" "${targetDir}/${leafName}.pkg" || return 1
# clean up
/bin/rm -r "${tempDir}/${leafName}.pkg"
fi
done < "${theFile}"
return 0
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="${1}"
local destDir="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
if [ $? != 0 ]; then
echo "Failed to detach and clean up the mount at '${mountPoint}'."
return 1
fi
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for t /bin/rmdir "${theMount}" || return 1
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexmountPoint=`mktemp -d "/tmp/mnt.XXXXXXXX"`
errExit()
echo "Execution of '`basename ${0}`' failed. Cleaning up."
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
/bin/rm -r "${destPath}"
exit 1
# Set up for script debugging
debug_opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
debug_opt="-v"
fi
# Prepare the destination
CreateOrValidatePath "$destPath" || errExit
# update progress information
echo "${progressPrefix}_creatingImage_"
if [ -e "${installSource}/BaseSystem.dmg" ]; then
size=$2
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating disk image (Size: $size MB)"
fi
/usr/bin/hdiutil create "$destPath/$dmgTarget" -megabytes $size -volname "${dmgVolName}" -uid 0 -gid 80 -mode 1775 -layout "SPUD" -fs "$destVolFSType" -stretch 500g -ov -puppetstrings || errExit
echo "${progressPrefix}_copyingSource_"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Attaching disk image"
fi
/usr/bin/hdiutil attach "${destPath}/${dmgTarget}.dmg" -owners on -nobrowse -noautoopen -mountpoint "${mountPoint}" -quiet || errExit
# Copy source Volume base system to
/usr/bin/ditto $debug_opt "${installSource}" "${mountPoint}" || errExit
else
echo "This does not appear to be a Mac OS X Install DVD."
errExit
fi
# If adding any additional packages or scripts
if [ -e "${1}/OSInstall.collection" ]; then
/usr/bin/ditto $debug_opt "${1}/OSInstall.collection" "${mountPoint}/Packages/OSInstall.collection" || errExit
/usr/sbin/chown root:wheel "${mountPoint}/Packages/OSInstall.collection"
# If adding any additional packages
if [ -e "${1}/additionalPackages.txt" ]; then
CopyPackagesWithDestinationsFromFile "${1}/additionalPackages.txt" || errExit
fi
# If adding any scripts
if [ -e "${1}/additionalScripts.txt" ]; then
InstallScriptsFromFile "${1}" "${1}/additionalScripts.txt" "${mountPoint}/Packages" || errExit
fi
fi
# If it exists, install the partition data onto the install image
ProcessAutoPartition "${1}" || errExit
# If it exists, install minstallconfig.xml (AutoInstall data) onto the install image
ProcessMinInstall "${1}" || errExit
# update progress information
echo "${progressPrefix}_buildingBooter_"
# Copy kernel and boot loader
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and boot loader for the boot image"
fi
# make sure this doesn't exist
if [ -e "${destPath}/i386" ]; then
/bin/rm -rf "${destPath}/i386"
fi
/bin/mkdir -p $debug_opt "${destPath}/i386/x86_64" || errExit
# copy these directly off the install media
/usr/bin/ditto $debug_opt "${installSource}/boot.efi" "${destPath}/i386/booter" || errExit
/usr/bin/chflags nohidden "${destPath}/i386/booter"
# Grab the relevant portion of the com.apple.Boot.plist
kernelFlags=`/usr/libexec/PlistBuddy -c "print :'Kernel Flags'" "${installSource}/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"`
/usr/libexec/PlistBuddy -c "add :'Kernel Flags' string ${kernelFlags}" "${destPath}/i386/com.apple.Boot.plist" > /dev/null 2>&1
/usr/bin/ditto $debug_opt "${installSource}/System/Library/CoreServices/PlatformSupport.plist" "${destPath}/i386/PlatformSupport.plist" || errExit
# extract the kernel & kernelcache for the boot shell
/usr/bin/lipo -extract i386 "${mountPoint}/kernelcache" -output "${destPath}/i386/kernelcache" || errExit
/usr/bin/lipo -extract x86_64 "${mountPoint}/kernelcache" -output "${destPath}/i386/x86_64/kernelcache" || errExit
# Apply choice changes, if any
if [ -e "${1}/MacOSXInstaller.choiceChanges" ]; then
echo "Copy over package choice selection."
/usr/bin/ditto $debug_opt "${1}/MacOSXInstaller.choiceChanges" "${mountPoint}/Packages/Extras/MacOSXInstaller.choiceChanges"
fi
# update progress information
echo "${progressPrefix}_finishingUp_"
# perform the final cleanup
PostFlightDestination "${1}" "$destPath" || errExit
errExit
Vol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for tPERCENT:0.000000
PERCENT:4.332841
PERCENT:8.985722
PERCENT:12.358444
PERCENT:14.524864
PERCENT:16.617430
PERCENT:19.522402
PERCENT:21.614967
PERCENT:23.535204
PERCENT:26.070902
PERCENT:29.271296
PERCENT:33.111767
PERCENT:38.847858
PERCENT:42.343674
PERCENT:44.707043
PERCENT:46.578041
PERCENT:49.138355
PERCENT:51.772526
PERCENT:55.563763
PERCENT:58.567207
PERCENT:62.210735
PERCENT:64.795670
PERCENT:69.719353
PERCENT:74.741508
PERCENT:77.055641
PERCENT:79.591331
PERCENT:83.013290
PERCENT:85.548988
PERCENT:88.010834
PERCENT:91.728210
PERCENT:97.710487
PERCENT:100.000000
PERCENT:-1.000000
Finalizing disk image.
created: /Users/vm/Desktop/NetInstall of Install Mac OS X Lion/NetInstall.dmg
/bin/rmdir "${theMount}" || return 1
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > Creating working path at /Users/vm/Desktop/NetInstall of Install Mac OS X Lion
Creating disk image (Size: 4062 MB)
/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libex
# update progress information
echo "${progressPrefix}_creatingImage_"
if [ -e "${installSource}/BaseSystem.dmg" ]; then
size=$2
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating disk image (Size: $size MB)"
fi
/usr/bin/hdiutil create "$destPath/$dmgTarget" -megabytes $size -volname "${dmgVolName}" -uid 0 -gid 80 -mode 1775 -layout "SPUD" -fs "$destVolFSType" -stretch 500g -ov -puppetstrings || errExit
echo "${progressPrefix}_copyingSource_"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Attaching disk image"
fi
/usr/bin/hdiutil attach "${destPath}/${dmgTarget}.dmg" -owners on -nobrowse -noautoopen -mountpoint "${mountPoint}" -quiet || errExit
# Copy source Volume base system to
/usr/bin/ditto $debug_opt "${installSource}" "${mountPoint}" || errExit
else
echo "This does not appear to be a Mac OS X Install DVD."
errExit
fi
# If adding any additional packages or scripts
if [ -e "${1}/OSInstall.collection" ]; then
/usr/bin/ditto $debug_opt "${1}/OSInstall.collection" "${mountPoint}/Packages/OSInstall.collection" || errExit
/usr/sbin/chown root:wheel "${mountPoint}/Packages/OSInstall.collection"
# If adding any additional packages
if [ -e "${1}/additionalPackages.txt" ]; then
CopyPackagesWithDestinationsFromFile "${1}/additionalPackages.txt" || errExit
fi
# If adding any scripts
if [ -e "${1}/additionalScripts.txt" ]; then
InstallScriptsFromFile "${1}" "${1}/additionalScripts.txt" "${mountPoint}/Packages" || errExit
fi
fi
# If it exists, install the partition data onto the install image
ProcessAutoPartition "${1}" || errExit
# If it exists, install minstallconfig.xml (AutoInstall data) onto the install image
ProcessMinInstall "${1}" || errExit
# update progress information
echo "${progressPrefix}_buildingBooter_"
# Copy kernel and boot loader
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and boot loader for the boot image"
fi
# make sure this doesn't exist
if [ -e "${destPath}/i386" ]; then
/bin/rm -rf "${destPath}/i386"
fi
/bin/mkdir -p $debug_opt "${destPath}/i386/x86_64" || errExit
# copy these directly off the install media
/usr/bin/ditto $debug_opt "${installSource}/boot.efi" "${destPath}/i386/booter" || errExit
/usr/bin/chflags nohidden "${destPath}/i386/booter"
# Grab the relevant portion of the com.apple.Boot.plist
kernelFlags=`/usr/libexec/PlistBuddy -c "print :'Kernel Flags'" "${installSource}/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"`
/usr/libexec/PlistBuddy -c "add :'Kernel Flags' string ${kernelFlags}" "${destPath}/i386/com.apple.Boot.plist" > /dev/null 2>&1
/usr/bin/ditto $debug_opt "${installSource}/System/Library/CoreServices/PlatformSupport.plist" "${destPath}/i386/PlatformSupport.plist" || errExit
# extract the kernel & kernelcache for the boot shell
/usr/bin/lipo -extract i386 "${mountPoint}/kernelcache" -output "${destPath}/i386/kernelcache" || errExit
/usr/bin/lipo -extract x86_64 "${mountPoint}/kernelcache" -output "${destPath}/i386/x86_64/kernelcache" || errExit
# Apply choice changes, if any
if [ -e "${1}/MacOSXInstaller.choiceChanges" ]; then
echo "Copy over package choice selection."
/usr/bin/ditto $debug_opt "${1}/MacOSXInstaller.choiceChanges" "${mountPoint}/Packages/Extras/MacOSXInstaller.choiceChanges"
fi
# update progress information
echo "${progressPrefix}_finishingUp_"
# perform the final cleanup
PostFlightDestination "${1}" "$destPath" || errExit
rrExit
# Apply choice changes, if any
if [ -e "${1}/MacOSXInstaller.choiceChanges" ]; then
echo "Copy over package choice selection."
/usr/bin/ditto $debug_opt "${1}/MacOSXInstaller.choiceChanges" "${mountPoint}/Packages/Extras/MacOSXInstaller.choiceChanges"
fi
# update progress information
echo "${progressPrefix}_finishingUp_"
# perform the final cleanup
PostFlightDestination "${1}" "$destPath" || errExit
tDestination "${1}" "$destPath" || errExit
errExit
Vol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
Stopping image creation.
Terminating script!
Image creation failed. -
System Image Utility "volume on diskxsx failed to mount"
I've been trying to create a NetRestore image using System Image Utility (SIU) for the past couple of days, but no matter what I do it fails. I was oringally using OSX 10.8.4, but have now upgraded to 10.8.5.
After reading through the logs, I can see SIU fails whilst it's trying to mount the volume. Has anyone else had this issue, and if so, were you able to fix it?
I also noticed the "Create image of /Volume/Macintosh HD/" function stops at 48% instead of 100%. Is that normal?
Below is a copy of the log that SIU produced.
Starting image creation.
Workflow Started (2013-09-24 08:41:36 +0100)
OS X Server 10.8.5 (12F37), System Image Utility 10.8.3 (624)
Starting action: Define Image Source (1.4)
Finished running action: Define Image Source
Starting action: Create Image (1.7.2)
Starting image creation process...
Create NetRestore Image
Initiating NetRestore from installed volume.
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
imageFormatKey="UDZO"
++ imageFormatKey=UDZO
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
potentialRecoveryDevice="disk4s3"
++ potentialRecoveryDevice=disk4s3
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
destPath="/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi"
++ destPath='/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
skipReorderingKey="0"
++ skipReorderingKey=0
sourceVol="/Volumes/Macintosh HD"
++ sourceVol='/Volumes/Macintosh HD'
postInstallHelperKey="1"
++ postInstallHelperKey=1
. "${1}/createCommon.sh"
+ . /tmp/niutemp.rDvE48RI/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright © 2007-2012 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 volume whose local node database to modify
# $2 long name
# $3 short name
# $4 isAdminUser key
# $5 password data
# $6 password hint
# $7 user picture path
# $8 Language string
local databasePath="/Local/Default/Users/${3}"
local targetVol="${1}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -search /Local/Default/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -create $databasePath
if [ $? != 0 ]; then
echo "Failed to create '${databasePath}'."
return 1
fi
# Add long name
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${2}"
if [ $? != 0 ]; then
echo "Failed to set the RealName."
return 1
fi
# Set up the users group information
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20
if [ $? != 0 ]; then
echo "Failed to set the PrimaryGroupID."
return 1
fi
# Add some additional stuff if the user is an admin
if [ "${4}" == 1 ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/admin" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the admin group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserveradm" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserveradm group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserverusr" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserverusr group."
return 1
fi
fi
# Add UniqueID
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i}
if [ $? != 0 ]; then
echo "Failed to set the UniqueID."
return 1
fi
# Add Home Directory entry
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath NFSHomeDirectory /Users/${3}
if [ $? != 0 ]; then
echo "Failed to set the NFSHomeDirectory."
fi
if [ "${6}" != "" ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath AuthenticationHint "${6}"
if [ $? != 0 ]; then
echo "Failed to set the AuthenticationHint."
return 1
fi
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${7}"
if [ $? != 0 ]; then
echo "Failed to set the picture."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -passwd $databasePath "${5}"
if [ $? != 0 ]; then
echo "Failed to set the passwd."
return 1
fi
# Add shell
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash"
if [ $? != 0 ]; then
echo "Failed to set the UserShell."
return 1
fi
# Create Home directory
if [ -e "/System/Library/User Template/${8}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${8}.lproj/" "${targetVol}/Users/${3}"
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${targetVol}/Users/${3}"
fi
if [ $? != 0 ]; then
echo "Failed to copy the User Template."
return 1
fi
/usr/sbin/chown -R $i:$i "${targetVol}/Users/${3}"
if [ $? != 0 ]; then
echo "Failed to set ownership on the User folder."
return 1
fi
# Copies a list of files (full paths contained in the file at $1) from source to the path specified in $2
CopyEntriesFromFileToPath()
local theFile="$1"
local theDest="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${theDest}/${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/Packages/${SUB_PATH}${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Create an installer package in ${1} wrapping the supplied script ${2}
CreateInstallPackageForScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local entryDir=`pwd`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script ${scriptName}"
opt="-v"
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/${scriptName}.pkg/Contents/Resources" || return 1
/bin/mkdir $opt "${tempDir}/emptyDir" || return 1
# Create Archive.pax.gz
cd "${tempDir}/emptyDir"
/bin/pax -w -x cpio -f "${tempDir}/${scriptName}.pkg/Contents/Archive.pax" .
/usr/bin/gzip "${tempDir}/${scriptName}.pkg/Contents/Archive.pax"
cd "${entryDir}"
# Create the Archive.bom file
/usr/bin/mkbom "${tempDir}/emptyDir/" "${tempDir}/${scriptName}.pkg/Contents/Archive.bom" || return 1
# Create the Info.plist
/bin/cat > "${tempDir}/${scriptName}.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.SystemImageUtility.${scriptName}</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "${tempDir}/${scriptName}.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "${tempDir}/${scriptName}.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "${tempDir}/${scriptName}.pkg/Contents/Resources/postflight"
# clean up
/bin/rm -r "${tempDir}/emptyDir"
return 0
# Validate or create the requested directory
CreateOrValidatePath()
local targetDir="$1"
if [ ! -d "${targetDir}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${targetDir}"
fi
/bin/mkdir -p "${targetDir}" || return 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
# $1 volume whose local node database to modify
local count="${#userFullName[*]}"
local targetVol="${1}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${targetVol}" "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassword[$index]}" "${userPassHint[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
if [ $? != 0 ]; then
echo "Failed to create the User '${userUnixName[$index]}'."
return 1
fi
#suppress the Apple ID request
DisableAppleIDRequestForUser "${targetVol}" "${userUnixName[$index]}"
done
# "touch"
/usr/bin/touch "${targetVol}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${targetVol}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
local theMount="${1}"
local mountLoc=`mount | grep "${theMount}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${theMount}"
fi
fi
# Finally detach the mount (if it's actually mounted) and dispose the mountPoint directory
if [ "${mountLoc}" != "" ]; then
/usr/bin/hdiutil detach "${theMount}" || retry_hdiutil_detach "${theMount}" || return 1
fi
/bin/rmdir "${theMount}" || return 1
return 0
# Turn off the Apple ID request that happens on first boot after installing the OS
DisableAppleIDRequestForUser()
local targetUserLib="${1}/Users/${2}/Library"
# Only do this if the file doesn't exist
if [ ! -e "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Disabling Apple ID request for user '${2}'"
fi
/usr/libexec/PlistBuddy -c "Add :DidSeeCloudSetup bool 1" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :LastSeenCloudProductVersion string 10.8" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
fi
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
opt="-v"
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${targetVol}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
return 0
# If any exist, install configuration profiles to the install image
InstallConfigurationProfiles()
local tempDir="${1}"
local targetVol="${2}"
local profilesDir="${targetVol}/var/db/ConfigurationProfiles"
if [ -e "${tempDir}/configProfiles.txt" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Configuration Profiles"
fi
/bin/mkdir -p "${profilesDir}/Setup" || return 1
# Make sure the perms are correct
/usr/sbin/chown root:wheel "${profilesDir}"
/bin/chmod 755 "${profilesDir}"
/usr/sbin/chown root:wheel "${profilesDir}/Setup"
/bin/chmod 755 "${profilesDir}/Setup"
/usr/bin/touch "${profilesDir}/.profilesAreInstalled"
CopyEntriesFromFileToPath "${tempDir}/configProfiles.txt" "${profilesDir}/Setup" || return 1
# Enable MCX debugging
if [ 1 == 1 ]; then
if [ -e "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" ]; then
/usr/libexec/PlistBuddy -c "Delete :debugOutput" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Delete :collateLogs" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
/usr/libexec/PlistBuddy -c "Add :debugOutput string -2" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :collateLogs string 1" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in $3
InstallScriptsFromFile()
local tempDir="${1}"
local theFile="${2}"
local targetDir="${3}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
CreateInstallPackageForScript "$tempDir" "${FILE}" || return 1
# copy the resulting package to the Packages directory
local leafName=`basename "${FILE}"`
/usr/bin/ditto $opt "${tempDir}/${leafName}.pkg" "${targetDir}/${leafName}.pkg" || return 1
# clean up
/bin/rm -r "${tempDir}/${leafName}.pkg"
fi
done < "${theFile}"
return 0
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="${1}"
local destDir="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
opt="-v"
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
if [ $? != 0 ]; then
echo "Failed to detach and clean up the mount at '${mountPoint}'."
return 1
fi
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -e "$srcVol/private/var/vm/sleepimage" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing sleepimage on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/sleepimage"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*" > /dev/null 2>&1
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*" > /dev/null 2>&1
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
opt="-v"
fi
# Insure the kext cache on our source volume (the boot shell) is up to date
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Updating kext cache on source volume"
fi
/usr/sbin/kextcache -update-volume "${srcDir}" || return 1
# Copy the i386 and, if it exists, the x86_64 architecture
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing the kext cache to the boot image"
fi
# make sure this doesn't exist
if [ -e "${destDir}/i386" ]; then
/bin/rm -rf "${destDir}/i386"
fi
# Install kextcaches to the nbi folder
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating a kernelcache for the boot shell"
fi
/bin/mkdir -p $opt "${destDir}/i386/x86_64" || return 1
/usr/sbin/kextcache -arch x86_64 -L -N -S -z -K "${srcDir}/mach_kernel" -c "${destDir}/i386/x86_64/kernelcache" "${srcDir}/System/Library/Extensions" || return 1
# Create the i386 and x86_64 boot loaders on the boot image
PrepareBootLoader()
local srcVol="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing boot loader"
opt="-v"
fi
# Copy the boot.efi to the booter shell
if [ -e "${mountPoint}/System/Library/CoreServices/boot.efi" ]; then
/usr/bin/ditto $opt "${mountPoint}/System/Library/CoreServices/boot.efi" "${destDir}/i386/booter" || return 1
else
/usr/bin/ditto $opt "${srcVol}/System/Library/CoreServices/boot.efi" "${destDir}/i386/booter" || return 1
fi
# Unlock the file so we can change its owner later
chflags nouchg "${destDir}/i386/booter"
# Copy the PlatformSupport.plist file
if [ -e "${mountPoint}/System/Library/CoreServices/PlatformSupport.plist" ]; then
/usr/bin/ditto $opt "${mountPoint}/System/Library/CoreServices/PlatformSupport.plist" "${destDir}/i386/PlatformSupport.plist" || return 1
else
/usr/bin/ditto $opt "${srcVol}/System/Library/CoreServices/PlatformSupport.plist" "${destDir}/i386/PlatformSupport.plist" || return 1
fi
# If it exists, install the partitioning application and data onto the install image
ProcessAutoPartition()
local tempDir="$1"
local opt=""
local targetDir=""
if [ -e "$tempDir/PartitionInfo.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
# Determine if this is an install source, or a restore source
if [ -d "${mountPoint}/Packages" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Partitioning application and data to install image"
fi
targetDir="${mountPoint}/Packages"
elif [ -d "${mountPoint}/System/Installation/Packages" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Partitioning application and data to restore image"
fi
targetDir="${mountPoint}/System/Installation/Packages"
else
echo "There doesn't appear to be either an install or restore source mounted at ${mountPoint}"
return 1
fi
# Create the Extras directory if it doesn't exist
if [ ! -d "${targetDir}/Extras" ]; then
/bin/mkdir "${targetDir}/Extras"
fi
targetDir="${targetDir}/Extras"
/usr/bin/ditto $opt "$tempDir/PartitionInfo.plist" "${targetDir}/PartitionInfo.plist" || return 1
/usr/bin/ditto $opt "$tempDir/AutoPartition.app" "${targetDir}/AutoPartition.app" || return 1
fi
return 0
# If it exists, install the minstallconfig.xml onto the install image
ProcessMinInstall()
local tempDir="$1"
local opt=""
local targetDir="${mountPoint}/Packages/Extras"
if [ -e "$tempDir/minstallconfig.xml" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing minstallconfig.xml to install image"
opt="-v"
fi
/usr/bin/ditto $opt "$tempDir/minstallconfig.xml" "${targetDir}/minstallconfig.xml" || return 1
/usr/sbin/chown root:wheel "${targetDir}/minstallconfig.xml"
/bin/chmod 644 "${targetDir}/minstallconfig.xml"
fi
return 0
# untar the OSInstall.mpkg so it can be modified
untarOSInstallMpkg()
local tempDir="$1"
local opt=""
# we might have already done this, so check for it first
if [ ! -d "${tempDir}/OSInstall_pkg" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "uncompressing OSInstall.mpkg"
opt="-v"
fi
/bin/mkdir "${tempDir}/OSInstall_pkg"
cd "${tempDir}/OSInstall_pkg"
/usr/bin/xar $opt -xf "${mountPoint}/System/Installation/Packages/OSInstall.mpkg"
# make Distribution writeable
/bin/chmod 777 "${tempDir}/OSInstall_pkg"
/bin/chmod 666 "${tempDir}/OSInstall_pkg/Distribution"
fi
# Make a tempdir to mount the image on
mountPoint=`mktemp -d "/tmp/mnt.XXXXXXXX"`
mktemp -d "/tmp/mnt.XXXXXXXX"
++ mktemp -d /tmp/mnt.XXXXXXXX
+ mountPoint=/tmp/mnt.7E4iD6mQ
sourceMount=""
+ sourceMount=
crfsErrExit()
echo "Execution of '`basename \"${0}\"`' failed. Cleaning up."
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
# detach the mounted source, if necessary
if [ "${sourceMount}" != "" ] ; then
DetachAndRemoveMount "${sourceMount}"
fi
# Remove the items we created
/bin/rm -r "$destPath/i386" > /dev/null 2>&1
/bin/rm "$destPath/$dmgTarget.dmg" > /dev/null 2>&1
/bin/rm "$destPath/System.dmg" > /dev/null 2>&1
# Finally, remove the directory IF empty
/bin/rmdir "$destPath"
exit 1
InstallNetBootClientHelper()
local tempDir="${1}"
local destDir="${mountPoint}/Packages/Extras"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${destDir}/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${destDir}/bindingNames.plist"
/bin/chmod 644 "${destDir}/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${destDir}/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${destDir}/sharingNames.plist"
/bin/chmod 644 "${destDir}/sharingNames.plist"
fi
# This is required, make sure it's here
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${destDir}/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${destDir}/NetBootClientHelper"
/bin/chmod 555 "${destDir}/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${destDir}/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${destDir}/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${destDir}/com.apple.NetBootClientHelper.plist"
/usr/bin/ditto $opt "${tempDir}/installClientHelper.sh" "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh" || return 1
/usr/sbin/chown root:wheel "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh"
/bin/chmod 555 "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh"
return 0
InstallBaseSystemToShell()
local baseSystemDMG="${1}"
local shellMount="${2}"
local tempDir=`/usr/bin/dirname "${1}"`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
echo "Copying Base System bits to the boot shell image"
fi
baseMount=`mktemp -d "/tmp/mnt_bs.XXXXXXXX"`
/usr/bin/hdiutil attach "${baseSystemDMG}" -noverify -owners on -nobrowse -noautoopen -mountpoint "${baseMount}" -quiet || return 1
# Copy the boot.efi and SystemVersion.plist out to the shell dmg
/usr/bin/ditto $opt "${baseMount}/System/Library/CoreServices/boot.efi" "${shellMount}/boot.efi" || return 1
chflags nouchg "${shellMount}/boot.efi"
/bin/mkdir -p "${shellMount}/usr/standalone/i386" || return 1
/bin/ln "${shellMount}/boot.efi" "${shellMount}/usr/standalone/i386/boot.efi" || return 1
/bin/mkdir -p "${shellMount}/System/Library/CoreServices" || return 1
/bin/ln "${shellMount}/boot.efi" "${shellMount}/System/Library/CoreServices/boot.efi" || return 1
/usr/bin/ditto $opt "${baseMount}/System/Library/CoreServices/SystemVersion.plist" "${shellMount}/System/Library/CoreServices/SystemVersion.plist" || return 1
# stash some things we need for later
/usr/bin/ditto $opt "${baseMount}/System/Library/Caches/com.apple.kext.caches/Startup/kernelcache" "${tempDir}/kernelcache" || return 1
/usr/bin/ditto $opt "${baseMount}/System/Library/CoreServices/com.apple.recovery.boot/PlatformSuppo rt.plist" "${tempDir}/PlatformSupport.plist" || return 1
# Clean up
/usr/bin/hdiutil detach "${baseMount}" || retry_hdiutil_detach "${baseMount}" || return 1
/bin/rmdir "${baseMount}"
theDmg=`basename "${baseSystemDMG}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Copying ${theDmg} to the boot shell."
fi
/usr/bin/ditto $debug_opt "${baseSystemDMG}" "${shellMount}/${theDmg}"
return 0
# Set up for script debugging
debug_opt=""
+ debug_opt=
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
debug_opt="-v"
fi
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ debug_opt=-v
# Prepare the destination
CreateOrValidatePath "${destPath}" || crfsErrExit
+ CreateOrValidatePath '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
+ local 'targetDir=/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
+ '[' '!' -d '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi' ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating working path at /Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
Creating working path at /Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi
+ /bin/mkdir -p '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
# Source in our image building commands
. "${1}/buildCommands.sh"
+ . /tmp/niutemp.rDvE48RI/buildCommands.sh
'/System/Library/CoreServices/System Image Utility.app/Contents/Library/Automator/Create Image.action/Contents/Resources/asrFromVolume.sh' "/tmp/niutemp.rDvE48RI" "/Volumes/Macintosh HD" "System" || exit 1
++ '/System/Library/CoreServices/System Image Utility.app/Contents/Library/Automator/Create Image.action/Contents/Resources/asrFromVolume.sh' /tmp/niutemp.rDvE48RI '/Volumes/Macintosh HD' System
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
imageFormatKey="UDZO"
++ imageFormatKey=UDZO
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
potentialRecoveryDevice="disk4s3"
++ potentialRecoveryDevice=disk4s3
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
destPath="/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi"
++ destPath='/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
skipReorderingKey="0"
++ skipReorderingKey=0
sourceVol="/Volumes/Macintosh HD"
++ sourceVol='/Volumes/Macintosh HD'
postInstallHelperKey="1"
++ postInstallHelperKey=1
# variables we will need
created_dest="NO"
+ created_dest=NO
afvErrExit()
echo "Execution of '`basename \"${0}\"`' failed. Cleaning up."
# detach the disk and remove the mount folder
if [ "${created_dest}" == "YES" ]; then
/bin/rm -r "${destPath}"
fi
exit 1
retrieveBaseSystemDMG()
local tempDir="${1}"
local opt=""
if [ "${potentialRecoveryDevice}" != "" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Retrieving BaseSystem bits from Recovery HD"
opt="-v"
fi
recoveryMount=`mktemp -d "/tmp/mnt_rp.XXXXXXXX"`
/usr/sbin/diskutil mount readOnly -mountPoint "${recoveryMount}" "${potentialRecoveryDevice}" || return 1
# Now make sure this is what was expected
if [ -e "${recoveryMount}/com.apple.recovery.boot/BaseSystem.dmg" ]; then
/usr/bin/ditto $opt "${recoveryMount}/com.apple.recovery.boot/BaseSystem.dmg" "${tempDir}/BaseSystem.dmg" || return 1
/usr/bin/ditto $opt "${recoveryMount}/com.apple.recovery.boot/BaseSystem.chunklist" "${tempDir}/BaseSystem.chunklist"
fi
/usr/sbin/diskutil unmount "${potentialRecoveryDevice}" || return 1
/bin/rmdir "${recoveryMount}"
fi
return 0
# Insure the working path (dmg destination) exists
if [ ! -d "${destPath}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${destPath}"
fi
/bin/mkdir -p "${destPath}" || afvErrExit
created_dest="YES"
fi
+ '[' '!' -d '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi' ']'
# If the volume source is the boot drive we have an asr:// type source
if [ "${2}" == "/" ]; then
# Create an empty image to skip the ASR volume creation
/usr/bin/touch "${destPath}/${3}.dmg"
# Set aside the needed BaseSystem.dmg
retrieveBaseSystemDMG "${1}" || afvErrExit
fi
+ '[' '/Volumes/Macintosh HD' == / ']'
# Look for an existing System.dmg
if [ ! -e "${destPath}/${3}.dmg" ]; then
# Didn't find one, so create it from volume source
${1}/makeNetRestoreFromItem.sh "${1}" "${2}" "${3}" || afvErrExit
fi
+ '[' '!' -e '/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi/System.dmg' ']'
+ /tmp/niutemp.rDvE48RI/makeNetRestoreFromItem.sh /tmp/niutemp.rDvE48RI '/Volumes/Macintosh HD' System
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
imageFormatKey="UDZO"
++ imageFormatKey=UDZO
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
potentialRecoveryDevice="disk4s3"
++ potentialRecoveryDevice=disk4s3
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
destPath="/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi"
++ destPath='/Users/morgan/Desktop/NetRestore of Macintosh HD_2.nbi'
skipReorderingKey="0"
++ skipReorderingKey=0
sourceVol="/Volumes/Macintosh HD"
++ sourceVol='/Volumes/Macintosh HD'
postInstallHelperKey="1"
++ postInstallHelperKey=1
. "${1}/createCommon.sh"
+ . /tmp/niutemp.rDvE48RI/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright © 2007-2012 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 volume whose local node database to modify
# $2 long name
# $3 short name
# $4 isAdminUser key
# $5 password data
# $6 password hint
# $7 user picture path
# $8 Language string
local databasePath="/Local/Default/Users/${3}"
local targetVol="${1}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -search /Local/Default/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -create $databasePath
if [ $? != 0 ]; then
echo "Failed to create '${databasePath}'."
return 1
fi
# Add long name
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${2}"
if [ $? != 0 ]; then
echo "Failed to set the RealName."
return 1
fi
# Set up the users group information
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20
if [ $? != 0 ]; then
echo "Failed to set the PrimaryGroupID."
return 1
fi
# Add some additional stuff if the user is an admin
if [ "${4}" == 1 ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/admin" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the admin group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserveradm" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserveradm group."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append "/Local/Default/Groups/_appserverusr" GroupMembership "${3}"
if [ $? != 0 ]; then
echo "Failed to add the user to the _appserverusr group."
return 1
fi
fi
# Add UniqueID
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i}
if [ $? != 0 ]; then
echo "Failed to set the UniqueID."
return 1
fi
# Add Home Directory entry
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath NFSHomeDirectory /Users/${3}
if [ $? != 0 ]; then
echo "Failed to set the NFSHomeDirectory."
fi
if [ "${6}" != "" ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath AuthenticationHint "${6}"
if [ $? != 0 ]; then
echo "Failed to set the AuthenticationHint."
return 1
fi
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${7}"
if [ $? != 0 ]; then
echo "Failed to set the picture."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -passwd $databasePath "${5}"
if [ $? != 0 ]; then
echo "Failed to set the passwd."
return 1
fi
# Add shell
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash"
if [ $? != 0 ]; then
echo "Failed to set the UserShell."
return 1
fi
# Create Home directory
if [ -e "/System/Library/User Template/${8}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${8}.lproj/" "${targetVol}/Users/${3}"
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${targetVol}/Users/${3}"
fi
if [ $? != 0 ]; then
echo "Failed to copy the User Template."
return 1
fi
/usr/sbin/chown -R $i:$i "${targetVol}/Users/${3}"
if [ $? != 0 ]; then
echo "Failed to set ownership on the User folder."
return 1
fi
# Copies a list of files (full paths contained in the file at $1) from source to the path specified in $2
CopyEntriesFromFileToPath()
local theFile="$1"
local theDest="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${theDest}/${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/Packages/${SUB_PATH}${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Create an installer package in ${1} wrapping the supplied script ${2}
CreateInstallPackageForScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local entryDir=`pwd`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script ${scriptName}"
opt="-v"
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/${scriptName}.pkg/Contents/Resources" || return 1
/bin/mkdir $opt "${tempDir}/emptyDir" || return 1
# Create Archive.pax.gz
cd "${tempDir}/emptyDir"
/bin/pax -w -x cpio -f "${tempDir}/${scriptName}.pkg/Contents/Archive.pax" .
/usr/bin/gzip "${tempDir}/${scriptName}.pkg/Contents/Archive.pax"
cd "${entryDir}"
# Create the Archive.bom file
/usr/bin/mkbom "${tempDir}/emptyDir/" "${tempDir}/${scriptName}.pkg/Contents/Archive.bom" || return 1
# Create the Info.plist
/bin/cat > "${tempDir}/${scriptName}.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.SystemImageUtility.${scriptName}</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "${tempDir}/${scriptName}.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "${tempDir}/${scriptName}.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "${tempDir}/${scriptName}.pkg/Contents/Resources/postflight"
# clean up
/bin/rm -r "${tempDir}/emptyDir"
return 0
# Validate or create the requested directory
CreateOrValidatePath()
local targetDir="$1"
if [ ! -d "${targetDir}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${targetDir}"
fi
/bin/mkdir -p "${targetDir}" || return 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
# $1 volume whose local node database to modify
local count="${#userFullName[*]}"
local targetVol="${1}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${targetVol}" "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassword[$index]}" "${userPassHint[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
if [ $? != 0 ]; then
echo "Failed to create the User '${userUnixName[$index]}'."
return 1
fi
#suppress the Apple ID request
DisableAppleIDRequestForUser "${targetVol}" "${userUnixName[$index]}"
done
# "touch"
/usr/bin/touch "${targetVol}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${targetVol}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
local theMount="${1}"
local mountLoc=`mount | grep "${theMount}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${theMount}"
fi
fi
# Finally detach the mount (if it's actually mounted) and dispose the mountPoint directory
if [ "${mountLoc}" != "" ]; then
/usr/bin/hdiutil detach "${theMount}" || retry_hdiutil_detach "${theMount}" || return 1
fi
/bin/rmdir "${theMount}" || return 1
return 0
# Turn off the Apple ID request that happens on first boot after installing the OS
DisableAppleIDRequestForUser()
local targetUserLib="${1}/Users/${2}/Library"
# Only do this if the file doesn't exist
if [ ! -e "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Disabling Apple ID request for user '${2}'"
fi
/usr/libexec/PlistBuddy -c "Add :DidSeeCloudSetup bool 1" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :LastSeenCloudProductVersion string 10.8" "${targetUserLib}/Preferences/com.apple.SetupAssistant.plist" > /dev/null 2>&1
fi
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
opt="-v"
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${targetVol}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
return 0
# If any exist, install configuration profiles to the install image
InstallConfigurationProfiles()
local tempDir="${1}"
local targetVol="${2}"
local profilesDir="${targetVol}/var/db/ConfigurationProfiles"
if [ -e "${tempDir}/configProfiles.txt" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Configuration Profiles"
fi
/bin/mkdir -p "${profilesDir}/Setup" || return 1
# Make sure the perms are correct
/usr/sbin/chown root:wheel "${profilesDir}"
/bin/chmod 755 "${profilesDir}"
/usr/sbin/chown root:wheel "${profilesDir}/Setup"
/bin/chmod 755 "${profilesDir}/Setup"
/usr/bin/touch "${profilesDir}/.profilesAreInstalled"
CopyEntriesFromFileToPath "${tempDir}/configProfiles.txt" "${profilesDir}/Setup" || return 1
# Enable MCX debugging
if [ 1 == 1 ]; then
if [ -e "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" ]; then
/usr/libexec/PlistBuddy -c "Delete :debugOutput" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Delete :collateLogs" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
/usr/libexec/PlistBuddy -c "Add :debugOutput string -2" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :collateLogs string 1" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in $3
InstallScriptsFromFile()
local tempDir="${1}"
local theFile="${2}"
local targetDir="${3}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
CreateInstallPackageForScript "$tempDir" "${FILE}" || return 1
# copy the resulting package to the Packages directory
local leafName=`basename "${FILE}"`
/usr/bin/ditto $opt "${tempDir}/${leafName}.pkg" "${targetDir}/${leafName}.pkg" || return 1
# clean up
/bin/rm -r "${tempDir}/${leafName}.pkg"
fi
done < "${theFile}"
return 0
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="${1}"
local destDir="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
opt="-v"
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
if [ $? != 0 ]; then
echo "Failed to detach and clean up the mount at '${mountPoint}'."
return 1
fi
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -e "$srcVol/private/var/vm/sleepimage" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing sleepimage on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/sleepimage"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*" > /dev/null 2>&1
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*" > /dev/null 2>&1
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*" > /dev/null 2>&1
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
opt="-v"
fi
# Insure the kext cache on our source volume (the boot shell) is up to date
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Updating kext cache on source volume"
fi
/usr/sbin/kextcache -update-volume "${srcDir}" || return 1
# Copy the i386 and, if it exists, the x86_64 architecture
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing the kext cache to the boot image"
fi
# make sure this doesn't exist
if [ -e "${destDir}/i386" ]; then
/bin/rm -rf "${destDir}/i386"
fi
# Install kextcaches to the nbi folderAfter running your command, and using the mounted image as my source for creating the NetRestore image, SIU was able to complete the first two steps, but failed on the rest. It was able to complete "Creating Image From Source", and "Preparing Image For Restore", but it fails on "Creating Bootable System".
I've copied and pasted the end of the error log. Any idea what caused the Bootable System from successfully being created?
PERCENT:-1.000000
Finalizing disk image.
created: /Users/morgan/Desktop/30sept.nbi/System.dmg
# Set aside the needed BaseSystem.dmg
retrieveBaseSystemDMG "${1}" || mnrfiErrExit
+ retrieveBaseSystemDMG /tmp/niutemp.3PZq4yzF
+ local tempDir=/tmp/niutemp.3PZq4yzF
+ local opt=
+ '[' disk2s3 '!=' '' ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ opt=-v
+ echo 'Retrieving BaseSystem bits from Recovery HD'
Retrieving BaseSystem bits from Recovery HD
mktemp -d "/tmp/mnt_rp.XXXXXXXX"
++ mktemp -d /tmp/mnt_rp.XXXXXXXX
+ recoveryMount=/tmp/mnt_rp.75pVTRHs
+ /usr/sbin/diskutil mount readOnly -mountPoint /tmp/mnt_rp.75pVTRHs disk2s3
Volume Recovery HD on disk2s3 mounted
+ '[' -e /tmp/mnt_rp.75pVTRHs/com.apple.recovery.boot/BaseSystem.dmg ']'
+ /usr/sbin/diskutil unmount disk2s3
Volume Recovery HD on disk2s3 unmounted
+ /bin/rmdir /tmp/mnt_rp.75pVTRHs
+ return 0
# update progress information
echo "${progressPrefix}_preparingASR_"
+ echo _progress_preparingASR_
# "Scan the image for restore"
asr_opt=""
+ asr_opt=
if [ "${skipReorderingKey}" == 1 ] ; then
asr_opt="--nostream"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Preparing image for restore without multicast reordering"
fi
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Preparing image for restore"
fi
fi
+ '[' 0 == 1 ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Preparing image for restore'
Preparing image for restore
/usr/sbin/asr imagescan --source "${destPath}/${dmgContainer}.dmg" $asr_opt || mnrfiErrExit
+ /usr/sbin/asr imagescan --source /Users/morgan/Desktop/30sept.nbi/System.dmg
Checksumming partition of size 63 blocks...done
Block checksum: ....10....20....30....40....50....60....70....80....90....100
Reordering: ....10....20....30....40....50....60....70....80....90....100asr: successfully scanned image "/Users/morgan/Desktop/30sept.nbi/System.dmg"
# update progress information
echo "${progressPrefix}_creatingInstallSystem_"
+ echo _progress_creatingInstallSystem_
restoreSource="${sourceVol}"
+ restoreSource='/Volumes/Macintosh HD'
# If this is a restore from install media, mount that as our source
if [ "${restoreSource}" == "(installMedia)" ] ; then
sourceMount=`mktemp -d "/tmp/mnt_src.XXXXXXXX"`
/usr/bin/hdiutil attach "${destPath}/System.dmg" -noverify -owners on -nobrowse -noautoopen -mountpoint "${sourceMount}" -quiet || crfsErrExit
restoreSource="${sourceMount}"
fi
+ '[' '/Volumes/Macintosh HD' == '(installMedia)' ']'
# If we don't have a BaseSystem.dmg available to us fail now.
if [ ! -e "${1}/BaseSystem.dmg" ]; then
echo "There is no BaseSystem.dmg (Recovery HD) associated with the source ${restoreSource}."
crfsErrExit
fi
+ '[' '!' -e /tmp/niutemp.3PZq4yzF/BaseSystem.dmg ']'
+ echo 'There is no BaseSystem.dmg (Recovery HD) associated with the source /Volumes/Macintosh HD.'
There is no BaseSystem.dmg (Recovery HD) associated with the source /Volumes/Macintosh HD.
+ crfsErrExit
basename "${0}"
++ basename '/System/Library/CoreServices/System Image Utility.app/Contents/Library/Automator/Create Image.action/Contents/Resources/createRestoreFromSources.sh'
+ echo 'Execution of '\''createRestoreFromSources.sh'\'' failed. Cleaning up.'
Execution of 'createRestoreFromSources.sh' failed. Cleaning up.
+ DetachAndRemoveMount /tmp/mnt.nfN5nVgM
+ local theMount=/tmp/mnt.nfN5nVgM
mount | grep "${theMount}"
++ mount
++ grep /tmp/mnt.nfN5nVgM
+ local mountLoc=
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Detaching disk image'
Detaching disk image
+ '[' DEBUG == DEBUG ']'
+ /usr/sbin/lsof +fg /tmp/mnt.nfN5nVgM
+ '[' '' '!=' '' ']'
+ /bin/rmdir /tmp/mnt.nfN5nVgM
+ return 0
+ '[' '' '!=' '' ']'
+ /bin/rm -r /Users/morgan/Desktop/30sept.nbi/i386
+ /bin/rm /Users/morgan/Desktop/30sept.nbi/NetInstall.dmg
+ /bin/rm /Users/morgan/Desktop/30sept.nbi/System.dmg
+ /bin/rmdir /Users/morgan/Desktop/30sept.nbi
+ exit 1
Script is done.
Bridge exited with status 256
Failed to create image from restore source.
An unknown error has occurred.
An unknown error has occurred.
Image creation process finished...
Stopping image creation.
Image creation failed.
Thanks. -
System Image Utility - universal_boot option only on Intel machines
I'm using System Image Utility on 1.8 GHz PowerPC G5 running Mac OS X Server version 10.5.2. When I try to create a NetBoot image with the standard settings (no customization) and a Mac OS X 10.5 Install DVD, I get the following message:
updatedyld_sharedcache failed: universal_boot option can only be used on intel machines
The rest of the log is below; any help you can provide would be appreciated. Thanks!
Log:
Starting image creation.
Workflow Started (2008-05-16 16:05:27 -0500)
Starting action: Define Image Source
Finished running action: Define Image Source
Starting action: Add User Account
Finished running action: Add User Account
Starting action: Create Image
Starting image creation process...
Create NetBoot Image
created: /Users/[username]/Documents/NetBoot of Mac OS X Install DVD/NetBoot.dmg
installer: Package name is Mac OS X
installer: Installing at base path /tmp/mnt
installer: The install was successful.
updatedyld_sharedcache failed: universal_boot option can only be used on Intel machines
hdiutil: couldn't eject "disk3" - error 49168
"disk3" unmounted.
Script is done.
NetBoot creation failed.
Image creation process finished...
Stopping image creation.
Image creation failed.Here's the contents of the Debug log; I couldn't find where the problem was, but maybe someone can help. (I'm also not sure how to keep the discussion board from translating some of the code to markup). Thanks!
Starting image creation.
Workflow Started (2008-05-19 16:42:42 -0500)
Starting action: Define Image Source
Finished running action: Define Image Source
Starting action: Add User Account
Finished running action: Add User Account
Starting action: Create Image
Starting image creation process...
Create NetBoot Image
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
mountPoint="/tmp/mnt"
++ mountPoint=/tmp/mnt
ownershipInfoKey="1000:20"
++ ownershipInfoKey=1000:20
dmgTarget="NetBoot"
++ dmgTarget=NetBoot
sourceVol="/Volumes/Mac OS X Install DVD"
++ sourceVol='/Volumes/Mac OS X Install DVD'
export CM_BUILD="CM_BUILD"
++ export CM_BUILD=CM_BUILD
++ CM_BUILD=CM_BUILD
userLanguage[0]="English"
++ userLanguage[0]=English
userIsAdmin[0]="1"
++ userIsAdmin[0]=1
userImagePath[0]="/Library/User Pictures/Nature/Cactus.tif"
++ userImagePath[0]='/Library/User Pictures/Nature/Cactus.tif'
export _com_apple_kextd_skiplocks="1"
++ export _com_apple_kextd_skiplocks=1
++ _com_apple_kextd_skiplocks=1
userPassHash[0]="000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000006A29520ED4FE4E8C7DE0930018E9284B1078E0BB4CF77F870000000 000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000"
++ userPassHash[0
]=000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000006A29520ED4FE4E8C7DE0930018E9284B1078E0BB4CF77F870000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000
userFullName[0]="[user full name]"
++ userFullName[0]='[user full name]'
destPath="/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD"
++ destPath='/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
userUnixName[0]="[user short name]"
++ userUnixName[0]=[user short name]
. "$1/createCommon.sh"
+ . /tmp/niutemp.mdOQAzsJ/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright 2007 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 long name
# $2 short name
# $3 isAdminUser key
# $4 password hash
# $5 user picture path
# $6 Language string
local databasePath="/Local/Target/Users/${2}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bi
n/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -search /Local/Target/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -create $databasePath || exit 1
# Add long name
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${1}" || exit 1
# Add PrimaryGroupID
if [ "${3}" == 1 ]; then
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 80 || exit 1
else
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20 || exit 1
fi
# Add UniqueID
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i} || exit 1
# Add Home Directory entry
/usr/bin/dscl -f "${mountP
oint}/var/db/dslocal/nodes/Default" localonly -append $databasePath dsAttrTypeNative:home /Users/${2} || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath authentication_authority ";ShadowHash;" || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${5}" || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath passwd "*" || exit 1
# Add shell
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash" || exit 1
# lookup generated uid
genUID=`/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${2} GeneratedUID` || exit 1
genUID=${genUID:14:36}
# make sure the shadow/hash directory exists
if [ ! -e "${mountPoint}/var/db/shadow/hash" ] ; then
/bin/mkdir -p "${mountPoint}/var/db/shadow/hash" || exit 1
/bin/chmod -R 700 "${mountPoint}/var/
db/shadow" || exit 1
fi
# to copy our password hash in there...
echo "${4}" > "${mountPoint}/var/db/shadow/hash/$genUID"
/bin/chmod 600 "${mountPoint}/var/db/shadow/hash/$genUID" || exit 1
# Create Home directory
if [ -e "/System/Library/User Template/${6}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${6}.lproj/" "${mountPoint}/Users/${2}" || exit 1
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${mountPoint}/Users/${2}" || exit 1
fi
/usr/sbin/chown -R $i:$i "${mountPoint}/Users/${2}" || exit 1
# If they exist, apply any Append.bom changes
ApplyAppendBom()
local tempDir="$1"
local srcVol="$2"
local opt=""
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$tempDir/Append.bom" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Applying Append.bom additions from System Image Utility"
fi
/usr/bin/ditto $opt -bom "$tempDir/Append.bom" "$srcVol" "${mountPoint}" || exit
1
fi
if [ -e "$srcVol/Library/Application Support/Apple/System Image Utility/Append.bom" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Applying Append.bom additions from $srcVol"
fi
/usr/bin/ditto $opt -bom "$srcVol/Library/Application Support/Apple/System Image Utility/Append.bom" "$srcVol" "${mountPoint}" || exit 1
fi
# Copies a list of packages (full paths contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/System/Installation/Packages/${leafName}" || exit 1
fi
done < "
local opt=""
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/System/Installation/Packages/${SUB_PATH}${leafName}" || exit 1
fi
done < "${theFile}"
# Create the dyld shared cache files
CreateDyldCaches()
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating dyld shared cache files"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-debug"
fi
fi
/usr/bin/update_dyld_shared_cache -root "${mountPoint}" -universal_boot -force $opt
# Validate or create the destination directory and mo
unt point
CreateOrValidateDestination()
local destDir="$1"
if [ ! -d "$destDir" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at $destDir"
fi
/bin/mkdir -p "$destDir" || exit 1
fi
# Create mount point
if [ ! -d "${mountPoint}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating mountpoint for in $destDir"
fi
/bin/mkdir -p "${mountPoint}" || exit 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
local count="${#userFullName[*]}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${userFullN
ame[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassHash[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
done
fi
# Create an installer package in /System/Installation/Packages/ wrapping the supplied script
InstallerPackageFromScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script $scriptName"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/$scriptName.pkg/Contents/Resources"
/bin/mkdir $opt "${tempDir}/emptyDir" || exit 1
cd "${tempDir}/emptyDir"
# Create Archive.pax.gz
/bin/pax -w -x cpio -f "$tempDir/$scriptName.pkg/Contents/Archive.pax" .
/usr/bin/gzip "$tempDir/$scriptName.pkg
/Contents/Archive.pax"
# Create the Archive.bom file
/usr/bin/mkbom "$tempDir/emptyDir/" "$tempDir/$scriptName.pkg/Contents/Archive.bom"
# Create the Info.plist
/bin/cat > "$tempDir/$scriptName.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.server.SystemImageUtility.$scriptName</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "$tempDir/$scriptName.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "$tempDir/$scriptName
.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "$tempDir/$scriptName.pkg/Contents/Resources/postflight"
# copy the package to the Packages directory
/usr/bin/ditto $opt "$tempDir/$scriptName.pkg" "${mountPoint}/System/Installation/Packages/$scriptName.pkg" || exit 1
# clean up
/bin/rm -r "$tempDir/emptyDir"
/bin/rm -r "$tempDir/$scriptName.pkg"
# If restoreDSBindings.sh exists, tar up the DS data and install it all onto the install image
InstallLocalDSBindings()
local tempDir="$1"
local niuTempDir="var/tmp/niu"
local scriptDir=${niuTempDir}/postinstall
local opt=""
if [ -e "$tempDir/restoreDSBindings.sh" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service bindings from this computer"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# make the directory if needed
/bin/mkdir -p $opt "${mountPoint}/${scriptDir}" || exit 1
# tar up the Directory
Service settings
/usr/bin/tar $opt -cf "${mountPoint}/${niuTempDir}/DSBindings.tar" /Library/Preferences/DirectoryService/ || exit 1
/usr/bin/ditto $opt "$tempDir/restoreDSBindings.sh" "${mountPoint}/${scriptDir}/restoreDSBindings.sh" || exit 1
# Set the permissions just in case
/usr/sbin/chown root:wheel "${mountPoint}/${scriptDir}/restoreDSBindings.sh"
/bin/chmod 755 "${mountPoint}/${scriptDir}/restoreDSBindings.sh"
# make an installer package out of the script
InstallerPackageFromScript "$tempDir" "$tempDir/restoreDSBindings.sh"
fi
# If it exists, install the PowerManagement.plist onto the install image
InstallPowerManagementPlist()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/com.apple.PowerManagement.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing progress announcer to install image"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/com.app
le.PowerManagement.plist" "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist"
/bin/chmod 644 "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist"
fi
# If it exists, install the InstallerStatusNotifications.bundle and progress emitter onto the install image
InstallProgressPieces()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/InstallerStatusNotifications.bundle" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing progress announcer to install image"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/InstallerStatusNotifications.bundle" "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle" || exit 1
/usr/sbin/chown -R root:wheel "${mountPoint}/System/Lib
rary/CoreServices/InstallerStatusNotifications.bundle"
/bin/chmod 755 "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle"
fi
if [ -e "$tempDir/com.apple.ProgressEmitter.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing status emitter to image"
fi
/usr/bin/ditto $opt "$tempDir/progress_emitter" "${mountPoint}/usr/sbin/progress_emitter" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/usr/sbin/progress_emitter"
/bin/chmod 555 "${mountPoint}/usr/sbin/progress_emitter"
/usr/bin/ditto $opt "$tempDir/com.apple.ProgressEmitter.plist" "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist"
/bin/chmod 644 "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist"
fi
# Converts a list of scripts (full paths contained in the file at $1) into pa
ckages in .../System/Installation/Packages/
InstallScriptsFromFile()
local tempDir="$1"
local theFile="$2"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
InstallerPackageFromScript "$tempDir" "${FILE}"
fi
done < "
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
if [ "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
if [ "${scriptsDebugKey}" == "VERBO
SE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
fi
/usr/bin/hdiutil detach "${mountPoint}" || exit 1
# remove the mount folder
/bin/rmdir "${mountPoint}" || exit 1
# copy the NBImageInfo.plist file
/usr/bin/ditto $opt "$tempDir/NBImageInfo.plist" "$destDir/NBImageInfo.plist" || exit 1
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# rename the folder to .nbi
if [ ! -e "$destDir.nbi" ]; then
/bin/mv $opt "$destDir" "$destDir.nbi" || exit 1
else
local parentDir=`dirname "${destDir}"`
local targetName=`basename "${destDir}"`
for ((i=2; i<1000; i++)); do
if [ ! -e "${parentDir}/${targetName}_$i.nbi" ]; then
/bin/mv $opt "$destDir" "${parentDir}/${targetName}_$i.nbi" || exit 1
break
fi
done
fi
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${
scriptsDebugKey}" == "DEBUG" ]; then
if [ "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; t
hen
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local destDir="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
for ARCH in i386 ppc; do
# Prepare the kernel
/bin/mkdir $opt "$destDir/${ARCH}" || exit 1
/usr/bin/lipo -extract "${ARCH}" "${mountPoint}/mach_kernel" -output "$destDir/${ARCH}/mach.macosx" || exit 1
# Build kext cache
/usr/sbin/kextcache -a ${ARCH} -s -l -n -z -m "$destDir/${ARCH}/mach.macosx.mkext" "${mountPoint}/System/Library/Extensions" || exit 1
done
# Create the PPC and I386 boot loaders on the boot image
PrepareBootLoader()
local srcVol="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}
" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing boot loader"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
if [ -e "${mountPoint}/usr/standalone/ppc/bootx.bootinfo" ]; then
/usr/bin/ditto $opt "${mountPoint}/usr/standalone/ppc/bootx.bootinfo" "$destDir/ppc/booter" || exit 1
/usr/bin/ditto $opt "${mountPoint}/usr/standalone/i386/boot.efi" "$destDir/i386/booter" || exit 1
else
/usr/bin/ditto $opt "$srcVol/usr/standalone/ppc/bootx.bootinfo" "$destDir/ppc/booter" || exit 1
/usr/bin/ditto $opt "$srcVol/usr/standalone/i386/boot.efi" "$destDir/i386/booter" || exit 1
fi
# If it exists, install the partitioning application and data onto the install image
ProcessAutoPartition()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/PartitionInfo.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Partitioning application and data to install image"
if [ "${scriptsDebugKey}" ==
"DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/PartitionInfo.plist" "${mountPoint}/System/Installation/PartitionInfo.plist" || exit 1
/usr/bin/ditto $opt "$tempDir/AutoPartition.app" "${mountPoint}/System/Installation/AutoPartition.app" || exit 1
# Tell the installer to run the Partitioning application
/bin/echo "#!/bin/sh
/System/Installation/AutoPartition.app/Contents/MacOS/AutoPartition" > "${mountPoint}/private/etc/rc.cdrom.postWS"
# Due to the way rc.install sources the script, it needs to be executable
/usr/sbin/chown root:wheel "${mountPoint}/private/etc/rc.cdrom.postWS"
/bin/chmod 755 "${mountPoint}/private/etc/rc.cdrom.postWS"
fi
# If it exists, install the minstallconfig.xml onto the install image
ProcessMinInstall()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/minstallconfig.xml" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing minstallconfig.xml to install image"
if
[ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/minstallconfig.xml" "${mountPoint}/etc/minstallconfig.xml" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/etc/minstallconfig.xml"
/bin/chmod 644 "${mountPoint}/etc/minstallconfig.xml"
fi
# untar the OSInstall.mpkg so it can be modified
untarOSInstallMpkg()
local tempDir="$1"
local opt=""
# we might have already done this, so check for it first
if [ ! -d "${tempDir}/OSInstall_pkg" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "uncompressing OSInstall.mpkg"
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/bin/mkdir "${tempDir}/OSInstall_pkg"
cd "${tempDir}/OSInstall_pkg"
/usr/bin/xar $opt -xf "${mountPoint}/System/Installation/Packages/OSInstall.mpkg"
# make Distribution writeable
/bin/chmod 777 "${tempDir}/OSInstall_pkg"
/bin/chmod 666 "${tempDir}/OSInstall_pkg/Distribution"
fi
handler (
echo "Terminated. Cleaning up. Unmounting $destPath"
/usr/bin/hdiutil detach "${mountPoint}"
/bin/rmdir "${mountPoint}"
/bin/rm -r "$destPath"
exit
trap "handler" TERM INT
+ trap handler TERM INT
# Set up for script debugging
debug_opt=""
+ debug_opt=
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
debug_opt="-v"
fi
+ '[' DEBUG == DEBUG ']'
+ debug_opt=-v
# Prepare the destination
CreateOrValidateDestination "$destPath"
+ CreateOrValidateDestination '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local 'destDir=/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ '[' '!' -d '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD' ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating working path at /Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
Creating working path at /Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD
+ /bin/mkdir -p '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ '[' '!' -d /tmp/mnt ']'
# update progress i
nformation
echo "${progressPrefix}_creatingImage_"
+ echo
# Create the appropriate disk image type
imageExtension="sparseimage"
+ imageExtension=sparseimage
if [ "${imageIsUDIFKey}" == 1 ]; then
tempsize=""
# if installing from DVD, get the max install size, otherwise use the volume size
if [ -e "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" ]; then
/usr/sbin/installer -plist -verbose -pkginfo -pkg "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" > "$1/OSInstall.plist"
tempsize=`/usr/bin/defaults read "$1/OSInstall" Size`
tempsize=$((tempsize/1024))
else
tempsize=`df -m "$sourceVol" | tail -n 1 | awk '{print $3}'`
fi
# Add one percent for safety, 500MB for the dyld caches and 400MB to eliminate the "disk is almost full" message
size=$(($tempsize+$(($tempsize/100))+900))
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating disk image (Size: $size MB)"
fi
# Create and atta
ch disk image
/usr/bin/hdiutil create "$destPath/$dmgTarget" -megabytes $size -volname "$dmgTarget" -uid 0 -gid 80 -mode 1775 -layout "UNIVERSAL CD" -fs HFS+ -stretch 500g -ov || exit 1
imageExtension="dmg"
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating sparse disk image"
fi
/usr/bin/hdiutil create "$destPath/$dmgTarget" -type SPARSE -size 500g -volname "$dmgTarget" -uid 0 -gid 80 -mode 1775 -layout "UNIVERSAL CD" -fs HFS+ -ov || exit 1
fi
+ '[' 1 == 1 ']'
+ tempsize=
+ '[' -e '/Volumes/Mac OS X Install DVD/System/Installation/Packages/OSInstall.mpkg' ']'
+ /usr/sbin/installer -plist -verbose -pkginfo -pkg '/Volumes/Mac OS X Install DVD/System/Installation/Packages/OSInstall.mpkg'
/usr/bin/defaults read "$1/OSInstall" Size
++ /usr/bin/defaults read /tmp/niutemp.mdOQAzsJ/OSInstall Size
+ tempsize=11937692
+ tempsize=11657
+ size=12673
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating disk image (Size: 12673 MB)'
Creating disk image (Size: 12673 MB)
+ /usr/bin/hdiutil create '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/NetBoot' -megabytes 12673 -volname NetBoot -uid 0 -gid 80 -mode 1775 -layout 'UNIVERSAL CD' -fs HFS+ -stretch 500g -ov
created: /Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/NetBoot.dmg
+ imageExtension=dmg
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Attaching disk image"
fi
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Attaching disk image'
Attaching disk image
/usr/bin/hdiutil attach "$destPath/$dmgTarget.$imageExtension" -owners on -nobrowse -mountpoint "${mountPoint}" -quiet || exit 1
+ /usr/bin/hdiutil attach '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/NetBoot.dmg' -owners on -nobrowse -mountpoint /tmp/mnt -quiet
# Copy source Volume base system to
if [ -e "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" ]; then
# update progress information
echo "${progressPrefix}_installingSystem_"
if [ -e "$1/MacOSXInstaller.choiceChanges" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing to destination volume with choice selection."
fi
/usr/sbin/installer -applyChoiceChangesXML "$1/MacOSXInstaller.choiceChanges" -pkg "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" -target "${mountPoint}"
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing to destination volume"
fi
/usr/sbin/installer -pkg "${sourceVol}/System/Installation/Packages/OSInstall.mpkg" -target "${mountPoint}"
fi
# bless the boot folder
/usr/sbin/bless -folder "${mountPoint}/System/Library/CoreServices" -quiet --bootinfo --bootefi
# "kext"
if [ -e "${mountPoint}/System/Library/StartupItems/NetBootSharingNames"
]; then
/bin/chmod 0755 "${mountPoint}/System/Library/StartupItems"
/usr/sbin/chown -R root:wheel "${mountPoint}/System/Library/StartupItems/NetBootSharingNames"
/bin/chmod 0755 "${mountPoint}/System/Library/StartupItems/NetBootSharingNames"
/bin/chmod 0755 "${mountPoint}/System/Library/StartupItems/NetBootSharingNames/NetBootSharingNa mes"
/bin/chmod 0644 "${mountPoint}/System/Library/StartupItems/NetBootSharingNames/StartupParameter s.plist"
fi
if [ ! -d "${mountPoint}/Library/Preferences/DirectoryService" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating DirectoryService directory"
fi
/bin/mkdir $debug_opt "${mountPoint}/Library/Preferences/DirectoryService"
/bin/chmod 0775 "${mountPoint}/Library/Preferences/DirectoryService"
fi
/usr/sbin/kextcache -a i386 -a ppc -l -z -m "${mountPoint}/System/Library/Extensions.mkext" "${mountPoint}/System/Library/Extensions" || exit 1
else
# update progress information
echo "${progressPre
fix}_copyingSource_"
PreCleanSource "$sourceVol"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying source volume"
fi
/usr/bin/ditto $debug_opt "$sourceVol" "${mountPoint}"
fi
+ '[' -e '/Volumes/Mac OS X Install DVD/System/Installation/Packages/OSInstall.mpkg' ']'
+ echo
+ '[' -e /tmp/niutemp.mdOQAzsJ/MacOSXInstaller.choiceChanges ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Installing to destination volume'
Installing to destination volume
+ /usr/sbin/installer -pkg '/Volumes/Mac OS X Install DVD/System/Installation/Packages/OSInstall.mpkg' -target /tmp/mnt
installer: Package name is Mac OS X
installer: Installing at base path /tmp/mnt
installer: The install was successful.
+ /usr/sbin/bless -folder /tmp/mnt/System/Library/CoreServices -quiet --bootinfo --bootefi
+ '[' -e /tmp/mnt/System/Library/StartupItems/NetBootSharingNames ']'
+ '[' '!' -d /tmp/mnt/Library/Preferences/DirectoryService ']'
+ /usr/sbin/kextcache -a i386 -a ppc -l -z -m /tmp/mnt/System/Library/Extensions.mkext /tmp/mnt/System/Library/Extensions
# install the PowerManagement.plist onto the bootable image
InstallPowerManagementPlist "$1"
+ InstallPowerManagementPlist /tmp/niutemp.mdOQAzsJ
+ local tempDir=/tmp/niutemp.mdOQAzsJ
+ local opt=
+ '[' -e /tmp/niutemp.mdOQAzsJ/com.apple.PowerManagement.plist ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Installing progress announcer to install image'
Installing progress announcer to install image
+ '[' DEBUG == DEBUG ']'
+ opt=-v
+ /usr/bin/ditto -v /tmp/niutemp.mdOQAzsJ/com.apple.PowerManagement.plist /tmp/mnt/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plis t
Copying /tmp/niutemp.mdOQAzsJ/com.apple.PowerManagement.plist
+ /usr/sbin/chown root:wheel /tmp/mnt/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plis t
+ /bin/chmod 644 /tmp/mnt/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plis t
# create the dyld caches
CreateDyldCaches
+ CreateDyldCaches
+ local opt=
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating dyld shared cache files'
Creating dyld shared cache files
+ '[' DEBUG == DEBUG ']'
+ opt=-debug
+ /usr/bin/update_dyld_shared_cache -root /tmp/mnt -universal_boot -force -debug
update_dyld_shared_cache failed: universal_boot option can only be used on Intel machines
# If it exists, install the partition data onto the bootable image
ProcessAutoPartition "$1"
+ ProcessAutoPartition /tmp/niutemp.mdOQAzsJ
+ local tempDir=/tmp/niutemp.mdOQAzsJ
+ local opt=
+ '[' -e /tmp/niutemp.mdOQAzsJ/PartitionInfo.plist ']'
# install the progress emitter onto the install image
InstallProgressPieces "$1"
+ InstallProgressPieces /tmp/niutemp.mdOQAzsJ
+ local tempDir=/tmp/niutemp.mdOQAzsJ
+ local opt=
+ '[' -e /tmp/niutemp.mdOQAzsJ/InstallerStatusNotifications.bundle ']'
+ '[' -e /tmp/niutemp.mdOQAzsJ/com.apple.ProgressEmitter.plist ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Insta
lling status emitter to image'
Installing status emitter to image
+ /usr/bin/ditto /tmp/niutemp.mdOQAzsJ/progress_emitter /tmp/mnt/usr/sbin/progress_emitter
+ /usr/sbin/chown root:wheel /tmp/mnt/usr/sbin/progress_emitter
+ /bin/chmod 555 /tmp/mnt/usr/sbin/progress_emitter
+ /usr/bin/ditto /tmp/niutemp.mdOQAzsJ/com.apple.ProgressEmitter.plist /tmp/mnt/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist
+ /usr/sbin/chown root:wheel /tmp/mnt/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist
+ /bin/chmod 644 /tmp/mnt/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist
# update progress information
echo "${progressPrefix}_buildingBooter_"
+ echo
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache "$destPath"
+ PrepareKernelAndKextCache '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local 'destDir=/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local opt=
+ '[' DEBUG == VERBO
SE -o DEBUG == DEBUG ']'
+ echo 'Preparing the kernel and kext cache for the boot image'
Preparing the kernel and kext cache for the boot image
+ '[' DEBUG == DEBUG ']'
+ opt=-v
+ for ARCH in i386 ppc
+ /bin/mkdir -v '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386'
mkdir: created directory '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386'
+ /usr/bin/lipo -extract i386 /tmp/mnt/mach_kernel -output '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386/mach.macosx'
+ /usr/sbin/kextcache -a i386 -s -l -n -z -m '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386/mach.macosx.mkext' /tmp/mnt/System/Library/Extensions
+ for ARCH in i386 ppc
+ /bin/mkdir -v '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc'
mkdir: created directory '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc'
+ /usr/bin/lipo -extract ppc /tmp/mnt/mach_kernel -output '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc/mach.macosx'
+ /usr/sbin/kextcache -a ppc -s -l -n -z -m '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc/mach.macosx.mkext' /tmp/mnt/System/Library/Extensions
# And finally, prepare the boot loader on the boot image
PrepareBootLoader "$sourceVol" "$destPath"
+ PrepareBootLoader '/Volumes/Mac OS X Install DVD' '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local 'srcVol=/Volumes/Mac OS X Install DVD'
+ local 'destDir=/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local opt=
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Preparing boot loader'
Preparing boot loader
+ '[' DEBUG == DEBUG ']'
+ opt=-v
+ '[' -e /tmp/mnt/usr/standalone/ppc/bootx.bootinfo ']'
+ /usr/bin/ditto -v /tmp/mnt/usr/standalone/ppc/bootx.bootinfo '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/ppc/booter'
Copying /tmp/mnt/usr/standalone/ppc/bootx.bootinfo
+ /usr/bin/ditto -v /tmp/mnt/usr/standalone/i386/boot.efi '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD/i386/booter'
Copying /tmp/mnt/usr/standalone/i386/boot.efi
# "touch"
/usr/bin/touch "${mountPoint}/private/var/db/.AppleSetupDone"
+ /usr/bin/touch /tmp/mnt/private/var/db/.AppleSetupDone
/usr/bin/touch "${mountPoint}/Library/Receipts/.SetupRegComplete"
+ /usr/bin/touch /tmp/mnt/Library/Receipts/.SetupRegComplete
/usr/bin/touch "${mountPoint}/.metadata_never_index"
+ /usr/bin/touch /tmp/mnt/.metadata_never_index
# remove software update
if [ -e "${mountPoint}/System/Library/CoreServices/Software Update.app" ]; then
/bin/rm -rf "${mountPoint}/System/Library/CoreServices/Software Update.app"
fi
+ '[' -e '/tmp/mnt/System/Library/CoreServices/Software Update.app' ']'
+ /bin/rm -rf '/tmp/mnt/System/Library/CoreServices/Software Update.app'
if [ -e "${mountPoint}/System/Library/PreferencePanes/SoftwareUpdate.prefPane" ]; then
/bin/rm -rf "${mountPoint}/System/Library/PreferencePanes/SoftwareUpdate.prefPane"
fi
+ '[' -e /tmp/mnt/System/Library/PreferencePanes/SoftwareUpdate.prefPane ']'
+ /bin/rm -rf /tmp/mnt/System/Library/PreferencePanes/SoftwareUpdate.prefPane
# add any user accounts
CreateUserAccounts
+ CreateUserAccounts
+ local count=1
+ '[' 1 -gt 0 ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Adding 1 user account(s) to the image'
Adding 1 user account(s) to the image
+ (( index=0 ))
+ (( index<1 ))
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Adding user [user full name]'
Adding user [user full name]
+ AddLocalUser '[user full name]' [user short name] 1 0000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000006A29520ED4FE4E8C7DE0930018E9284B1078E0BB4CF77F8700000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000 '/Library/User Pictures/Nature/Cactus.tif' English
+ local databasePath=/Local/Target/Users/[user short name]
+ (( i=501 ))
+ (( i<600 ))
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -search /Local/Target/Users UniqueID $i
++ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -search /Local/Target/Users UniqueID 501
+ output=
+ '[' '' == '' ']'
+ break
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -create /Local/Target/Users/[user short name]
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] RealName '[user full name]'
+ '[' 1 == 1 ']'
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] PrimaryGroupID 80
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] UniqueID 501
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] dsAttrTypeNative:home /Users/[user short name]
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] authentication_authority ';ShadowHash;'
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] picture '/Library/User Pictures/Nature/Cactus.tif'
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] passwd '*'
+ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -append /Local/Target/Users/[user short name] UserShell /bin/bash
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${2} GeneratedUID
++ /usr/bin/dscl -f /tmp/mnt/var/db/dslocal/nodes/Default localonly -read /Local/Target/Users/[user short name] GeneratedUID
+ genUID='GeneratedUID: 2609E2EC-9C33-469B-B850-A3BF935D72FE'
+ genUID=2609E2EC-9C33-469B-B850-A3BF935D72FE
+ '[' '!' -e /tmp/mnt/var/db/shadow/hash ']'
+ /bin/mkdir -p /tmp/mnt/var/db/shadow/hash
+ /bin/chmod -R 700 /tmp/mnt/var/db/shadow
+ echo 0000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000006A29520ED4FE4E8C7DE0930018E9284B1078E0BB4CF77F8700000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000
+ /bin/chmod 600 /tmp/mnt/var/db/shadow/hash/2609E2EC-9C33-469B-B850-A3BF935D72FE
+ '[' -e '/System/Library/User Template/English.lproj/' ']'
+ /usr/bin/ditto '/System/Library/User Template/English.lproj/' /tmp/mnt/Users/[user short name]
+ /usr/sbin/chown -R 501:501 /tmp/mnt/Users/[user short name]
+ (( index++ ))
+ (( index<1 ))
# update progress information
echo "${progressPrefix}_finishingUp_"
+ echo
# perform the final cleanup
PostFlightDestination "$1" "$destPath"
+ PostFlightDestination /tmp/niutemp.mdOQAzsJ '/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local tempDir=/tmp/niutemp.mdOQAzsJ
+ local 'destDir=/Users/[user short name]/Documents/NetBoot of Mac OS X Install DVD'
+ local opt=
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Performing post install cleanup'
Performing post install cleanup
+ '[' DEBUG == DEBUG ']'
+ opt=-v
+ '[' -e /tmp/mnt/var/db/dslocal/indices/Default/index ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Detaching disk image'
Detaching disk image
+ /usr/bin/hdiutil detach /tmp/mnt
T?∞T?– A≈ -
Trying to create a NetRestore image.
Used SuperDuper to repair peremissions and create DMG of Client Zero HD
Ran SIU. Log Follows. Seemed to be going OK but hung at this point, or was I too impatient to wait any longer? had been sitting there for 20+ minutes before I Quit SIU...
Any pointers, please?
Starting image creation.
Workflow Started (2011-03-17 08:47:57 +0000)
Mac OS X Server 10.6.6 (10J567), System Image Utility 10.6.5 (447)
Starting action: Define Image Source (1.2)
Finished running action: Define Image Source
Starting action: Create Image (1.5.3)
Starting image creation process...
Create NetInstall Image
Initiating NetInstall from Restore Media.
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
mountPoint="/tmp/mnt.pde0nj"
++ mountPoint=/tmp/mnt.pde0nj
ownershipInfoKey="505:20"
++ ownershipInfoKey=505:20
mkextPathKey="/System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mk ext"
++ mkextPathKey=/System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mk ext
sourceVol="/Volumes/Macintosh HD 1"
++ sourceVol='/Volumes/Macintosh HD 1'
skipFileChecksumKey="0"
++ skipFileChecksumKey=0
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
destPath="/image in here/NetRestore ofRolloutDMG"
++ destPath='/image in here/NetRestore ofRolloutDMG'
asrSource="ASRInstall.pkg"
++ asrSource=ASRInstall.pkg
blockCopyDeviceKey="0"
++ blockCopyDeviceKey=0
. "$1/createCommon.sh"
+ . /tmp/niutemp.laZrfc41/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright 2007 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 long name
# $2 short name
# $3 isAdminUser key
# $4 password hash
# $5 user picture path
# $6 Language string
local databasePath="/Local/Target/Users/${2}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -search /Local/Target/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -create $databasePath || exit 1
# Add long name
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${1}" || exit 1
# Add PrimaryGroupID
if [ "${3}" == 1 ]; then
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 80 || exit 1
else
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20 || exit 1
fi
# Add UniqueID
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i} || exit 1
# Add Home Directory entry
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath dsAttrTypeNative:home /Users/${2} || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath authentication_authority ";ShadowHash;" || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${5}" || exit 1
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath passwd "*" || exit 1
# Add shell
/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash" || exit 1
# lookup generated uid
genUID=`/usr/bin/dscl -f "${mountPoint}/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${2} GeneratedUID` || exit 1
genUID=${genUID:14:36}
# make sure the shadow/hash directory exists
if [ ! -e "${mountPoint}/var/db/shadow/hash" ] ; then
/bin/mkdir -p "${mountPoint}/var/db/shadow/hash" || exit 1
/bin/chmod -R 700 "${mountPoint}/var/db/shadow" || exit 1
fi
# to copy our password hash in there...
echo "${4}" > "${mountPoint}/var/db/shadow/hash/$genUID"
/bin/chmod 600 "${mountPoint}/var/db/shadow/hash/$genUID" || exit 1
# Create Home directory
if [ -e "/System/Library/User Template/${6}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${6}.lproj/" "${mountPoint}/Users/${2}" || exit 1
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${mountPoint}/Users/${2}" || exit 1
fi
/usr/sbin/chown -R $i:$i "${mountPoint}/Users/${2}" || exit 1
# If they exist, apply any Append.bom changes
ApplyAppendBom()
local tempDir="$1"
local srcVol="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$tempDir/Append.bom" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Applying Append.bom additions from System Image Utility"
fi
/usr/bin/ditto $opt -bom "$tempDir/Append.bom" "$srcVol" "${mountPoint}" || exit 1
fi
if [ -e "$srcVol/Library/Application Support/Apple/System Image Utility/Append.bom" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Applying Append.bom additions from $srcVol"
fi
/usr/bin/ditto $opt -bom "$srcVol/Library/Application Support/Apple/System Image Utility/Append.bom" "$srcVol" "${mountPoint}" || exit 1
fi
# Copies a list of packages (full paths contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/System/Installation/Packages/${leafName}" || exit 1
fi
done < "
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/System/Installation/Packages/${SUB_PATH}${leafName}" || exit 1
fi
done < "${theFile}"
# Create the dyld shared cache files
CreateDyldCaches()
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating dyld shared cache files"
# This spews too much for verbose mode... only enable for debug
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-debug"
fi
fi
/usr/bin/updatedyld_sharedcache -root "${mountPoint}" -universal_boot -force $opt
# Validate or create the destination directory and mount point
CreateOrValidateDestination()
local destDir="$1"
if [ ! -d "$destDir" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at $destDir"
fi
/bin/mkdir -p "$destDir" || exit 1
fi
# Create mount point
if [ ! -d "${mountPoint}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating mountpoint for in $destDir"
fi
/bin/mkdir -p "${mountPoint}" || exit 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
local count="${#userFullName[*]}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassHash[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
done
# "touch"
/usr/bin/touch "${mountPoint}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${mountPoint}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retryhdiutildetach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mountPoint}"
fi
fi
# Finally detach the image and dispose the mountPoint directory
/usr/bin/hdiutil detach "${mountPoint}" || retryhdiutildetach "${mountPoint}" || exit 1
/bin/rmdir "${mountPoint}" || exit 1
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="$1"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || exit 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || exit 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/sshhostkey
HostKey /private/var/tmp/sshhost_rsakey
HostKey /private/var/tmp/sshhost_dsakey
END
fi
fi
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "$tempDir/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "$tempDir/bindingNames.plist" "${mountPoint}/etc/bindingNames.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/etc/bindingNames.plist"
/bin/chmod 644 "${mountPoint}/etc/bindingNames.plist"
fi
if [ -e "$tempDir/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "$tempDir/sharingNames.plist" "${mountPoint}/etc/sharingNames.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/etc/sharingNames.plist"
/bin/chmod 644 "${mountPoint}/etc/sharingNames.plist"
fi
if [ -e "$tempDir/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "$tempDir/NetBootClientHelper" "${mountPoint}/usr/sbin/NetBootClientHelper" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${mountPoint}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "$tempDir/com.apple.NetBootClientHelper.plist" "${mountPoint}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist " || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist "
/bin/chmod 644 "${mountPoint}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist "
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${mountPoint}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
# Create an installer package in /System/Installation/Packages/ wrapping the supplied script
InstallerPackageFromScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script $scriptName"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/$scriptName.pkg/Contents/Resources"
/bin/mkdir $opt "${tempDir}/emptyDir" || exit 1
cd "${tempDir}/emptyDir"
# Create Archive.pax.gz
/bin/pax -w -x cpio -f "$tempDir/$scriptName.pkg/Contents/Archive.pax" .
/usr/bin/gzip "$tempDir/$scriptName.pkg/Contents/Archive.pax"
# Create the Archive.bom file
/usr/bin/mkbom "$tempDir/emptyDir/" "$tempDir/$scriptName.pkg/Contents/Archive.bom"
# Create the Info.plist
/bin/cat > "$tempDir/$scriptName.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.server.SystemImageUtility.$scriptName</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "$tempDir/$scriptName.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "$tempDir/$scriptName.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "$tempDir/$scriptName.pkg/Contents/Resources/postflight"
# copy the package to the Packages directory
/usr/bin/ditto $opt "$tempDir/$scriptName.pkg" "${mountPoint}/System/Installation/Packages/$scriptName.pkg" || exit 1
# clean up
/bin/rm -r "$tempDir/emptyDir"
/bin/rm -r "$tempDir/$scriptName.pkg"
# If it exists, install the PowerManagement.plist onto the install image
InstallPowerManagementPlist()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/com.apple.PowerManagement.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing PowerManagement plist to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/com.apple.PowerManagement.plist" "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist"
/bin/chmod 644 "${mountPoint}/Library/Preferences/SystemConfiguration/com.apple.PowerManagemen t.plist"
fi
# If it exists, install the InstallerStatusNotifications.bundle and progress emitter onto the install image
InstallProgressPieces()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/InstallerStatusNotifications.bundle" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing progress announcer to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/InstallerStatusNotifications.bundle" "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle" || exit 1
/usr/sbin/chown -R root:wheel "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle"
/bin/chmod 755 "${mountPoint}/System/Library/CoreServices/InstallerStatusNotifications.bundle"
fi
if [ -e "$tempDir/com.apple.ProgressEmitter.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing status emitter to image"
fi
/usr/bin/ditto $opt "$tempDir/progress_emitter" "${mountPoint}/usr/sbin/progress_emitter" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/usr/sbin/progress_emitter"
/bin/chmod 555 "${mountPoint}/usr/sbin/progress_emitter"
/usr/bin/ditto $opt "$tempDir/com.apple.ProgressEmitter.plist" "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist"
/bin/chmod 644 "${mountPoint}/System/Library/LaunchDaemons/com.apple.ProgressEmitter.plist"
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in .../System/Installation/Packages/
InstallScriptsFromFile()
local tempDir="$1"
local theFile="$2"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
InstallerPackageFromScript "$tempDir" "${FILE}"
fi
done < "
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount || exit 1
# copy the NBImageInfo.plist file
/usr/bin/ditto $opt "$tempDir/NBImageInfo.plist" "$destDir/NBImageInfo.plist" || exit 1
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# rename the folder to .nbi
if [ ! -e "$destDir.nbi" ]; then
/bin/mv $opt "$destDir" "$destDir.nbi" || exit 1
else
local parentDir=`dirname "${destDir}"`
local targetName=`basename "${destDir}"`
for ((i=2; i<1000; i++)); do
if [ ! -e "${parentDir}/${targetName}_$i.nbi" ]; then
/bin/mv $opt "$destDir" "${parentDir}/${targetName}_$i.nbi" || exit 1
break
fi
done
fi
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local destDir="$1"
local opt=""
local archx8664=`/usr/bin/file -b "${mountPoint}/mach_kernel" | /usr/bin/sed -ne 's/.(x86_64)):./\1/p'`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for the boot image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# Insure the kext cache on our source volume (the boot shell) is up to date
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Updating kext cache on source volume"
fi
/usr/sbin/kextcache -update-volume "${mountPoint}" || exit 1
# Copy the i386 and, if it exists, the x86_64 architecture
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing Intel architecture"
fi
# Prepare the kernel
/bin/mkdir $opt "$destDir/i386" || exit 1
/usr/bin/lipo -extract i386 "${mountPoint}/mach_kernel" -output "$destDir/i386/mach.macosx" || exit 1
# Build kext cache
/usr/sbin/kextcache -a i386 -s -l -n -z -mkext2 "$destDir/i386/mach.macosx.mkext" "${mountPoint}/System/Library/Extensions" || exit 1
# If the x86_64 architecture exists, copy it
if [ "${archx8664}" = "x86_64" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing x86_64 architecture"
fi
# Prepare the kernel
/bin/mkdir $opt "$destDir/i386/x86_64" || exit 1
/usr/bin/lipo -extract x86_64 "${mountPoint}/mach_kernel" -output "$destDir/i386/x86_64/mach.macosx" || exit 1
# Build kext cache
/usr/sbin/kextcache -a x86_64 -s -l -n -z -mkext2 "$destDir/i386/x86_64/mach.macosx.mkext" "${mountPoint}/System/Library/Extensions" || exit 1
fi
# Create the i386 and x86_64 boot loaders on the boot image
PrepareBootLoader()
local srcVol="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing boot loader"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# Copy the i386 and, by default, the x86_64 architecture
if [ -e "${mountPoint}/usr/standalone/i386/boot.efi" ]; then
/usr/bin/ditto $opt "${mountPoint}/usr/standalone/i386/boot.efi" "$destDir/i386/booter" || exit 1
else
/usr/bin/ditto $opt "$srcVol/usr/standalone/i386/boot.efi" "$destDir/i386/booter" || exit 1
fi
# If it exists, install the partitioning application and data onto the install image
ProcessAutoPartition()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/PartitionInfo.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Partitioning application and data to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/PartitionInfo.plist" "${mountPoint}/System/Installation/PartitionInfo.plist" || exit 1
/usr/bin/ditto $opt "$tempDir/AutoPartition.app" "${mountPoint}/System/Installation/AutoPartition.app" || exit 1
# Tell the installer to run the Partitioning application
/bin/echo "#!/bin/sh
/System/Installation/AutoPartition.app/Contents/MacOS/AutoPartition" > "${mountPoint}/private/etc/rc.cdrom.postWS"
# Due to the way rc.install sources the script, it needs to be executable
/usr/sbin/chown root:wheel "${mountPoint}/private/etc/rc.cdrom.postWS"
/bin/chmod 755 "${mountPoint}/private/etc/rc.cdrom.postWS"
fi
# If it exists, install the InstallPreferences.plist onto the install image
ProcessInstallPreferences()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/InstallPreferences.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing InstallPreferences.plist to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/InstallPreferences.plist" "${mountPoint}/System/Installation/Packages/InstallPreferences.plist" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/System/Installation/Packages/InstallPreferences.plist"
/bin/chmod 644 "${mountPoint}/System/Installation/Packages/InstallPreferences.plist"
fi
# If it exists, install the minstallconfig.xml onto the install image
ProcessMinInstall()
local tempDir="$1"
local opt=""
if [ -e "$tempDir/minstallconfig.xml" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing minstallconfig.xml to install image"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/usr/bin/ditto $opt "$tempDir/minstallconfig.xml" "${mountPoint}/etc/minstallconfig.xml" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/etc/minstallconfig.xml"
/bin/chmod 644 "${mountPoint}/etc/minstallconfig.xml"
fi
# untar the OSInstall.mpkg so it can be modified
untarOSInstallMpkg()
local tempDir="$1"
local opt=""
# we might have already done this, so check for it first
if [ ! -d "${tempDir}/OSInstall_pkg" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "uncompressing OSInstall.mpkg"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
/bin/mkdir "${tempDir}/OSInstall_pkg"
cd "${tempDir}/OSInstall_pkg"
/usr/bin/xar $opt -xf "${mountPoint}/System/Installation/Packages/OSInstall.mpkg"
# make Distribution writeable
/bin/chmod 777 "${tempDir}/OSInstall_pkg"
/bin/chmod 666 "${tempDir}/OSInstall_pkg/Distribution"
fi
handler ()
echo "Terminated. Cleaning up. Unmounting $destPath"
# detach the disk and remove the mount folder
DetachAndRemoveMount
# Remove the items we created
/bin/rm -r "$destPath/i386"
/bin/rm "$destPath/$dmgTarget.dmg"
/bin/rm "$destPath/System.dmg"
# Finally, remove the directory IF empty
/bin/rmdir "$destPath"
exit 1
InstallNetBootClientHelper()
local tempDir="$1"
local destDir="${mountPoint}/System/Installation/Packages/SIUExtras"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${destDir}/bindingNames.plist" || exit 1
/usr/sbin/chown root:wheel "${destDir}/bindingNames.plist"
/bin/chmod 644 "${destDir}/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${destDir}/sharingNames.plist" || exit 1
/usr/sbin/chown root:wheel "${destDir}/sharingNames.plist"
/bin/chmod 644 "${destDir}/sharingNames.plist"
fi
# This is required, make sure it's here
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${destDir}/NetBootClientHelper" || exit 1
/usr/sbin/chown root:wheel "${destDir}/NetBootClientHelper"
/bin/chmod 555 "${destDir}/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${destDir}/com.apple.NetBootClientHelper.plist" || exit 1
/usr/sbin/chown root:wheel "${destDir}/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${destDir}/com.apple.NetBootClientHelper.plist"
/usr/bin/ditto $opt "${tempDir}/installClientHelper.sh" "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh" || exit 1
/usr/sbin/chown root:wheel "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh"
/bin/chmod 555 "${mountPoint}/var/tmp/niu/postinstall/installClientHelper.sh"
trap "handler" TERM INT
+ trap handler TERM INT
# Set up for script debugging
debug_opt=""
+ debug_opt=
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
debug_opt="-v"
fi
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ debug_opt=-v
# See if the source volume was overridden (NetRestore from install media workflow)
isRestoreFromInstallMedia="NO"
+ isRestoreFromInstallMedia=NO
if [ ! -z "${3:-}" ]; then
sourceVol="${3}"
isRestoreFromInstallMedia="YES"
fi
+ '[' '!' -z '' ']'
# Prepare the destination
CreateOrValidateDestination "$destPath"
+ CreateOrValidateDestination '/image in here/NetRestore ofRolloutDMG'
+ local 'destDir=/image in here/NetRestore ofRolloutDMG'
+ '[' '!' -d '/image in here/NetRestore ofRolloutDMG' ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating working path at /image in here/NetRestore ofRolloutDMG'
Creating working path at /image in here/NetRestore ofRolloutDMG
+ /bin/mkdir -p '/image in here/NetRestore ofRolloutDMG'
+ '[' '!' -d /tmp/mnt.pde0nj ']'
# If the sourceVol is the boot drive we have an asr:// type source
if [ "$sourceVol" == "/" ]; then
# Create an empty image to skip the ASR volume creation
/usr/bin/touch "${destPath}/System.dmg"
fi
+ '[' '/Volumes/Macintosh HD 1' == / ']'
# Look for an existing System.dmg
if [ ! -e "$destPath/System.dmg" ]; then
# update progress information
echo "${progressPrefix}imagingSource"
# Create an image of the source volume
# /usr/bin/hdiutil create "$destPath/System" -srcfolder "$sourceVol" -format UDBZ -uid 0 -gid 80 -mode 1775 -ov -puppetstrings || exit 1
if [ "${blockCopyDeviceKey}" == 1 ] ; then
theDevice=`/usr/sbin/diskutil info "$sourceVol" | grep "Device Identifier:" | awk '{print $3}'`
/usr/sbin/diskutil umount "${theDevice}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating block-level image of $theDevice"
fi
/usr/bin/hdiutil create "$destPath/System" -srcdevice "${theDevice}" -uid 0 -gid 80 -mode 1775 -ov -puppetstrings || exit 1
/usr/sbin/diskutil mount "${theDevice}"
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating image of $sourceVol"
fi
/usr/bin/hdiutil create "$destPath/System" -srcfolder "${sourceVol}" -fsargs "-c a=16384,c=8192,e=1280" -uid 0 -gid 80 -mode 1775 -ov -puppetstrings || exit 1
fi
# update progress information
echo "${progressPrefix}preparingASR"
# "Scan the image for restore"
asr_opt="--filechecksum"
if [ "${skipFileChecksumKey}" == 1 ] ; then
asr_opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Preparing image for restore without file checksums"
fi
else
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Preparing image for restore"
fi
fi
/usr/sbin/asr imagescan --source "$destPath/System.dmg" $asr_opt || exit 1
fi
+ '[' '!' -e '/image in here/NetRestore ofRolloutDMG/System.dmg' ']'
+ echo progress_imagingSource
+ '[' 0 == 1 ']'
+ '[' DEBUG == VERBOSE -o DEBUG == DEBUG ']'
+ echo 'Creating image of /Volumes/Macintosh HD 1'
Creating image of /Volumes/Macintosh HD 1
+ /usr/bin/hdiutil create '/image in here/NetRestore ofRolloutDMG/System' -srcfolder '/Volumes/Macintosh HD 1' -fsargs '-c a=16384,c=8192,e=1280' -uid 0 -gid 80 -mode 1775 -ov -puppetstrings
PERCENT:0.000000
PERCENT:0.433633
PERCENT:87.806953
PERCENT:-1.000000
Finalizing disk image.
detachTempimageFile: synchronous unmount /dev/disk1 returned 49153
lsof: status error on /Volumes/Macintosh: No such file or directory
lsof: status error on HD: No such file or directory
lsof 4.82
latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
usage: [-?abhlnNoOPRtUvV] [+|-c c] [+|-d s] [+D D] [+|-f[cgG]]
[-F [f]] [-g [s]] [-i ] [+|-L [l]] [+|-M] [-o [o]] [-p s]
[+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
Use the ``-h'' option to get more help information.
retrying unmount (#1)...
detachTempImageFile: synchronous retry (#1) unmount /Volumes/Macintosh HD (/dev/disk1) returned 0
Workflow Stopped (2011-03-17 10:01:33 +0000)
Workflow Stopped (2011-03-17 10:01:34 +0000)
Stopping image creation.
Terminating script!Thanks for your input...I did wonder if I was being impatient...
subsequently ran it again and was taken out of the office for a few hours, lo and behold on return all was well....
Now however, netboot service won't start, netboot folder is not being created within library...another posting to follow
Message was edited by: DaiVernon
Maybe you are looking for
-
Email notification not working
I have an OIM (11g) Solution where I can provision many resources (Solaris, AD, iPlanet, My SQl, Custom Resource Adapter, JNDI Adapter, etc) through roles. Now I want to send Email notifications to users I've just created and their managers too. I al
-
Hi, I have an application that uses a JTable with editable cells. When the user clicks a cell, I would like the cell's data to become highlighted. In other words, I don't just want the cell to get focus, I want the existing text within the cell to be
-
Hi, I want to fix an image as the background of a form. Image is not coming from database. a fixed image only... How can i do this? I am using Oracle Forms 10g. If any body knows please help me asap. Thank you renjish
-
Has anyone had issues with battery overheats on the HP tablets?
Seen many messages on battery drains (not sure what the solution is to that) but have an overheating situation when in power down mode.
-
Logic Express and Presonus Firepod
I am trying to record live sound through a condenser mic running into Presonus Firepod. I am trying to use this successfully with Logic Express, but have thus far been frustrated. I have followed the suggested steps of adjusting Logic's preferences s