Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit f88fe10

Browse files
DmitryZabolotskyalexvanin
authored andcommitted
[#223] Debian packaging
Debian package includes: - user creation; - directories and permissions; - unit file for systemd Signed-off-by: Dmitriy Zabolotskiy <[email protected]>
1 parent f4fbd93 commit f88fe10

17 files changed

+318
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ testfile
1616

1717
coverage.txt
1818
coverage.html
19+
20+
# debhelpers
21+
**/.debhelper

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ BINS = $(BINDIR)/neofs-http-gw
1616

1717
.PHONY: all $(BINS) $(DIRS) dep docker/ test cover fmt image image-push dirty-image lint docker/lint version clean
1818

19+
# .deb package versioning
20+
OS_RELEASE = $(shell lsb_release -cs)
21+
PKG_VERSION ?= $(shell echo $(VERSION) | sed "s/^v//" | \
22+
sed -E "s/(.*)-(g[a-fA-F0-9]{6,8})(.*)/\1\3~\2/" | \
23+
sed "s/-/~/")-${OS_RELEASE}
24+
.PHONY: debpackage debclean
25+
1926
# Make all binaries
2027
all: $(BINS)
2128

@@ -111,4 +118,16 @@ clean:
111118
rm -rf vendor
112119
rm -rf $(BINDIR)
113120

121+
# Package for Debian
122+
debpackage:
123+
dch --package neofs-http-gw \
124+
--controlmaint \
125+
--newversion $(PKG_VERSION) \
126+
--distribution $(OS_RELEASE) \
127+
"Please see CHANGELOG.md for code changes for $(VERSION)"
128+
dpkg-buildpackage --no-sign -b
129+
130+
debclean:
131+
dh clean
132+
114133
include help.mk

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
neofs-http-gw (0.0.0) stable; urgency=medium
2+
3+
* Please see CHANGELOG.md
4+
5+
-- NeoSPCC <[email protected]> Wed, 24 Aug 2022 18:29:49 +0300

debian/control

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Source: neofs-http-gw
2+
Section: neofs
3+
Priority: optional
4+
Maintainer: NeoSPCC <[email protected]>
5+
Build-Depends: debhelper-compat (= 13), dh-sysuser, git, devscripts
6+
Standards-Version: 4.5.1
7+
Homepage: https://fs.neo.org/
8+
Vcs-Git: https://github.com/nspcc-dev/neofs-http-gw.git
9+
Vcs-Browser: https://github.com/nspcc-dev/neofs-http-gw
10+
11+
Package: neofs-http-gw
12+
Architecture: any
13+
Depends: ${misc:Depends}
14+
Description: NeoFS HTTP Gateway bridges NeoFS internal protocol and HTTP standard.
15+

debian/copyright

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: neofs-http-gw
3+
Upstream-Contact: [email protected]
4+
Source: https://github.com/nspcc-dev/neofs-http-gw
5+
6+
Files: *
7+
Copyright: 2018-2022 NeoSPCC (@nspcc-dev), contributors of neofs-http-gw project
8+
(https://github.com/nspcc-dev/neofs-http-gw/blob/master/CREDITS.md)
9+
10+
11+
License: GPL-3
12+
This program is free software: you can redistribute it and/or modify it
13+
under the terms of the GNU General Public License as published
14+
by the Free Software Foundation; version 3.
15+
16+
This program is distributed in the hope that it will be useful,
17+
but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19+
General Public License for more details.
20+
21+
You should have received a copy of the GNU General Public License
22+
along with this program or at /usr/share/common-licenses/GPL-3.
23+
If not, see <http://www.gnu.org/licenses/>.

debian/neofs-http-gw.dirs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
etc/neofs
2+
srv/neofs_cache

debian/neofs-http-gw.docs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docs/gate-configuration.md
2+
README.md
3+
CREDITS.md
4+
CONTRIBUTING.md

debian/neofs-http-gw.examples

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
config/*

debian/neofs-http-gw.install

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin/neofs-http-gw usr/bin
2+
config/config.yaml etc/neofs/http

debian/neofs-http-gw.postinst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/sh
2+
# postinst script for neofs-http-gw
3+
#
4+
# see: dh_installdeb(1)
5+
6+
set -e
7+
8+
# summary of how this script can be called:
9+
# * <postinst> `configure' <most-recently-configured-version>
10+
# * <old-postinst> `abort-upgrade' <new version>
11+
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12+
# <new-version>
13+
# * <postinst> `abort-remove'
14+
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15+
# <failed-install-package> <version> `removing'
16+
# <conflicting-package> <version>
17+
# for details, see https://www.debian.org/doc/debian-policy/ or
18+
# the debian-policy package
19+
20+
21+
case "$1" in
22+
configure)
23+
USERNAME=http
24+
id -u neofs-$USERNAME >/dev/null 2>&1 || useradd -s /usr/sbin/nologin -d /srv/neofs_cache --system -M -U -c "NeoFS HTTP gateway" neofs-$USERNAME
25+
if ! dpkg-statoverride --list /etc/neofs/$USERNAME >/dev/null; then
26+
chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME
27+
chown -f root:neofs-$USERNAME /etc/neofs/$USERNAME/config.yaml || true
28+
chmod -f 0750 /etc/neofs/$USERNAME
29+
chmod -f 0640 /etc/neofs/$USERNAME/config.yaml || true
30+
fi
31+
USERDIR=$(getent passwd "neofs-$USERNAME" | cut -d: -f6)
32+
if ! dpkg-statoverride --list neofs-$USERDIR >/dev/null; then
33+
chown -f neofs-$USERNAME: $USERDIR
34+
fi
35+
;;
36+
37+
abort-upgrade|abort-remove|abort-deconfigure)
38+
;;
39+
40+
*)
41+
echo "postinst called with unknown argument \`$1'" >&2
42+
exit 1
43+
;;
44+
esac
45+
46+
# dh_installdeb will replace this with shell code automatically
47+
# generated by other debhelper scripts.
48+
49+
#DEBHELPER#
50+
51+
exit 0

0 commit comments

Comments
 (0)