Skip to content

Commit

Permalink
disto UPDATE script updates
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvasko committed Aug 10, 2023
1 parent d1fe374 commit 771c768
Show file tree
Hide file tree
Showing 14 changed files with 257 additions and 89 deletions.
1 change: 0 additions & 1 deletion distro/pkg/deb/compat

This file was deleted.

48 changes: 24 additions & 24 deletions distro/pkg/deb/control
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
Source: netopeer2
Section: admin
Homepage: https://github.com/CESNET/netopeer2/
Maintainer: CESNET <mvasko@cesnet.cz>
Section: libs
Maintainer: Michal Vaško <mvasko@cesnet.cz>
Priority: optional
Standards-Version: 4.5.0
Standards-Version: 4.5.1.0
Build-Depends: cmake,
debhelper (>= 10),
libyang2-dev (>= 2),
libnetconf2-dev (>= 2),
libsysrepo-dev (>= 2),
debhelper-compat (>= 12),
graphviz,
libcmocka-dev,
libsystemd-dev,
pkg-config
Vcs-Browser: https://github.com/CESNET/netopeer2/tree/master
Vcs-Git: https://github.com/CESNET/netopeer2.git
libnetconf2-dev (>= 2.0.0),
libssh-dev,
libssl-dev,
libsysrepo-dev (>= 2.0.0),
libyang2-dev (>= 2.0.0),
pkg-config,
sysrepo-tools (>= 2.0.0) | sysrepo (>= 2.0.0)
Homepage: https://github.com/CESNET/netopeer2/

Package: netopeer2
Depends: ${misc:Depends},
${shlibs:Depends},
sysrepo-tools,
openssl
Depends: openssl,
sysrepo (>= 2.2.95-1~),
${misc:Depends},
${shlibs:Depends}
Section: admin
Architecture: any
Description: NETCONF server
Description: server for implementing network configuration management
Netopeer2 is a server for implementing network configuration management based
on the NETCONF Protocol. This is the second generation, originally available
as the Netopeer project. Netopeer2 is based on the new generation of the
NETCONF and YANG libraries - libyang and libnetconf2. The Netopeer2 server
uses sysrepo as a NETCONF datastore implementation.
.
Netopeer2 configuration is stored as "ietf-netconf-server" YANG module
data in sysrepo. They are accessible for "root" and any user beloning to
the group "netconf", which is created if it does not exist.
on the NETCONF Protocol. This is the second generation, originally available as
the Netopeer project. Netopeer2 is based on the new generation of the NETCONF
and YANG libraries - libyang and libnetconf2. The Netopeer2 server uses sysrepo
as a NETCONF datastore implementation.
81 changes: 56 additions & 25 deletions distro/pkg/deb/copyright
Original file line number Diff line number Diff line change
@@ -1,33 +1,64 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: netopeer2
Source: https://github.com/CESNET/netopeer2

Files: *
Copyright: 2018-2021 by CESNET, z.s.p.o.
License: BSD-3-Clause
Copyright: 2015-2023 CESNET, z.s.p.o.
License: BSD-3-clause

