paquettage, suite

This commit is contained in:
Thomas NOËL 2012-07-19 15:53:58 +02:00
parent f4682a4c28
commit 03b5a62998
12 changed files with 127 additions and 54 deletions

View File

@ -25,6 +25,7 @@ install:
$(CP) -r bin $(DESTDIR)/opt/polynum
$(INSTALL) -d $(DESTDIR)/etc/opt/polynum
$(INSTALL) -d $(DESTDIR)/var/opt/polynum
$(INSTALL) -d $(DESTDIR)/opt/polynum/static
deb:
dch --newversion=0.0.`date +%Y%m%d`~git`git log -1 --oneline | cut -f1 -d" "`-1

View File

@ -12,7 +12,7 @@ function abort() {
exit 1
}
test -e ${VEDIR} && abort "$VEDIR already exists"
test -e ${VEDIR}/lib && abort "$VEDIR already exists"
DIR=`dirname $VEDIR`
VE=`basename $VEDIR`

2
debian/control vendored
View File

@ -9,7 +9,7 @@ Vcs-Browser: https://sourcesup.renater.fr/scm/?group_id=859
Package: polynum
Architecture: all
Depends: ${misc:Depends}, python, python-psycopg2, python-ldap
Depends: ${misc:Depends}, python, python-psycopg2, python-ldap, adduser (>= 3.11)
Recommends: python-virtualenv
Suggests: postgresql
Description: Polycopiés numériques

2
debian/docs vendored
View File

@ -1,3 +1,5 @@
README
requirements
local_settings.py.example
polynum/base/fixtures
help

1
debian/links vendored Normal file
View File

@ -0,0 +1 @@
opt/polynum/bin/polynum-manage.py usr/bin/polynum-manage.py

2
debian/menu.ex vendored
View File

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

10
debian/polynum.default vendored Normal file
View File

@ -0,0 +1,10 @@
# Defaults for polynum initscript
# sourced by /etc/init.d/polynum
POLYNUM_USER=polynum
POLYNUM_GROUP=polynum
POLYNUM_HOME=/opt/polynum
POLYNUM_VAR=/var/opt/polynum
POLYNUM_ETC=/etc/opt/polynum

View File

@ -1,10 +0,0 @@
# 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=""

106
debian/postinst vendored Normal file
View File

@ -0,0 +1,106 @@
#!/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)
# create user to avoid running server as root
# code borrowed from
# http://www.debian.org/doc/manuals/securing-debian-howto/ch9.en.html#s-bpp-lower-privs
# If the package has default file it could be sourced, so that
# the local admin can overwrite the defaults
[ -f "/etc/default/packagename" ] && . /etc/default/packagename
# Sane defaults:
[ -z "$POLYNUM_USER" ] && POLYNUM_USER=polynum
[ -z "$POLYNUM_NAME" ] && POLYNUM_NAME="PolyNum daemon user"
[ -z "$POLYNUM_HOME" ] && POLYNUM_HOME=/opt/polynum
[ -z "$POLYNUM_GROUP" ] && POLYNUM_GROUP=polynum
[ -z "$POLYNUM_VAR" ] && POLYNUM_VAR=/var/opt/polynum
[ -z "$POLYNUM_ETC" ] && POLYNUM_ETC=/etc/opt/polynum
# 1. create group if not existing
if ! getent group | grep -q "^$POLYNUM_GROUP:" ; then
echo -n "Adding group $POLYNUM_GROUP.."
addgroup --quiet --system $POLYNUM_GROUP 2>/dev/null ||true
echo "..done"
fi
# 2. create homedir if not existing
# test -d $POLYNUM_HOME || mkdir $POLYNUM_HOME
# 3. create user if not existing
if ! getent passwd | grep -q "^$POLYNUM_USER:"; then
echo -n "Adding system user $POLYNUM_USER.."
adduser --quiet \
--system \
--ingroup $POLYNUM_GROUP \
--no-create-home \
--disabled-password \
$POLYNUM_USER 2>/dev/null || true
echo "..done"
fi
# 4. adjust passwd entry
usermod -c "$POLYNUM_NAME" \
-d $POLYNUM_HOME \
-g $POLYNUM_GROUP \
$POLYNUM_USER 2>/dev/null || true
# 5. create default config
# and adjust some files and directories permissions
if [ ! -f $POLYNUM_ETC/local_settings.py ]
then
if ! dpkg-statoverride --list $POLYNUM_ETC/local_settings.py >/dev/null
then
echo -n "Install default $POLYNUM_ETC/local_settings.py .."
cp /usr/share/doc/polynum/local_settings.py.example $POLYNUM_ETC/local_settings.py
chown $POLYNUM_USER:$POLYNUM_GROUP $POLYNUM_ETC/local_settings.py
chmod u=rw,g=,o= $POLYNUM_ETC/local_settings.py
echo "..done"
fi
fi
if ! dpkg-statoverride --list $POLYNUM_VAR/media >/dev/null
then
echo -n "Create upload_dir $POLYNUM_VAR/media .."
mkdir -p $POLYNUM_VAR/media
chown -R $POLYNUM_USER:$POLYNUM_GROUP $POLYNUM_VAR/media
chmod u=rwx,g=rwxs,o= $POLYNUM_VAR/media
echo "..done"
fi
;;
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

39
debian/postinst.ex vendored
View File

@ -1,39 +0,0 @@
#!/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

5
debian/rules vendored
View File

@ -10,4 +10,7 @@
#export DH_VERBOSE=1
%:
dh $@
dh $@
override_dh_compress:
dh_compress -X.page -X.xml -X.json

View File

@ -8,3 +8,4 @@ git+https://github.com/sehmaschine/django-grappelli@grappelli_2_4
pypdf
flup
django-debug-toolbar
gunicorn