1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-vps-admin.git synced 2025-02-12 18:41:52 +00:00

Create Debian package

This commit is contained in:
Ycarus 2020-06-11 10:06:11 +02:00
parent e1e3bfa51a
commit e2b7739168
7 changed files with 73 additions and 0 deletions

5
debian/changelog vendored Normal file
View file

@ -0,0 +1,5 @@
omr-vps-admin (0.1+20200608.git.e1e3bfa) unstable; urgency=medium
* initial package
-- OpenMPTCProuter <contact@openmptcprouter.com> Tue, 8 Jun 2020 14:36:01 +0200

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
10

14
debian/control vendored Normal file
View file

@ -0,0 +1,14 @@
Source: omr-vps-admin
Section: net
Priority: optional
Maintainer: OpenMPTCProuter <contact@openmptcprouter.com>
Build-Depends:
X-Python-Version: >= 3.2
Standards-Version: 0.0.1
Homepage: https://github.com/ysurac/openmptcprouter-vps-admin
Package: omr-vps-admin
Architecture: all
Multi-Arch: foreign
Depends: ${misc:Depends}, ${python3:Depends}, python3-uvicorn, python3-netaddr, python3-pip
Description: OpenMPTCProuter VPS admin rest api

3
debian/install vendored Normal file
View file

@ -0,0 +1,3 @@
omr-admin-config.json usr/share/omr-admin
omr-admin.py usr/bin
debian/omr-admin.service lib/systemd/system

12
debian/omr-admin.service vendored Normal file
View file

@ -0,0 +1,12 @@
[Unit]
Description=OMR-Admin
After=network.target network-online.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/omr-admin.py
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW
[Install]
WantedBy=multi-user.target

30
debian/postinst vendored Normal file
View file

@ -0,0 +1,30 @@
#!/bin/sh -e
test $DEBIAN_SCRIPT_DEBUG && set -v -x
action="$1"
oldversion="$2"
umask 022
OMR_ADMIN_PASS=$(od -vN "32" -An -tx1 /dev/urandom | tr '[:lower:]' '[:upper:]' | tr -d " \n")
# use debconf
. /usr/share/debconf/confmodule
pip3 -q install fastapi netjsonconfig python-multipart -U
if [ ! -f "/etc/openmptcprouter-vps-admin/omr-admin-config.json" ]; then
mkdir -p /etc/openmptcprouter-vps-admin
cp /usr/share/omr-admin/omr-admin-config.json /etc/openmptcprouter-vps-admin/omr-admin-config.json
sed -i "s:MySecretKey:$OMR_ADMIN_PASS:g" /etc/openmptcprouter-vps-admin/omr-admin-config.json
openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout /etc/openmptcprouter-vps-admin/key.pem -out /etc/openmptcprouter-vps-admin/cert.pem -subj "/C=US/ST=Oregon/L=Portland/O=OpenMPTCProuterVPS/OU=Org/CN=www.openmptcprouter.vps"
fi
systemctl enable omr-admin.service
systemctl restart omr-admin.service
db_stop
#DEBHELPER#
exit 0
# vim:set ai et sts=2 sw=2 tw=0:

8
debian/rules vendored Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/make -f
#export DH_VERBOSE = 1
# Security Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh $@ --with python3