networking-l2gw debian packaging and installation

script to create and install debian package for networking-l2gw,
and for starting neutron-l2gateway-agent.

Change-Id: I2395a82f877c4b171061d45dbb951e9da4401d25
changes/27/163827/12
vikas 2015-03-12 06:45:56 -07:00
parent a1338e224b
commit 642fb61322
8 changed files with 192 additions and 0 deletions

View File

@ -0,0 +1,59 @@
Debian packaging and installation of neutron-l2gateway-agent.
Prior requirements
script install_l2gateway_agent.sh will run on neutron installed and configured nodes
(controller, compute and network nodes).
install_l2gateway_agent.sh will create and install debian package of networking-l2gw,
and it will start neutron-l2gateway-agent.
Creation of debian package requires copyright, changelog, control, compat
and rules file inside the debian folder.
debian folder is to be placed inside the folder which needs to be packaged (networking-l2gw).
command dpkg-buildpackage -b, builds debian package of networking-l2gw which uses the files
mentioned inside debian folder to create debian package.
please refer https://www.debian.org/doc/manuals/maint-guide/dreq.en.html
for further details.
Installation procedure example:
The script will ask for further details for packaging and installing as shown below.
press ENTER for assigning default values to debian/changelog and debian/control file.
#info for debian/changelog file
enter package name for debian/changelog
networking-l2gw
enter package version for debian/changelog
1.0
#info for debian/control file
enter the networking-l2gw source name
networking-l2gw
enter the networking-l2gw package name
networking-l2gw
enter the version number
1.0
enter the maintainer info
user@hp.com
enter the architecture
all
enter the description title
l2gateway package
enter the description details
description details of l2gateway package
#info for neutron-l2gateway-agent.conf file
enter the networking-l2gw binary path
/usr/bin/neutron-l2gateway-agent
enter the neutron config file path
/etc/neutron/neutron.conf
enter the l2gateway agent config file path
/usr/etc/neutron/l2gateway_agent.ini
enter the l2gateway log file path
/var/log/neutron/l2gateway-agent.log
after execution of install_l2gateway_agent.sh check neutron-l2gateway-agent status
sudo service neutron-l2gateway-agent status
neutron-l2gateway-agent start/running, process 15276

View File

@ -0,0 +1,99 @@
#!/bin/bash
# Copyright (c) 2015 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License
if [ $(id -u -r) -ne 0 ]
then
echo "Requires root privileges. Please re-run using sudo."
exit 1
fi
#apt-get update -y
apt-get install devscripts -y
apt-get install debhelper -y
apt-get install dh-make -y
#read the package name and version,if not take default values and enter to
#debian/changelog file.
cd ..
if [ -f "debian/changelog" ]
then
echo info for debian/changelog file
echo enter package name for debian/changelog
read pck
sed -i 's/PACKAGE/'${pck:-networking-l2gw}'/' debian/changelog
echo enter package version for debian/changelog
read pck_ver
sed -i 's/VERSION/'${pck_ver:-1.0}'/' debian/changelog
fi
#control file contains various values which dpkg, dselect, apt-get, apt-cache, aptitude,
#and other package management tools will use to manage the package.
#It is defined by the Debian Policy Manual, 5 "Control files and their fields".
if [ -f "debian/control" ]
then
echo info for debian/control file
echo enter the networking-l2gw source name
read src_name
echo enter the networking-l2gw package name
read pck_name
echo enter the version number
read ver
echo enter the maintainer info
read maintainer_info
echo enter the architecture
read architecture
echo enter the description title
read description
echo enter the description details
read description_details
sed -i 's/source/'${src_name:-networking-l2gw}'/' debian/control
sed -i 's/package/'${pck_name:-networking-l2gw}'/' debian/control
sed -i 's/version/'${ver:-1.0}'/' debian/control
sed -i 's/maintainer/'${maintainer_info:-user@openstack}'/' debian/control
sed -i 's/arch/'${architecture:-all}'/' debian/control
sed -i 's/desc/'${description:-networking-l2gw}'/' debian/control
sed -i 's/desc_details/'${description_details:-networking-l2gw}'/' debian/control
fi
#dpkg-buildpackage, build binary or source packages from sources.
#-b Specifies a binary-only build, no source files are to be built and/or distributed.
echo building debian package
dpkg-buildpackage -b
cd ../
if [ -z "$pck_name" ]
then
pck_name="networking-l2gw"
fi
if [ -z "$pck_ver" ]
then
pck_ver=1.0
fi
if [ -z "$architecture" ]
then
architecture="all"
fi
echo installing $pck_name\_$pck_ver\_$architecture.deb
dpkg -i $pck_name\_$pck_ver\_$architecture.deb
echo enter the networking-l2gw binary path
read l2gw_bin_path
echo enter the neutron config file path
read neutron_conf
echo enter the l2gateway config file path
read l2gw_conf
echo enter the l2gateway log file path
read l2gw_log
sed -i 's|l2gw_bin_path|'$l2gw_bin_path'|' networking-l2gw/contrib/neutron-l2gateway-agent.conf
sed -i 's|neutron_conf|'$neutron_conf'|' networking-l2gw/contrib/neutron-l2gateway-agent.conf
sed -i 's|l2gw_conf|'$l2gw_conf'|' networking-l2gw/contrib/neutron-l2gateway-agent.conf
sed -i 's|l2gw_log|'$l2gw_log'|' networking-l2gw/contrib/neutron-l2gateway-agent.conf
cp networking-l2gw/contrib/neutron-l2gateway-agent.conf /etc/init/
service neutron-l2gateway-agent restart

View File

@ -0,0 +1,16 @@
# vim:set ft=upstart ts=2 et:
description "Neutron L2GW Agent"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
chdir /var/run
pre-start script
mkdir -p /var/run/neutron
chown neutron:root /var/run/neutron
end script
exec start-stop-daemon --start --chuid neutron --exec l2gw_bin_path -- --config-file=neutron_conf --config-file=l2gw_conf --log-file l2gw_log

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
PACKAGE (VERSION) UNRELEASED; urgency=medium
* Initial release. (Closes: #XXXXXX)
-- root <root@user> Mon, 23 Mar 2015 02:17:32 -0700

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

8
debian/control vendored Normal file
View File

@ -0,0 +1,8 @@
Source: source
Version: version
Maintainer: maintainer
Package: package
Architecture: arch
Description: desc
desc_details

0
debian/copyright vendored Normal file
View File

4
debian/rules vendored Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/make -f
%:
dh $@ --with python2