blob: 6f05b9456c93642a95b3d9e2a68763e04e26e1d1 [file] [log] [blame]
garciadeblas17f074b2018-11-20 17:38:13 +01001#!/bin/bash
garciadeblasf5c33072018-09-27 18:03:45 +02002# Copyright 2018 Telefonica
3# All Rights Reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16
lombardofrc3051ef2019-01-16 10:59:18 +010017
lombardofr3fcf21a2019-03-11 10:26:08 +010018PKG_DIRECTORIES="authosm descriptorhandler instancehandler lib projecthandler sdnctrlhandler sf_t3d static template userhandler vimhandler packagehandler netslicehandler wimhandler"
garciadeblase3ae5372018-11-29 09:50:58 +010019PKG_FILES="bower.json django.ini LICENSE manage.py nginx-app.conf README.md requirements.txt supervisor-app.conf .bowerrc"
garciadeblasf5c33072018-09-27 18:03:45 +020020MDG_NAME=lightui
21DEB_INSTALL=debian/osm-${MDG_NAME}.install
22export DEBEMAIL="gerardo.garciadeblas@telefonica.com"
23export DEBFULLNAME="Gerardo Garcia"
24
25PKG_VERSION=$(git describe --match "v*" --tags --abbrev=0)
26PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g')
27PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l)
28if [ "$PKG_VERSION_POST" -eq 0 ]; then
garciadeblas17f074b2018-11-20 17:38:13 +010029 PKG_DIR="deb_dist/osm-${MDG_NAME}-${PKG_VERSION_PREFIX}"
garciadeblasf5c33072018-09-27 18:03:45 +020030else
garciadeblas17f074b2018-11-20 17:38:13 +010031 PKG_DIR="deb_dist/osm-${MDG_NAME}-$PKG_VERSION_PREFIX.post${PKG_VERSION_POST}"
garciadeblasf5c33072018-09-27 18:03:45 +020032fi
33
34rm -rf $PKG_DIR
35rm -f *.orig.tar.xz
36rm -f *.deb
37rm -f $DEB_INSTALL
38mkdir -p $PKG_DIR
39
40for dir in $PKG_DIRECTORIES; do
41 ln -s $PWD/$dir $PKG_DIR/.
42 echo "$dir/* usr/share/osm-$MDG_NAME/$dir" >> $DEB_INSTALL
43done
44for f in $PKG_FILES; do
45 cp $f $PKG_DIR/.
46 echo "$f usr/share/osm-$MDG_NAME" >> $DEB_INSTALL
47done
48cp -R debian $PKG_DIR/.
49
garciadeblas17f074b2018-11-20 17:38:13 +010050pushd $PKG_DIR
garciadeblasf5c33072018-09-27 18:03:45 +020051dh_make -y --indep --createorig --a -c apache
52dpkg-buildpackage -uc -us -tc -rfakeroot
garciadeblas17f074b2018-11-20 17:38:13 +010053popd
54
garciadeblasf5c33072018-09-27 18:03:45 +020055