make_package.sh 1.71 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/env bash
# Copyright (C) 2015 GRNET S.A.
#
# 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
nwbuild -p $PLATFORM -v $NW_VERSION baas

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

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

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
63
cp cacert.pem $RESOURCES
64
echo Copying duplicity
65
cp -r build/duplicity/* $RESOURCES
66 67 68 69

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

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

78
echo Built under $DIST