packaging rpm, suite
This commit is contained in:
parent
b9071d7828
commit
8ae53621fc
|
@ -34,13 +34,11 @@
|
|||
%define git_submodule git submodule
|
||||
%define git_prep_submodules %{git_submodule} init --cloned && %{git_submodule} update
|
||||
|
||||
%define git_version %(git --git-dir=%{git_gitdir} describe 2> /dev/null || echo 0.0-`git --git-dir=%{git_gitdir} log --oneline | wc -l`-g`git --git-dir=%{git_gitdir} describe --always`)
|
||||
|
||||
# if the git repo has tags
|
||||
%define git_get_ver %(git --git-dir=%{git_gitdir} describe --tags | sed 's/^v\\?\\(.*\\)-\\([0-9]\\+\\)-g.*$/\\1/;s/-//')
|
||||
%define git_get_rel %(git --git-dir=%{git_gitdir} describe --tags | grep '\\-g.\\+$' | sed 's/^v\\?\\(.*\\)-\\([0-9]\\+\\)-g.*$/\\2/')
|
||||
|
||||
# wtf... we don't want .pyo and .pyc files
|
||||
%define __os_install_post echo "NO COMPRESS"
|
||||
|
||||
%define git_get_ver %(echo %{git_version} | sed 's/^v\\?\\(.*\\)-\\([0-9]\\+\\)-g.*$/\\1/;s/-//')
|
||||
%define git_get_rel %(echo %{git_version} | sed 's/^v\\?\\(.*\\)-\\([0-9]\\+-g.*\\)$/\\2/;s/-/_/')
|
||||
|
||||
#
|
||||
# real spec starts here
|
||||
|
@ -50,8 +48,8 @@
|
|||
|
||||
Summary: Polycopiés numériques
|
||||
Name: polynum
|
||||
Version: 0.0
|
||||
Release: 1
|
||||
Version: %git_get_ver
|
||||
Release: %git_get_rel
|
||||
License: AGPLv3+
|
||||
Group: Applications/Internet
|
||||
URL: http://dev.entrouvert.org/projects/polynum
|
||||
|
@ -64,6 +62,7 @@ BuildArch: noarch
|
|||
Requires: python26
|
||||
Requires: python26-virtualenv
|
||||
Requires: python26-ldap
|
||||
Requires(pre): /usr/sbin/groupadd, /usr/sbin/useradd
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig
|
||||
# This is for /sbin/service
|
||||
|
@ -80,14 +79,17 @@ afin de mettre à disposition en ligne les polycopiés pour les étudiants.
|
|||
|
||||
%build
|
||||
|
||||
# wtf... we don't want .pyo and .pyc files
|
||||
%define __os_install_post echo "NO COMPRESS"
|
||||
|
||||
%install
|
||||
%{__rm} -rf %{buildroot}
|
||||
make DESTDIR=%{buildroot} install
|
||||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}
|
||||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/default
|
||||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/sysconfig
|
||||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/init.d
|
||||
%{__install} -m 644 debian/polynum.default %{buildroot}/%{_sysconfdir}/default/%{name}
|
||||
%{__install} -m 755 debian/init.d %{buildroot}/%{_sysconfdir}/init.d/%{name}
|
||||
%{__install} -m 644 rpm/sysconfig %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
|
||||
%{__install} -m 755 rpm/init.d %{buildroot}/%{_sysconfdir}/init.d/%{name}
|
||||
|
||||
%clean
|
||||
|
||||
|
@ -95,11 +97,16 @@ make DESTDIR=%{buildroot} install
|
|||
# set perms and ownerships of packaged files
|
||||
# the - indicates that the current permissions on the files should be used
|
||||
%defattr(-,root,root)
|
||||
%doc help local_settings.py.example gunicorn_config.py.example README
|
||||
%config(noreplace) %{_sysconfdir}/default/%{name}
|
||||
%doc help local_settings.py.example gunicorn_config.py.example README polynum/base/fixtures
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
/opt/polynum/*
|
||||
/etc/init.d/*
|
||||
%{_sysconfdir}/%{name}
|
||||
%dir %{_sysconfdir}/%{name}
|
||||
|
||||
%pre
|
||||
# add polynum group & user
|
||||
/usr/sbin/groupadd -r polynum || :
|
||||
/usr/sbin/useradd -r -c "PolyNum daemon user" -d /opt/polynum -g polynum -s /sbin/nologin polynum || :
|
||||
|
||||
%post
|
||||
# This adds the proper /etc/rc*.d links for the script
|
||||
|
@ -118,4 +125,3 @@ fi
|
|||
* Tue Jul 24 2012 Thomas NOEL <tnoel@entrouvert.com> 0.0-1
|
||||
- create spec file
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# polynum polycopies numeriques
|
||||
#
|
||||
# chkconfig: 2345 20 80
|
||||
# description: PolyNum web application
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides:
|
||||
# Required-Start: $local_fs $network $syslog
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: PolyNum
|
||||
# Description: Polycopies Numeriques
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
exec="/opt/polynum/bin/polynum-manage.py"
|
||||
prog="polynum"
|
||||
config="/etc/polynum/local_settings.py"
|
||||
|
||||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
start() {
|
||||
[ -x $exec ] || exit 5
|
||||
[ -f $config ] || exit 6
|
||||
echo -n $"Starting $prog: "
|
||||
# if not running, start it up here, usually something like "daemon $exec"
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
# stop it here, often "killproc $prog"
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
# run checks to determine if the service is running or use generic status
|
||||
status $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
||||
|
|
@ -0,0 +1 @@
|
|||
../debian/polynum.default
|
Reference in New Issue