make_package.sh 1.78 KB
Newer Older
1
#!/usr/bin/env bash
2
# Copyright (C) 2015-2016 GRNET S.A.
3 4 5 6 7 8 9 10 11 12 13 14 15 16
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

17 18 19 20
OS_NAME=$(uname -s)
if [ $? -ne 0 ]; then
    OS_NAME=$(/bin/uname -s)
fi
21 22 23 24 25 26
OS_NAME=${OS_NAME:0:6}

if [[ "$OS_NAME" = "CYGWIN" ]]
then
    export PATH=/usr/bin:$PATH
fi
27 28 29 30 31 32 33 34 35 36 37 38 39 40

if [ -z "$1" ]
  then
    echo "Usage: $0 <platform> (can be win32,win64,osx32,osx64,linux32,linux64)"
    exit
fi

PLATFORM=$1

NW_VERSION=0.12.3

cd "$(dirname "$0")"
ROOTPATH=$(pwd)

Efthymia Bika's avatar
Efthymia Bika committed
41
python copy_cacert.py
42 43 44 45
cd baas
npm install
cd ..

46
rm -rf build/baas
47 48 49
NWCACHE=build/nwcache
mkdir -p $NWCACHE
nwbuild --cacheDir $NWCACHE -p $PLATFORM -v $NW_VERSION baas
50

51
if [[ "$OS_NAME" = "Darwin" ]]
Giorgos Korfiatis's avatar
Giorgos Korfiatis committed
52
then DIST=dist
53 54
else DIST=dist/baas
fi
55 56
rm -rf $DIST; mkdir -p $DIST

57 58
echo Copying baas
cp -r build/baas/$PLATFORM/* $DIST
59 60 61 62 63 64

if [[ "$OS_NAME" = "Darwin" ]]
then RESOURCES=$DIST/baas.app/Contents/Resources
else RESOURCES=$DIST
fi
cp src/timeview.py $RESOURCES
Efthymia Bika's avatar
Efthymia Bika committed
65
cp cacert.pem $RESOURCES
66
echo Copying duplicity
67
cp -r build/duplicity/* $RESOURCES
68 69 70 71

if [[ "$OS_NAME" = "CYGWIN" ]]
then
  echo Copying cygwin
72
  cp -r build/cygwin $RESOURCES
73 74
fi

Giorgos Korfiatis's avatar
Giorgos Korfiatis committed
75 76 77 78 79
if [[ ${PLATFORM:0:3} = "osx" ]]
then
    cp src/images/logo.icns $DIST/baas.app/Contents/Resources/nw.icns
fi

80
echo Built under $DIST