hdiutil attach fails under some repeatable circumstances
hdiutil attach fails under some repeatable circumstances
- Subject: hdiutil attach fails under some repeatable circumstances
- From: Brant Sears <email@hidden>
- Date: Fri, 19 Oct 2007 10:39:05 -0400
Hi. I'm having a problem with hdituil attach.
I have a build script that builds a software product. The final phase
executes another script that packages the software onto a .dmg. In
order to do this, it takes a "templated" dmg, makes a copy, mounts
it, copies the software onto to mounted volume, unmounts it, converts
the format to read only (UDRO), unflattens it, adds a resource for a
software license agreement, flattens it again, the converts it to UDZO.
I pasted in the script that does this into the bottom of this message.
This script works fine except under one particular circumstance.
The way that I want to invoke my build script is from a web page. In
order to do this, I have a script that runs all the time on my
server. It wakes up every 10 seconds and checks to see if a certain
file exists which contains "commands" for it. The commands it knows
are to either exit or build the software.
My CGI script basically writes out a "command" into this file to
build the software (with some arguments). My script doesn't actually
execute anything in this file, just reads it, interprets it, and then
builds the software and then deletes the file containing the command
and goes back to sleep.
Again, this works fine if I ssh into my server, startup the
background script, and then stay logged in.
However, once I log out of my server box (which is actually just a G4
Mac mini running standard Tiger which I'm using to do formal builds
and host a little web page for the builds), the hdiutil attach call
fails. At this point, I don't see the actual error message, but my
script tests for whether the volume is mounted and it reports a failure.
What am I doing wrong? Is there a known limitation for hdiutil
attach? Also, I apologize if this isn't the best list to ask this.
Thanks.
Brant Sears
#!/bin/bash
BUILD_STYLE="Release"
HOME=/Users/`whoami`
#APP_LOC=/Users/`whoami`/src/build/Release
APP_NAME=MyAppName
APP_FILE_NAME=${APP_NAME}.app
TEMP_DMG= MyAppName_template.dmg
SLA_DMG= MyAppName_SLA.dmg
FINAL_DMG= MyAppName.dmg
DMG_VOLUME_NAME= MyAppName
while getopts 'd:' OPT_LETTER
do
case "$OPT_LETTER" in
d)
echo "****Debug Deployment****"
BUILD_STYLE="Debug"
#APP_LOC=/Users/`whoami`/src/build/Debug
;;
*)
echo "Invalid argument ${OPT_LETTER}"
exit 1
;;
esac
done
echo "Creating dmg..."
cd ~/src/
rm -f "${FINAL_DMG}"
cp "${TEMP_DMG}" "${FINAL_DMG}"
if ! test -e "${FINAL_DMG}"
then
echo "****ERROR: Failed to copy dmg."
exit 1
fi
hdiutil attach "${FINAL_DMG}"
if ! test -e /Volumes/"${DMG_VOLUME_NAME}"
then
echo "****ERROR: Dmg failed to mount" <---- THIS IS WHERE IT FAILS
exit 1
fi
rm -rf /Volumes/"${DMG_VOLUME_NAME}"/"${APP_FILE_NAME}"
echo "Copying ${APP} to Dmg"
cp -R "${APP}" /Volumes/"${DMG_VOLUME_NAME}"/
touch -f /Volumes/"${DMG_VOLUME_NAME}"/"${APP_FILE_NAME}"
if ! test -e /Volumes/"${DMG_VOLUME_NAME}"/"${APP_FILE_NAME}"
then
echo "****ERROR: Failed to copy application to Dmg."
exit 1
fi
hdiutil detach /Volumes/"${DMG_VOLUME_NAME}"
if test -e /Volumes/"${DMG_VOLUME_NAME}"
then
echo "****ERROR: Failed to unmount Dmg."
exit 1
fi
hdiutil convert -ov -format UDRO -o "${SLA_DMG}" "${FINAL_DMG}"
echo "Adding Software License Agreement to dmg..."
hdiutil unflatten "${SLA_DMG}"
Rez -a SLA.r -o "${SLA_DMG}"
hdiutil flatten "${SLA_DMG}"
hdiutil convert -ov -format UDZO -o "${DST_DMG}" "${SLA_DMG}"
rm -rf "${SLA_DMG}"
rm -rf "${FINAL_DMG}"
echo "Done!"
exit 0
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden