From 712267735194637a1c50a3c5840fd364990c49f3 Mon Sep 17 00:00:00 2001 From: William Petit Date: Thu, 16 Jul 2020 22:33:51 +0200 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20r=C3=A8gles=20packaging?= =?UTF-8?q?=20Debian?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/control | 10 +++++----- debian/daddy.service | 5 ++--- debian/rules | 37 +++++++++++++++++++++++++++---------- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/debian/control b/debian/control index e52302d..9ebf0a3 100644 --- a/debian/control +++ b/debian/control @@ -1,14 +1,14 @@ Source: daddy Section: unknown Priority: optional -Maintainer: Cadoles -Build-Depends: debhelper (>= 8.0.0), wget, ca-certificates, tar, curl +Maintainer: Cadoles +Build-Depends: debhelper (>= 8.0.0), wget, ca-certificates, tar Standards-Version: 3.9.4 Homepage: http://forge.cadoles.com/Cadoles/daddy Vcs-Git: http://forge.cadoles.com/Cadoles/daddy.git Vcs-Browser: http://forge.cadoles.com/Cadoles/daddy Package: daddy -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, nginx-full, super-graph, postgresql -Description: Application de gestion des DADs à Cadoles +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Daddy app diff --git a/debian/daddy.service b/debian/daddy.service index a37f48c..e96bf1e 100644 --- a/debian/daddy.service +++ b/debian/daddy.service @@ -1,11 +1,10 @@ [Unit] -Description=Service "super-graph" pour l'application Daddy +Description=Daddy app After=network-online.target [Service] Type=simple -EnvironmentFile=/etc/systemd/system/daddy.env -ExecStart=/usr/bin/super-graph serv --path /usr/share/daddy/server/config +ExecStart=/usr/bin/daddy -workdir /usr/share/daddy -config /etc/daddy/config.yml Restart=on-failure [Install] diff --git a/debian/rules b/debian/rules index f502b48..402c74c 100644 --- a/debian/rules +++ b/debian/rules @@ -4,6 +4,15 @@ # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 +GO_VERSION := 1.13.5 +OS := linux +ARCH := amd64 +GOPATH=$(HOME)/go + +ifeq (, $(shell which go 2>/dev/null)) +override_dh_auto_build: install-go +endif + ifeq (, $(shell which node 2>/dev/null)) override_dh_auto_build: install-nodejs endif @@ -11,23 +20,31 @@ endif %: dh $@ --with systemd -override_dh_auto_build: - cd frontend && npm install && npm run build +override_dh_auto_build: $(GOPATH) + GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" go mod vendor + GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" ARCH_TARGETS=$(ARCH) make release + +$(GOPATH): + mkdir -p $(GOPATH) + +install-go: + wget https://dl.google.com/go/go$(GO_VERSION).$(OS)-$(ARCH).tar.gz + tar -C /usr/local -xzf go$(GO_VERSION).$(OS)-$(ARCH).tar.gz install-nodejs: wget -O- https://deb.nodesource.com/setup_12.x | bash - apt-get install -y nodejs override_dh_auto_install: - mkdir -p debian/daddy/usr/share/daddy/client/public - mkdir -p debian/daddy/usr/share/daddy/server/config - mkdir -p debian/daddy/etc/nginx/sites-available - mkdir -p debian/daddy/etc/systemd/system - cp -r frontend/dist/* debian/daddy/usr/share/daddy/client/public/ - cp -r backend/config/* debian/daddy/usr/share/daddy/server/config/ - cp misc/debian/nginx/daddy.conf debian/daddy/etc/nginx/sites-available/ - cp misc/debian/systemd/daddy.env debian/daddy/etc/systemd/system/ + mkdir -p debian/daddy/usr/share/daddy + mkdir -p debian/daddy/etc/daddy + mkdir -p debian/daddy/usr/bin + + cp -r release/server-$(OS)-$(ARCH)/* debian/daddy/usr/share/daddy/ + + mv debian/daddy/usr/share/daddy/bin/server debian/daddy/usr/bin/daddy + mv debian/daddy/usr/share/daddy/server.conf debian/daddy/etc/daddy/config.yml install -d debian/daddy