blob: b91cff9fd3f0874943d2c48ad7604a60c9fd051a [file] [log] [blame]
garciadeblasf5c33072018-09-27 18:03:45 +02001#!/bin/sh
2# 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
17PKG_DIRECTORIES="authosm instancehandler lib projecthandler sdnctrlhandler sf_t3d static template userhandler vimhandler"
18PKG_FILES="bower.json django.ini LICENSE manage.py nginx-app.conf README.md requirements.txt supervisor-app.conf"
19MDG_NAME=lightui
20DEB_INSTALL=debian/osm-${MDG_NAME}.install
21export DEBEMAIL="gerardo.garciadeblas@telefonica.com"
22export DEBFULLNAME="Gerardo Garcia"
23
24PKG_VERSION=$(git describe --match "v*" --tags --abbrev=0)
25PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g')
26PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l)
27if [ "$PKG_VERSION_POST" -eq 0 ]; then
28 PKG_DIR="osm-${MDG_NAME}-${PKG_VERSION_PREFIX}"
29else
30 PKG_DIR="osm-${MDG_NAME}-$PKG_VERSION_PREFIX.post${PKG_VERSION_POST}"
31fi
32
33rm -rf $PKG_DIR
34rm -f *.orig.tar.xz
35rm -f *.deb
36rm -f $DEB_INSTALL
37mkdir -p $PKG_DIR
38
39for dir in $PKG_DIRECTORIES; do
40 ln -s $PWD/$dir $PKG_DIR/.
41 echo "$dir/* usr/share/osm-$MDG_NAME/$dir" >> $DEB_INSTALL
42done
43for f in $PKG_FILES; do
44 cp $f $PKG_DIR/.
45 echo "$f usr/share/osm-$MDG_NAME" >> $DEB_INSTALL
46done
47cp -R debian $PKG_DIR/.
48
49cd $PKG_DIR
50dh_make -y --indep --createorig --a -c apache
51dpkg-buildpackage -uc -us -tc -rfakeroot
52cd -
53