paquet debian, premiers elements

This commit is contained in:
Thomas NOËL 2012-07-18 16:38:44 +02:00
parent 711b8c5a7a
commit 49791273e3
18 changed files with 432 additions and 0 deletions

28
bin/polynum-build-virtualenv Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
VEDIR=${VIRTUAL_ENV-/opt/polynum/virtualenv}
PIPOPT=$PIPOPT"-v --log=$VEDIR/install.log"
if [ x"$PROXY" != "x" ]; then
PIPOPT=$PIPOPT" --proxy=$PROXY"
fi
function abort() {
echo $1 1>&2
exit 1
}
test -e ${VEDIR} && abort "$VEDIR already exists"
DIR=`dirname $VEDIR`
VE=`basename $VEDIR`
test -d $DIR || "$DIR does not exist (or is not a directory)"
cd $DIR || abort "cannot cd to $DIR"
virtualenv --system-site-packages $VE || abort "cannot create virtualenv $VE in $DIR"
cd $VE
. bin/activate || abort "cannot activate virtualenv (???)"
pip $PIPOPT install -U pip
pip $PIPOPT install --requirement=/usr/share/doc/polynum/requirements

26
bin/polynum-manage.py Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env python
import os
import sys
import site
POLYNUM_DIR = os.environ.get('POLYNUM_DIR', '/opt/polynum')
VIRTUAL_ENV = os.environ.get('VIRTUAL_ENV', os.path.join(POLYNUM_DIR, 'virtualenv'))
if not os.path.isdir(POLYNUM_DIR):
print >> sys.stderr, POLYNUM_DIR + ' does not exist'
sys.exit(1)
sys.path.append(POLYNUM_DIR)
if os.path.isdir(VIRTUAL_ENV):
site_packages = os.path.join(VIRTUAL_ENV,
'lib',
'python%d.%d' % sys.version_info[:2],
'site-packages')
site.addsitedir(site_packages)
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "polynum.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

8
debian/README vendored Normal file
View File

@ -0,0 +1,8 @@
The Debian Package polynum
----------------------------
All files goes to /opt/polynum/
'coz everybody loves /opt !
-- Thomas NOEL <tnoel@entrouvert.com> Tue, 17 Jul 2012 12:57:01 +0200

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
polynum (0.20120717.01) unstable; urgency=low
* Premier paquet
-- Thomas NOEL <tnoel@entrouvert.com> Tue, 17 Jul 2012 12:57:01 +0200

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
8

18
debian/control vendored Normal file
View File

@ -0,0 +1,18 @@
Source: polynum
Section: web
Priority: extra
Maintainer: Thomas NOEL <tnoel@entrouvert.com>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.3
Homepage: https://sourcesup.cru.fr/projects/polynum/
Vcs-Browser: https://sourcesup.renater.fr/scm/?group_id=859
Package: polynum
Architecture: all
Depends: ${misc:Depends}, python, python-psycopg2, python-ldap
Recommends: python-virtualenv
Suggests: postgresql
Description: Polycopiés numériques
Polynum (polycopiés numériques) est une application web pour demander
l'impression de polycopiés via l'ENT. Elle propose des options de diffusion
afin de mettre à disposition en ligne les polycopiés pour les étudiants.

10
debian/copyright vendored Normal file
View File

@ -0,0 +1,10 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: polynum
Source: https://sourcesup.cru.fr/projects/polynum/
Files: *
Copyright: 2012 Université Dauphine
License: AGPL-3.0+
# http://aloha-editor.org
#

3
debian/docs vendored Normal file
View File

@ -0,0 +1,3 @@
README
requirements
local_settings.py.example

154
debian/init.d vendored Normal file
View File

@ -0,0 +1,154 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: polynum
# Required-Start: $network $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: <Enter a short description of the software>
# Description: <Enter a long description of the software>
# <...>
# <...>
### END INIT INFO
# Author: Thomas NOEL <tnoel@entrouvert.com>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=polynum # Introduce a short description here
NAME=polynum # Introduce the short server's name here
DAEMON=/usr/sbin/polynum # Introduce the server's location here
DAEMON_ARGS="" # Arguments to run the daemon with
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x $DAEMON ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

2
debian/menu.ex vendored Normal file
View File

@ -0,0 +1,2 @@
?package(polynum):needs="X11|text|vc|wm" section="Applications/see-menu-manual"\
title="polynum" command="/usr/bin/polynum"

4
debian/polynum.cron.d.ex vendored Normal file
View File

@ -0,0 +1,4 @@
#
# Regular cron jobs for the polynum package
#
0 4 * * * root [ -x /usr/bin/polynum_maintenance ] && /usr/bin/polynum_maintenance

10
debian/polynum.default.ex vendored Normal file
View File

@ -0,0 +1,10 @@
# Defaults for polynum initscript
# sourced by /etc/init.d/polynum
# installed at /etc/default/polynum by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Additional options that are passed to the Daemon.
DAEMON_OPTS=""

39
debian/postinst.ex vendored Normal file
View File

@ -0,0 +1,39 @@
#!/bin/sh
# postinst script for polynum
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
;;
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

37
debian/postrm.ex vendored Normal file
View File

@ -0,0 +1,37 @@
#!/bin/sh
# postrm script for polynum
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm 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

35
debian/preinst.ex vendored Normal file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# preinst script for polynum
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
;;
abort-upgrade)
;;
*)
echo "preinst 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

38
debian/prerm.ex vendored Normal file
View File

@ -0,0 +1,38 @@
#!/bin/sh
# prerm script for polynum
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
;;
failed-upgrade)
;;
*)
echo "prerm 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

13
debian/rules vendored Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (native)