create-dmg.sh 1.53 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#!/bin/sh
set -e

info()
{
    local green="\033[1;32m"
    local normal="\033[0m"
    echo "[${green}build${normal}] $1"
}

spushd()
{
    pushd "$1" > /dev/null
}

spopd()
{
    popd > /dev/null
}

out="/dev/null"

npapiroot=`dirname $0`/../..

UBROOT="${npapiroot}/VLC Plugin.plugin"
DMGFOLDERNAME="VLC Browser Plug-in for Mac"
DMGITEMNAME="VLC-webplugin-REPLACEWITHVERSION"

info "checking for distributable binary package"

spushd ${npapiroot}
if [ ! -e "${UBROOT}" ]; then
    info "Universal Binary not found for distribution, creating..."
    ./extras/macosx/create-universal-binary.sh
fi

info "Collecting items"
mkdir -p "${DMGFOLDERNAME}"
cp -R "${UBROOT}" "${DMGFOLDERNAME}"
cp NEWS AUTHORS COPYING "${DMGFOLDERNAME}"
41 42 43 44 45
spushd "${DMGFOLDERNAME}"
mv NEWS NEWS.txt
mv AUTHORS AUTHORS.txt
mv COPYING COPYING.txt
spopd
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
ln -s "/Library/Internet Plug-Ins" "${DMGFOLDERNAME}/Internet Plug-Ins"
rm -f ${DMGITEMNAME}-rw.dmg

info "Creating disk-image"
hdiutil create -srcfolder ${npapiroot}/"${DMGFOLDERNAME}" "${npapiroot}/${DMGITEMNAME}-rw.dmg" -scrub -format UDRW
mkdir -p ./mount

info "Moving file icons around"
hdiutil attach -readwrite -noverify -noautoopen -mountRoot ./mount ${DMGITEMNAME}-rw.dmg
osascript "${npapiroot}"/extras/macosx/dmg_setup.scpt "${DMGFOLDERNAME}"
hdiutil detach ./mount/"${DMGFOLDERNAME}"

info "Compressing disk-image"
rm -f ${DMGITEMNAME}.dmg
hdiutil convert "${npapiroot}/${DMGITEMNAME}-rw.dmg" -format UDBZ -o "${npapiroot}/${DMGITEMNAME}.dmg"
rm -f ${DMGITEMNAME}-rw.dmg
rm -rf "${DMGFOLDERNAME}"

spopd

info "Disk-image created"