From 7cda247b95b68b5b2c8f9540051347defb3151e9 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Mon, 21 Jan 2019 09:17:07 +0000
Subject: [PATCH] Build a Debian package

---
 .gitlab-ci.yml                   | 17 +----------------
 debian/changelog                 |  5 +++++
 debian/compat                    |  1 +
 debian/control                   | 13 +++++++++++++
 debian/copyright                 | 25 +++++++++++++++++++++++++
 debian/float-debug-proxy.service | 20 ++++++++++++++++++++
 debian/rules                     | 18 ++++++++++++++++++
 debian/source/format             |  1 +
 8 files changed, 84 insertions(+), 16 deletions(-)
 create mode 100644 debian/changelog
 create mode 100644 debian/compat
 create mode 100644 debian/control
 create mode 100644 debian/copyright
 create mode 100644 debian/float-debug-proxy.service
 create mode 100755 debian/rules
 create mode 100644 debian/source/format

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6eafc22..f9d4632 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,16 +1 @@
-stages:
-  - build
-
-build:
-  stage: build
-  image: "ai/test:go"
-  script:
-    - mkdir -p build/src/git.autistici.org/ai3
-    - ln -s $PWD build/src/git.autistici.org/ai3/float-debug-proxy
-    - env GOPATH=$PWD/build go build -o float-debug-proxy git.autistici.org/ai3/float-debug-proxy
-    - strip float-debug-proxy
-  artifacts:
-    paths:
-      - float-debug-proxy
-  only:
-    - master
+include: "https://git.autistici.org/ai3/build-deb/raw/master/ci-common.yml"
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..0784b5b
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+float-debug-proxy (0.1) unstable; urgency=medium
+
+  * New release.
+
+ -- Autistici/Inventati <debian@autistici.org>  Mon, 21 Jan 2019 09:14:24 +0000
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..3db962e
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,13 @@
+Source: float-debug-proxy
+Section: net
+Priority: extra
+Maintainer: Autistici/Inventati <debian@autistici.org>
+Build-Depends: debhelper (>= 8.0.0), golang-go, dh-golang, dh-systemd
+Standards-Version: 3.9.4
+
+Package: float-debug-proxy
+Architecture: any
+Depends: ${misc:Depends}
+Built-Using: ${misc:Built-Using}
+Description: SOCKS5 proxy for debugging float clusters.
+ SOCKS5 proxy for debugging float clusters.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..e1cae0d
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,25 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: float-debug-proxy
+Source: <https://git.autistici.org/ai3/float-debug-proxy>
+
+Files: *
+Copyright: 2018 Autistici/Inventati <debian@autistici.org>
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/debian/float-debug-proxy.service b/debian/float-debug-proxy.service
new file mode 100644
index 0000000..1dcf04c
--- /dev/null
+++ b/debian/float-debug-proxy.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Float debug proxy
+After=network.service
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/float-debug-proxy
+Restart=on-failure
+User=nobody
+
+NoNewPrivileges=yes
+PrivateTmp=yes
+PrivateDevices=yes
+ProtectHome=yes
+ProtectSystem=full
+ReadOnlyDirectories=/
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..95e32d5
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,18 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+export DH_GOPKG = git.autistici.org/ai3/float-debug-proxy
+export DH_GOLANG_EXCLUDES = vendor
+
+%:
+	dh $@ --with golang --with systemd --buildsystem golang
+
+override_dh_auto_test:
+
+override_dh_install:
+	rm -fr $(CURDIR)/debian/float-debug-proxy/usr/share/gocode
+	dh_install
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
-- 
GitLab