source: orange/install-scripts/mac/bundle-build-hg.sh @ 10504:3c4980af94de

Revision 10504:3c4980af94de, 4.2 KB checked in by Ales Erjavec <ales.erjavec@…>, 2 years ago (diff)

Read the current template version string.

  • Property exe set to *
Line 
1#!/bin/bash -e
2#
3# Build the orange Mac OSX bundle
4#
5# ./bundle-build-hg.sh work_dir revision bundle_output_file
6# ./bundle-build-hg.sh /private/tmp tip /private/tmp/orange-bundle-hg-tip.dmg
7#
8
9WORK_DIR=$1
10REVISION=$2
11BUNDLE=$3
12
13TMP_BUNDLE_DIR=${WORK_DIR}/bundle
14REPOS_DIR=${WORK_DIR}/repos
15
16# Remove leftovers if any
17if [ -e $TMP_BUNDLE_DIR ]; then
18    rm -rf $TMP_BUNDLE_DIR
19fi
20
21echo "Preaparing the bundle template"
22TEMPLATE_VERSION=`curl --silent http://orange.biolab.si/download/bundle-templates/CURRENT.txt`
23curl --silent http://orange.biolab.si/download/bundle-templates/Orange-template-${TEMPLATE_VERSION}.tar.gz | tar -xz -C $WORK_DIR
24#svn export --non-interactive http://orange.biolab.si/svn/orange/externals/trunk/install-scripts/mac/bundle/ $TMP_BUNDLE_DIR
25
26# Make repos dir if it does not yet exist
27if [ ! -e $REPOS_DIR ]; then
28    mkdir $REPOS_DIR
29fi
30
31#Python interpreter in the bundle
32PYTHON=${TMP_BUNDLE_DIR}/Orange.app/Contents/MacOS/python
33
34#Python version
35PY_VER=`$PYTHON -c "import sys; print sys.version[:3]"`
36
37echo "Checkouting and building orange"
38echo "==============================="
39./bundle-inject-hg.sh https://bitbucket.org/biolab/orange orange $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
40
41echo "Checkouting and building bioinformatics addon"
42echo "============================================="
43./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-addon-bioinformatics bioinformatics $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
44
45echo "Checkouting and building text addon"
46echo "==================================="
47./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-addon-text text $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
48
49echo "Installing networkx"
50echo "+++++++++++++++++++++"
51./bundle-inject-pypi.sh networkx-1.6 http://pypi.python.org/packages/source/n/networkx/networkx-1.6.tar.gz $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
52
53echo "Installing distribute"
54echo "+++++++++++++++++++++"
55./bundle-inject-pypi.sh distribute-0.6.24 http://pypi.python.org/packages/source/d/distribute/distribute-0.6.24.tar.gz $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
56
57# TODO: from here on we could use easy_install to install pip and then use that
58echo "Installing suds library"
59echo "+++++++++++++++++++++++"
60./bundle-inject-pypi.sh suds-0.4 http://pypi.python.org/packages/source/s/suds/suds-0.4.tar.gz $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
61
62echo "Removing unnecessary files."
63find $TMP_BUNDLE_DIR \( -name '*~' -or -name '*.bak' -or -name '*.pyc' -or -name '*.pyo' -or -name '*.pyd' \) -exec rm -rf {} ';'
64
65ln -s ../Frameworks/Python.framework/Versions/Current/lib/python${PY_VER}/site-packages/Orange ${TMP_BUNDLE_DIR}/Orange.app/Contents/Resources/Orange
66
67   
68echo "Preparing the .dmg image"
69echo "========================"
70
71# Makes a link to Applications folder
72ln -s /Applications/ $TMP_BUNDLE_DIR/Applications
73
74echo "Fixing bundle permissions."
75
76{ chown -Rh root:wheel $TMP_BUNDLE_DIR; } || { echo "Could not fix bundle permissions"; }
77
78echo "Creating temporary image with the bundle."
79
80TMP_BUNDLE=${WORK_DIR}/bundle.dmg
81rm -f $TMP_BUNDLE
82
83hdiutil detach /Volumes/Orange -force || true
84hdiutil create -format UDRW -volname Orange -fs HFS+ -fsargs "-c c=64,a=16,e=16" -srcfolder $TMP_BUNDLE_DIR $TMP_BUNDLE
85MOUNT_OUTPUT=`hdiutil attach -readwrite -noverify -noautoopen $TMP_BUNDLE | egrep '^/dev/'`
86DEV_NAME=`echo -n "$MOUNT_OUTPUT" | head -n 1 | awk '{print $1}'`
87MOUNT_POINT=`echo -n "$MOUNT_OUTPUT" | tail -n 1 | awk '{print $3}'`
88
89# Makes the disk image window open automatically when mounted
90bless -openfolder "$MOUNT_POINT"
91# Hides background directory even more
92/Developer/Tools/SetFile -a V "$MOUNT_POINT/.background/"
93# Sets the custom icon volume flag so that volume has nice Orange icon after mount (.VolumeIcon.icns)
94/Developer/Tools/SetFile -a C "$MOUNT_POINT"
95
96# Might mot have permissions to do this
97{ rm -rf "$MOUNT_POINT/.Trashes/"; } || { echo "Could not remove $MOUNT_POINT/.Trashes/"; }
98
99{ rm -rf "$MOUNT_POINT/.fseventsd/"; } || { echo "Could not remove $MOUNT_POINT/.fseventsd/"; }
100
101hdiutil detach "$DEV_NAME" -force
102
103echo "Converting temporary image to a compressed image."
104
105if [ -e $BUNDLE ]; then
106    rm -f $BUNDLE
107fi
108
109hdiutil convert $TMP_BUNDLE -format UDZO -imagekey zlib-level=9 -o $BUNDLE
110
111echo "Cleaning up."
112rm -f $TMP_BUNDLE
113rm -rf $TMP_BUNDLE_DIR
114
115true
Note: See TracBrowser for help on using the repository browser.