From 330fb9d86f00265145f35334d310f633351bd6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= Date: Wed, 23 Oct 2013 14:49:52 +0200 Subject: [PATCH] debian: first release --- control | 1 + files | 1 - init.d | 3 +-- local_config.py | 54 +++++++++++++++++++++++++++++++++---------------- postinst | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ rules | 5 +++++ 6 files changed, 98 insertions(+), 20 deletions(-) delete mode 100644 files mode change 100644 => 100755 init.d create mode 100644 postinst diff --git a/control b/control index 7b3c8c7..82ff86a 100644 --- a/control +++ b/control @@ -4,6 +4,7 @@ Section: python Priority: optional Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7.4.3) Standards-Version: 3.9.1 +X-Python-Version: current Package: mandaye-cam Architecture: all diff --git a/files b/files deleted file mode 100644 index 0d75f21..0000000 --- a/files +++ /dev/null @@ -1 +0,0 @@ -python-mandaye-cam_0.1.0.g9ebbd69-1_all.deb python optional diff --git a/init.d b/init.d old mode 100644 new mode 100755 index 1ddd880..0ae758c --- a/init.d +++ b/init.d @@ -12,8 +12,7 @@ # Author: Jérôme Schneider PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC=compte-meyzieu -NAME=compte-meyzieu +NAME=mandaye-cam DAEMON=/usr/bin/gunicorn PIDFILE=/var/run/mandaye-cam/$NAME.pid LOG_DIR=/var/log/mandaye-cam diff --git a/local_config.py b/local_config.py index b6a0b6c..95cd37a 100644 --- a/local_config.py +++ b/local_config.py @@ -1,22 +1,6 @@ -import os import logging -_PROJECT_PATH = os.path.join(os.path.dirname(__file__), '..') - -db_url = 'sqlite:///' + os.path.join(_PROJECT_PATH, 'data/test.db') - -debug = False -log_file = os.path.join('/var/log/mandaye-cam/mandaye.log') -log_level = logging.INFO - -# Encrypt service provider passwords with a secret -# You should install pycypto to use this feature -encrypt_sp_password = True -# Must be a 16, 24, or 32 bytes long -encrypt_secret = 'CHANGE_ME' - -static_root = os.path.join(_PROJECT_PATH, 'cam/static') - +## Virtual hosts configuration hosts = { 'archimed.montpellier.entrouvert.org': [ {'path': r'/', @@ -28,3 +12,39 @@ hosts = { } ], } + +## Database configuration +db_url = 'sqlite:///var/lib/mandaye-cam/cam.db' + +## Logging configuration +debug = False +log_file = '/var/log/mandaye-cam/mandaye.log' +log_level = logging.INFO + +## PATH +# Data directory +data_dir = '/var/lib/mandaye-cam/data' + +## Email notification configuration +email_notification = True +smtp_host = 'localhost' +smtp_port = 25 +email_from = 'traceback+mandaye-cam@entrouvert.com' +email_to = ['admin+mandaye-cam@entrouvert.com'] + + +## Session configuration +# http://beaker.readthedocs.org/en/latest/configuration.html#options-for-sessions-and-caching +session_opts = { + 'session.type': 'file', + 'session.cookie_expires': True, + 'session.timeout': 3600, + 'session.data_dir': '/var/lib/mandaye-cam/sessions' +} + +## Encrypt service provider passwords with a secret +# You should install pycypto to use this feature +encrypt_sp_password = True +# Must be a 16, 24, or 32 bytes long +encrypt_secret = 'CHANGEME' + diff --git a/postinst b/postinst new file mode 100644 index 0000000..c8e2958 --- /dev/null +++ b/postinst @@ -0,0 +1,54 @@ +#!/bin/sh +# +# Postinst script for mandaye-cam +# + +set -e + +USER=mandaye-cam +G0ROUP=mandaye-cam +NAME=mandaye-cam + +case "$1" in + configure) + if ! getent group $GROUP > /dev/null 2>&1; then + echo -n "Adding group $GROUP.." + addgroup --quiet --system $GROUP + echo "..done" + fi + if ! getent passwd $USER > /dev/null 2>&1; then + echo -n "Adding user $USER.." + adduser --quiet --system --gecos "Mandaye CAM daemon" \ + --ingroup $GROUP \ + --no-create-home --home $HOME \ + $USER + echo "..done" + fi + + chown -R $USER:$GROUP /var/lib/$NAME /var/run/$NAME /var/log/$NAME + + if [ -z "$2" ]; then + echo -n "Creating database.." + su $USER -p -c "/usr/bin/cam_mandaye_manager --createdb" + echo "..done" + fi + ;; + + reconfigure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/rules b/rules index 45b70b4..9f5658b 100755 --- a/rules +++ b/rules @@ -1,5 +1,7 @@ #!/usr/bin/make -f +BUILD_DIR := 'debian/mandaye-cam' + %: dh $@ --with python2 @@ -8,3 +10,6 @@ override_dh_install: for ver in $(shell pyversions -vr); do \ ln -s /etc/mandaye-cam/local_config.py $(BUILD_DIR)/usr/lib/python$$ver/dist-packages/cam/; \ done + install -d -m 0755 $(BUILD_DIR)/var/lib/mandaye-cam + install -d -m 0755 $(BUILD_DIR)/var/run/mandaye-cam + install -d -m 0755 $(BUILD_DIR)/var/log/mandaye-cam