Files: cli/linenoise/*
Copyright: 2010-2014 Salvatore Sanfilippo
2010-2013 Pieter Noordhuis
License: BSD-2-clause

Files: modules/*
Copyright: 2010-2019 IETF Trust and the persons identified as authors of the code
License: BSD-3-clause

Files: CMakeModules/FindCMocka.cmake
Copyright: 2011-2012 Andreas Schneider
License: BSD-3-clause

License: BSD-2-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
modification, are permitted provided that the following conditions are met:
.
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License: BSD-3-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 4 additions & 0 deletions distro/pkg/deb/gbp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[DEFAULT]
pristine-tar = False
debian-branch = master
upstream-tree = SLOPPY
17 changes: 17 additions & 0 deletions distro/pkg/deb/netopeer2-server.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description=server for implementing network configuration management
After=network.target

[Service]
Type=notify
ExecStart=/usr/bin/netopeer2-server -d -v 1
PIDFile=/run/netopeer2-server.pid
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=yes
ProtectHome=yes
SystemCallArchitectures=native
Restart=always

[Install]
WantedBy=multi-user.target
11 changes: 7 additions & 4 deletions distro/pkg/deb/netopeer2.install
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
usr/sbin/netopeer2-server
scripts/merge_config.sh /usr/share/netopeer2/
scripts/merge_hostkey.sh /usr/share/netopeer2/
scripts/remove.sh /usr/share/netopeer2/
scripts/setup.sh /usr/share/netopeer2/
usr/bin/netopeer2-cli
usr/share/man/man1
usr/share/man/man8
usr/lib/systemd/system/netopeer2-server.service
usr/bin/netopeer2-server
usr/share/man/man1/netopeer2-cli.1
usr/share/man/man8/netopeer2-server.8
usr/share/yang/modules/netopeer2
56 changes: 56 additions & 0 deletions distro/pkg/deb/netopeer2.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/sh
# postinst script for netopeer2
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
configure)
if ! getent group netconf > /dev/null; then
addgroup --quiet --system netconf
fi
env - \
SYSREPOCTL_EXECUTABLE=sysrepoctl \
NP2_MODULE_DIR=/usr/share/yang/modules/netopeer2 \
NP2_MODULE_PERMS=660 \
NP2_MODULE_OWNER=root \
NP2_MODULE_GROUP=netconf \
bash -r /usr/share/netopeer2/setup.sh
env - \
SYSREPOCFG_EXECUTABLE=sysrepocfg \
OPENSSL_EXECUTABLE=openssl \
bash -r /usr/share/netopeer2/merge_hostkey.sh
env - \
SYSREPOCFG_EXECUTABLE=sysrepocfg \
bash -r /usr/share/netopeer2/merge_config.sh
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
53 changes: 53 additions & 0 deletions distro/pkg/deb/netopeer2.postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh
# postrm script for netopeer2
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
purge)
if [ -x "$(command -v delgroup)" ]; then
delgroup --quiet --system netconf > /dev/null || true
else
echo >&2 "not removing netconf system group because delgroup command was not found"
fi
;;
remove)
env - \
SYSREPOCTL_EXECUTABLE=sysrepoctl \
NP2_MODULE_DIR=/usr/share/yang/modules/netopeer2 \
NP2_MODULE_PERMS=660 \
NP2_MODULE_OWNER=root \
NP2_MODULE_GROUP=netconf \
bash -r /usr/share/netopeer2/remove.sh
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;

*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
12 changes: 0 additions & 12 deletions distro/pkg/deb/postinst

This file was deleted.

5 changes: 0 additions & 5 deletions distro/pkg/deb/postrm

This file was deleted.

34 changes: 24 additions & 10 deletions distro/pkg/deb/rules
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

# Hardening
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# needed for CMake that ignores CPPFLAGS
CFLAGS+=$(CPPFLAGS)
CXXFLAGS+=$(CPPFLAGS)

# be strict when comparing symbols in netopeer2-1
export DPKG_GENSYMBOLS_CHECK_LEVEL=4

# use the executable from the system
SYSREPOCFG_EXECUTABLE=/usr/bin/sysrepoctl

%:
dh $@
dh $@ --buildsystem=cmake --builddir=build

override_dh_auto_configure:
dh_auto_configure -- \
-DCMAKE_BUILD_TYPE:String="Release" \
-DGENERATE_HOSTKEY=OFF \
-DINSTALL_MODULES=OFF \
-DMERGE_LISTEN_CONFIG=OFF
dh_auto_configure --builddir=build -- -DBUILD_CLI=ON -DBUILD_TESTS=ON -DINSTALL_MODULES=OFF -DGENERATE_HOSTKEY=OFF -DMERGE_LISTEN_CONFIG=OFF -DPIDFILE_PREFIX=/run -DSERVER_DIR=/var/lib/netopeer2

override_dh_auto_install:
dh_auto_install --builddir=build --destdir=$(CURDIR)/debian/tmp

# to handle changed DESTDIR to debian/<package> instead of debian/tmp for a single binary package
override_dh_install:
override_dh_missing:
dh_missing --fail-missing

override_dh_auto_test:
dh_auto_test --builddir=build || ( make -C build test_clean; exit 1; )
make -C build test_clean
4 changes: 4 additions & 0 deletions distro/pkg/deb/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version=4
opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%netopeer2-$1.tar.gz%" \
https://github.com/CESNET/Netopeer2/releases \
(?:.*?/)?v?(\d[\d.]*)(?:-r\d+)?\.tar\.gz debian uupdate
15 changes: 9 additions & 6 deletions distro/pkg/rpm/netopeer2-server.service
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
[Unit]
Description=netopeer2 NETCONF server
#After=
Description=server for implementing network configuration management
After=network.target

[Service]
Type=notify
ExecStart=/usr/sbin/netopeer2-server -d -v2
Restart=always
ExecStart=/usr/bin/netopeer2-server -d -v 1
PIDFile=/run/netopeer2-server.pid
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=yes
ProtectHome=yes
SystemCallArchitectures=native
KillMode=control-group
SupplementaryGroups=sysrepo
Restart=always

[Install]
WantedBy=multi-user.target
Loading

0 comments on commit 771c768

Please sign in to comment.