From df2fbdc9bd4387ee72d2b38df9abf0778175c2d4 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Tue, 15 Feb 2022 22:49:00 -0500 Subject: add initial debian package recipe --- .gitignore | 7 ++++++ debian/README.Debian | 5 +++++ debian/changelog | 5 +++++ debian/control | 16 +++++++++++++ debian/copyright | 47 +++++++++++++++++++++++++++++++++++++++ debian/patches/series | 2 ++ debian/patches/wsgi-ini-fix.patch | 13 +++++++++++ debian/postinst | 35 +++++++++++++++++++++++++++++ debian/postrm | 23 +++++++++++++++++++ debian/prerm | 33 +++++++++++++++++++++++++++ debian/rules | 20 +++++++++++++++++ debian/source/format | 1 + debian/source/local-options | 2 ++ debian/stackbin.dsc | 14 ++++++++++++ debian/stackbin.lintian-overrides | 1 + debian/watch | 2 ++ stackbin.py | 6 ++--- 17 files changed, 229 insertions(+), 3 deletions(-) create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/patches/series create mode 100644 debian/patches/wsgi-ini-fix.patch create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100644 debian/prerm create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/local-options create mode 100644 debian/stackbin.dsc create mode 100644 debian/stackbin.lintian-overrides create mode 100644 debian/watch diff --git a/.gitignore b/.gitignore index b118fcf..83a7c37 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,10 @@ log/ *.pid *.conf *.ini +debian/.debhelper/ +debian/*debhelper* +debian/files +debian/*.substvars +debian/fuss/ +debian/stackbin/ +.pc diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..b74e6c4 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,5 @@ +stackbin for Devuan + +To run stackbin, you will probably need to a2enmods these three mods: proxy rewrite ssl + + -- B. Stack Tue, 15 Feb 2022 19:07:18 -0500 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..67536b3 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +stackbin (0.0.1-1) obs; urgency=low + + * Initial release. Closes: packages-want#005 + + -- B. Stack Tue, 15 Feb 2022 19:07:18 -0500 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..bd3824a --- /dev/null +++ b/debian/control @@ -0,0 +1,16 @@ +Source: stackbin +Section: web +Priority: optional +Maintainer: B. Stack +Build-Depends: debhelper-compat (= 12) +Standards-Version: 4.5.0 +Homepage: https://bgstack15.ddns.net/ + +Package: stackbin +Architecture: all +Multi-Arch: foreign +Pre-Depends: adduser +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: pastebin in flask + A simple pastebin written in flask with a password- + protected admin panel. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..13f285a --- /dev/null +++ b/debian/copyright @@ -0,0 +1,47 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: stackbin +Upstream-Contact: +Source: +# +# Please double check copyright with the licensecheck(1) command. + +Files: .gitignore + extra/Makefile + extra/pip-helper.sh + extra/stackbin.conf.apache + extra/stackbin.conf.nginx + extra/stackbin.service + extra/stackbin.spec + extra/stackbin.sysusers + initdb.py + manage.py + requirements.txt + stackbin.bin + stackbin.conf.example + stackbin.py + stackbin.wsgi.ini.example + stackbin_auth.py + static/style.css + templates/_pagination.html + templates/admin.html + templates/new_paste.html + templates/show_paste.html +Copyright: __NO_COPYRIGHT_NOR_LICENSE__ +License: __NO_COPYRIGHT_NOR_LICENSE__ + +Files: extra/stackbin.init +Copyright: __NO_COPYRIGHT__ in: extra/stackbin.init +License: __UNKNOWN__ + Do NOT "set -e" + . + PATH should only include /usr/* if it runs after the mountnfs.sh script + +#---------------------------------------------------------------------------- +# xml and html files (skipped): +# README.md +# templates/layout.html +# templates/login_form.html + +#---------------------------------------------------------------------------- +# Files marked as NO_LICENSE_TEXT_FOUND may be covered by the following +# license/copyright files. diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..411aacf --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +# You must remove unused comment lines for the released package. +wsgi-ini-fix.patch diff --git a/debian/patches/wsgi-ini-fix.patch b/debian/patches/wsgi-ini-fix.patch new file mode 100644 index 0000000..7823ca6 --- /dev/null +++ b/debian/patches/wsgi-ini-fix.patch @@ -0,0 +1,13 @@ +--- a/stackbin.wsgi.ini.example ++++ b/stackbin.wsgi.ini.example +@@ -1,8 +1,8 @@ + [uwsgi] + # CentOS 7 uwsgi needs "python36" added to this list. +-plugins = logfile, python36 ++#plugins = logfile, python36 + # Devuan Ceres does not. +-#plugins = logfile ++plugins = logfile + http-socket = 127.0.0.1:4680 + wsgi-file = /usr/libexec/stackbin/stackbin.py + callable = app diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..fdcc7ee --- /dev/null +++ b/debian/postinst @@ -0,0 +1,35 @@ +#!/bin/sh +set -e + +#DEBHELPER# +OUT=/dev/null +USERNAME=stackbin +HOME=/var/stackbin +SERVICE=stackbin + +case "$1" in + configure) + update-rc.d ${SERVICE} defaults + if ! getent passwd ${USERNAME} 1>${OUT} 2>&1 ; + then + echo "Creating ${USERNAME} system user & group..." + adduser --quiet --system --home $HOME \ + --disabled-password --group \ + --gecos "stackbin system user" \ + ${USERNAME} > ${OUT} 2>&1 + fi + chown ${USERNAME}:${USERNAME} \ + ${HOME} ${HOME}/* \ + /var/log/${SERVICE} /var/log/${SERVICE}/*log 1>/${OUT} 2>&1 || : + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..87735c2 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +#DEBHELPER# +OUT=/dev/null +HOME=/var/stackbin +SERVICE=stackbin + +case "$1" in + purge) + update-rc.d -f ${SERVICE} remove + rm -f ${HOME}/upload/.*.meta 1>${OUT} 2>&1 || : + ;; + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..8c70071 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,33 @@ +#!/bin/sh +set -e +OUT=/dev/null +HOME=/var/stackbin +SERVICE=stackbin + +case "$1" in + remove) + test -x /usr/sbin/invoke-rc.d && \ + INIT="invoke-rc.d ${SERVICE}" || \ + INIT="/etc/init.d/${SERVICE}" + ${INIT} stop + ;; + + purge) + rm -f ${HOME}/${SERVICE}-wsgi.pid 1>${OUT} 2>&1 || : + ;; + + upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..b123419 --- /dev/null +++ b/debian/rules @@ -0,0 +1,20 @@ +#!/usr/bin/make -f +# You must remove unused comment lines for the released package. +#export DH_VERBOSE = 1 +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed +export APPNAME=stackbin + +%: + dh $@ --sourcedirectory=extra + +override_dh_auto_install: + dh_auto_install -- prefix=/usr \ + DEFAULTDIR='$$(DESTDIR)/etc/default' \ + APACHEDIR='$$(SYSCONFDIR)/apache2/sites-available' + +override_dh_gencontrol: + printf "misc:Depends=" > debian/${APPNAME}.substvars + make -C extra DISTRO=devuan deplist SEPARATOR=',' | grep -vE 'make\[[0-9]' >> debian/${APPNAME}.substvars + dh_gencontrol diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/local-options b/debian/source/local-options new file mode 100644 index 0000000..00131ee --- /dev/null +++ b/debian/source/local-options @@ -0,0 +1,2 @@ +#abort-on-upstream-changes +#unapply-patches diff --git a/debian/stackbin.dsc b/debian/stackbin.dsc new file mode 100644 index 0000000..4a3f24a --- /dev/null +++ b/debian/stackbin.dsc @@ -0,0 +1,14 @@ +Format: 3.0 (quilt) +Source: stackbin +Binary: stackbin +Architecture: all +Version: 0.0.1-1 +Maintainer: B. Stack +Homepage: https://bgstack15.ddns.net/ +Standards-Version: 4.5.0 +Build-Depends: debhelper-compat (= 12) +Package-List: + stackbin deb web optional arch=all +Files: + 00000000000000000000000000000000 1 stackbin_0.0.1.orig.tar.gz + 00000000000000000000000000000000 1 stackbin_0.0.1-1.debian.tar.xz diff --git a/debian/stackbin.lintian-overrides b/debian/stackbin.lintian-overrides new file mode 100644 index 0000000..4276455 --- /dev/null +++ b/debian/stackbin.lintian-overrides @@ -0,0 +1 @@ +copyright-has-url-from-dh_make-boilerplate diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..76575dc --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +# You must remove unused comment lines for the released package. +version=3 diff --git a/stackbin.py b/stackbin.py index 9d86338..89ec493 100644 --- a/stackbin.py +++ b/stackbin.py @@ -13,9 +13,9 @@ # fuss.py # Improve: # Dependencies: -# req-INCOMPLETE-devuan: python3-pytimeparse, python3-uwsgidecorators -# req-fedora: uwsgi, uwsgi-logger-file, python36-flask uwsgi-plugin-python36 python36-sqlalchemy, python36-uwsgidecorators, python3-pytimeparse, python3-uwsgidecorators -# req-centos7: uwsgi, uwsgi-logger-file, python36-flask uwsgi-plugin-python36 python36-sqlalchemy, python36-uwsgidecorators +# dep-devuan: python3-pytimeparse, python3-uwsgidecorators, python3-flask, python3:any, uwsgi-core, uwsgi-plugin-python3 +# dep-fedora: uwsgi, uwsgi-logger-file, python3-flask, uwsgi-plugin-python3, python3-sqlalchemy, python3-uwsgidecorators, python3-pytimeparse, python3-uwsgidecorators +# dep-centos7: uwsgi, uwsgi-logger-file, python36-flask, uwsgi-plugin-python36, python36-sqlalchemy, python36-uwsgidecorators # pip-centos7: flask-sqlalchemy, pytimeparse # Documentation: see README.md from datetime import datetime, timedelta -- cgit