blob: 30c69bb68fe398468950452fa936a1c7089078e6 [file] [log] [blame]
Zhe Huang839d43f2019-07-12 12:58:37 -04001#!/bin/bash
2################################################################################
3# Copyright (c) 2019 AT&T Intellectual Property. #
4# Copyright (c) 2019 Nokia. #
5# #
6# Licensed under the Apache License, Version 2.0 (the "License"); #
7# you may not use this file except in compliance with the License. #
8# You may obtain a copy of the License at #
9# #
10# http://www.apache.org/licenses/LICENSE-2.0 #
11# #
12# Unless required by applicable law or agreed to in writing, software #
13# distributed under the License is distributed on an "AS IS" BASIS, #
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15# See the License for the specific language governing permissions and #
16# limitations under the License. #
17################################################################################
18
19# This script package RIC deployment tools as a debian package
20
21VERSION=$1
22
23if [ -z "$VERSION" ];then
24echo "Please provide a version number."
25exit 1
26
27fi
28
29DPKG_BUILDPACKAGE=$(whereis dpkg-buildpackage | awk '{print $2}')
30
31if [ -z "$DPKG_BUILDPACKAGE" ];then
32echo "dpkg-buildpackage not found. Please run \"apt install -y dpkg-dev\""
33exit 1
34
35fi
36
37
38DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
39mkdir -p /tmp/ric-deployment-tools-$VERSION
40cp -r $DIR/../* /tmp/ric-deployment-tools-$VERSION/
41
42
43DIR=/tmp/ric-deployment-tools-$VERSION
44
45
46mkdir $DIR/debian
47
48cat <<EOF >$DIR/debian/changelog
49ric-deployment-tools ($VERSION) stable; urgency=low
50
51 * Release $VERSION
52
53 -- Zhe Huang <zhehuang@research.att.com> $(date -R)
54EOF
55
56cat <<EOF >$DIR/debian/compat
579
58EOF
59
60cat <<EOF >$DIR/debian/control
61Source: ric-deployment-tools
62Section: Miscellaneous
63Priority: optional
64Maintainer: Zhe Huang <zhehuang@research.att.com>
65Build-Depends: debhelper (>= 9)
66Standards-Version: 4.1.2
67Homepage: https://gerrit.o-ran-sc.org/r/admin/repos/it/dep
68#Vcs-Git: https://anonscm.debian.org/git/collab-maint/ric-deployment.git
69#Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/ric-deployment.git
70
71Package: ric-deployment-tools
72Architecture: all
73Depends: \${misc:Depends}
74Description: Utility tools to deploy RAN intelligent controller
75 ric-deployment-tools provides scripts and helm charts to deploy RIC platform components and RIC auxiliary functions.
76EOF
77
78cat <<EOF >$DIR/debian/rules
79#!/usr/bin/make -f
80# See debhelper(7) (uncomment to enable)
81# output every command that modifies files on the build system.
82#export DH_VERBOSE = 1
83
84
85# see FEATURE AREAS in dpkg-buildflags(1)
86#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
87
88# see ENVIRONMENT in dpkg-buildflags(1)
89# package maintainers to append CFLAGS
90#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
91# package maintainers to append LDFLAGS
92#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
93
94export DESTROOT=\$(CURDIR)/debian/ric-deployment-tools
95
96%:
97 dh \$@
98
99override_dh_auto_install:
100 dh_auto_install
101 install -d \$(DESTROOT)/opt/ric/ric-deployment-tools
102 rsync -a \$(CURDIR)/* \$(DESTROOT)/opt/ric/ric-deployment-tools --exclude debian
103# dh_make generated override targets
104# This is example for Cmake (See https://bugs.debian.org/641051 )
105#override_dh_auto_configure:
106# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=\$(DEB_HOST_MULTIARCH)
107
108
109EOF
110
111
112cd $DIR
113dpkg-buildpackage -us -uc
114
wrider3280e622019-11-05 12:13:28 -0500115EXPORT_PATH="${EXPORT_PATH:-/tmp/exported}"
116mkdir -p "${EXPORT_PATH}"
117cp /tmp/ric-deployment-tools_${VERSION}_all.deb "${EXPORT_PATH}"
Zhe Huang839d43f2019-07-12 12:58:37 -0400118
wrider3280e622019-11-05 12:13:28 -0500119echo "RIC it/dep repo has been packaged as /tmp/ric-deployment-tools_${VERSION}_all.deb."