Taking in Helm v2.17.0
[it/dep.git] / bin / package-ric-deployment-tools
1 #!/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
21 VERSION=$1
22
23 if [ -z "$VERSION" ];then
24 echo "Please provide a version number."
25 exit 1
26
27 fi
28
29 DPKG_BUILDPACKAGE=$(whereis dpkg-buildpackage | awk '{print $2}')
30
31 if [ -z "$DPKG_BUILDPACKAGE" ];then
32 echo "dpkg-buildpackage not found. Please run \"apt install -y dpkg-dev\""
33 exit 1
34
35 fi
36
37
38 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
39 mkdir -p /tmp/ric-deployment-tools-$VERSION
40 cp -r $DIR/../* /tmp/ric-deployment-tools-$VERSION/
41
42
43 DIR=/tmp/ric-deployment-tools-$VERSION
44
45
46 mkdir $DIR/debian
47
48 cat <<EOF >$DIR/debian/changelog
49 ric-deployment-tools ($VERSION) stable; urgency=low
50   
51   * Release $VERSION
52
53  -- Zhe Huang <zhehuang@research.att.com>  $(date -R)
54 EOF
55
56 cat <<EOF >$DIR/debian/compat
57 9
58 EOF
59
60 cat <<EOF >$DIR/debian/control
61 Source: ric-deployment-tools
62 Section: Miscellaneous
63 Priority: optional
64 Maintainer: Zhe Huang <zhehuang@research.att.com>
65 Build-Depends: debhelper (>= 9)
66 Standards-Version: 4.1.2
67 Homepage: 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
71 Package: ric-deployment-tools
72 Architecture: all
73 Depends: \${misc:Depends}
74 Description: 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.
76 EOF
77
78 cat <<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
94 export DESTROOT=\$(CURDIR)/debian/ric-deployment-tools
95
96 %:
97         dh \$@
98
99 override_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
109 EOF
110
111
112 cd $DIR
113 dpkg-buildpackage -us -uc
114
115 EXPORT_PATH="${EXPORT_PATH:-/tmp/exported}"
116 mkdir -p "${EXPORT_PATH}"
117 cp /tmp/ric-deployment-tools_${VERSION}_all.deb "${EXPORT_PATH}"
118
119 echo "RIC it/dep repo has been packaged as /tmp/ric-deployment-tools_${VERSION}_all.deb."