~ubuntu-branches/ubuntu/oneiric/enigmail/oneiric-updates

« back to all changes in this revision

Viewing changes to build/package/mac_osx/unpack-diskimage

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2010-04-10 01:42:24 UTC
  • Revision ID: james.westby@ubuntu.com-20100410014224-fbq9ui5x3b0h2t36
Tags: 2:1.0.1-0ubuntu1
* First releaase of enigmail 1.0.1 for tbird/icedove 3
  (LP: #527138)
* redo packaging from scratch 
  + add debian/make-orig target that uses xulrunner provided
    buildsystem + enigmail tarball to produce a proper orig.tar.gz
  + use debhelper 7 with mozilla-devscripts
  + use debian source format 3.0 (quilt)
  + patch enigmail to use frozen API only
    - add debian/patches/frozen_api.diff
  + patch build system to not link against -lxul - which isnt
    available for sdks produced by all-static apps like tbird
    - add debian/patches/build_system_dont_link_libxul.diff
  + add minimal build-depends to control

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
# ***** BEGIN LICENSE BLOCK *****
 
3
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
4
#
 
5
# The contents of this file are subject to the Mozilla Public License Version
 
6
# 1.1 (the "License"); you may not use this file except in compliance with
 
7
# the License. You may obtain a copy of the License at
 
8
# http://www.mozilla.org/MPL/
 
9
#
 
10
# Software distributed under the License is distributed on an "AS IS" basis,
 
11
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
12
# for the specific language governing rights and limitations under the
 
13
# License.
 
14
#
 
15
# The Original Code is the installdmg.sh script from taols utilities
 
16
#
 
17
# The Initial Developer of the Original Code is
 
18
# Mozilla Corporation.
 
19
# Portions created by the Initial Developer are Copyright (C) 2009
 
20
# the Initial Developer. All Rights Reserved.
 
21
#
 
22
# Contributor(s):
 
23
#  Chris AtLee <catlee@mozilla.com>
 
24
#  Robert Kaiser <kairo@kairo.at>
 
25
#
 
26
# Alternatively, the contents of this file may be used under the terms of
 
27
# either the GNU General Public License Version 2 or later (the "GPL"), or
 
28
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
29
# in which case the provisions of the GPL or the LGPL are applicable instead
 
30
# of those above. If you wish to allow use of your version of this file only
 
31
# under the terms of either the GPL or the LGPL, and not to allow others to
 
32
# use your version of this file under the terms of the MPL, indicate your
 
33
# decision by deleting the provisions above and replace them with the notice
 
34
# and other provisions required by the GPL or the LGPL. If you do not delete
 
35
# the provisions above, a recipient may use your version of this file under
 
36
# the terms of any one of the MPL, the GPL or the LGPL.
 
37
#
 
38
# ***** END LICENSE BLOCK *****
 
39
 
 
40
# Unpack a disk image to a specified target folder
 
41
#
 
42
# Usage: unpack-diskimage <image_file>
 
43
#                         <mountpoint>
 
44
#                         <target_path>
 
45
 
 
46
DMG_PATH=$1
 
47
MOUNTPOINT=$2
 
48
TARGETPATH=$3
 
49
 
 
50
# How long to wait before giving up waiting for the mount to finish (seconds)
 
51
TIMEOUT=90
 
52
 
 
53
# If mnt already exists, then the previous run may not have cleaned up
 
54
# properly.  We should try to umount and remove the mnt directory.
 
55
if [ -d $MOUNTPOINT ]; then
 
56
    echo "mnt already exists, trying to clean up"
 
57
    hdiutil detach $MOUNTPOINT -force
 
58
    rm -rdfv $MOUNTPOINT
 
59
fi
 
60
 
 
61
# Install an on-exit handler that will unmount and remove the '$MOUNTPOINT' directory
 
62
trap "{ if [ -d $MOUNTPOINT ]; then hdiutil detach $MOUNTPOINT -force; rm -rdfv $MOUNTPOINT; fi; }" EXIT
 
63
 
 
64
mkdir -p $MOUNTPOINT
 
65
 
 
66
hdiutil attach -verbose -noautoopen -mountpoint $MOUNTPOINT "$DMG_PATH"
 
67
# Wait for files to show up
 
68
# hdiutil uses a helper process, diskimages-helper, which isn't always done its
 
69
# work by the time hdiutil exits. So we wait until something shows up in the
 
70
# mnt directory. Due to the async nature of diskimages-helper, the best thing
 
71
# we can do is to make sure the glob() rsync is making can find files.
 
72
i=0
 
73
while [ "$(echo $MOUNTPOINT/*)" == "$MOUNTPOINT/*" ]; do
 
74
    if [ $i -gt $TIMEOUT ]; then
 
75
        echo "No files found, exiting"
 
76
        exit 1
 
77
    fi
 
78
    sleep 1
 
79
    i=$(expr $i + 1)
 
80
done
 
81
# Now we can copy everything out of the $MOUNTPOINT directory into the target directory
 
82
rsync -av $MOUNTPOINT/* $MOUNTPOINT/.DS_Store $MOUNTPOINT/.background $MOUNTPOINT/.VolumeIcon.icns $TARGETPATH/.
 
83
hdiutil detach $MOUNTPOINT
 
84
rm -rdf $MOUNTPOINT
 
85
# diskimage-helper prints messages to stdout asynchronously as well, sleep
 
86
# for a bit to ensure they don't disturb following commands in a script that
 
87
# might parse stdout messages
 
88
sleep 5