packaging: rapprochement entre deb et rpm
This commit is contained in:
parent
5893b2d727
commit
748bd5b15d
|
@ -92,8 +92,8 @@ case "$1" in
|
|||
then
|
||||
echo -n "Creating $PIDDIR .."
|
||||
mkdir -p $PIDDIR 2> /dev/null || true
|
||||
chown -R $POLYNUM_USER:www-data $PIDDIR
|
||||
chmod u=rwx,g=rx,o= $PIDDIR
|
||||
chown -R $POLYNUM_USER:$POLYNUM_GROUP $PIDDIR
|
||||
chmod u=rwx,g=rwxs,o= $PIDDIR
|
||||
echo "..done"
|
||||
fi
|
||||
echo -n "Creating .pyc files [ "
|
||||
|
|
|
@ -21,23 +21,17 @@
|
|||
|
||||
%define git_get_source pushd %{git_repodir}/%{git_repo} ;\
|
||||
/usr/bin/git archive --format=tar --prefix=%{name}-%{version}/ %{git_head} | \
|
||||
gzip -c > %{_sourcedir}/%{name}-%{version}.tar.gz ;\
|
||||
gzip -c > %{_sourcedir}/%{name}.tar.gz ;\
|
||||
popd
|
||||
|
||||
%define git_clone_source if [ -d %{name}-%{version} ] ; then \
|
||||
cd %{name}-%{version} && git pull origin %{git_head} ; \
|
||||
else \
|
||||
git clone %{git_gitdir} %{name}-%{version} && \
|
||||
cd %{name}-%{version}/ ; \
|
||||
fi
|
||||
%define git_prep_submodules pushd %{git_repodir}/%{git_repo} ;\
|
||||
git submodule init ;\
|
||||
git submodule update ;\
|
||||
popd
|
||||
|
||||
%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 %(echo %{git_version} | sed 's/^v\\?\\(.*\\)-\\([0-9]\\+\\)-g.*$/\\1/;s/-//')
|
||||
# use tags like "MAJOR.MINOR"
|
||||
%define git_version %(git --git-dir=%{git_gitdir} describe --long)
|
||||
%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/-/_/')
|
||||
|
||||
#
|
||||
|
@ -55,7 +49,7 @@ License: AGPLv3+
|
|||
Group: Applications/Internet
|
||||
URL: http://dev.entrouvert.org/projects/polynum
|
||||
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source0: %{name}.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
BuildArch: noarch
|
||||
|
||||
|
@ -77,6 +71,7 @@ afin de mettre à disposition en ligne les polycopiés pour les étudiants.
|
|||
|
||||
%prep
|
||||
%git_get_source
|
||||
%git_prep_submodules
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
|
@ -92,6 +87,8 @@ make DESTDIR=%{buildroot} install
|
|||
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/init.d
|
||||
%{__install} -m 644 rpm/sysconfig %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
|
||||
%{__install} -m 755 rpm/init.d %{buildroot}/%{_sysconfdir}/init.d/%{name}
|
||||
%{__mkdir} -p %{buildroot}/usr/bin
|
||||
ln -s /opt/polynum/bin/polynum-manage.py %{buildroot}/usr/bin
|
||||
|
||||
%clean
|
||||
|
||||
|
@ -103,12 +100,16 @@ make DESTDIR=%{buildroot} install
|
|||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
/opt/polynum/*
|
||||
/etc/init.d/*
|
||||
/usr/bin/*
|
||||
# empty dirs
|
||||
%dir %{_sysconfdir}/%{name}
|
||||
%dir /opt/polynum/static
|
||||
%dir /var/lib/polynum
|
||||
|
||||
%pre
|
||||
# add polynum group & user
|
||||
/usr/sbin/groupadd -r polynum || :
|
||||
/usr/sbin/useradd -r -c "PolyNum daemon user" -d /opt/polynum -M -g polynum -s /sbin/nologin polynum || :
|
||||
/usr/sbin/groupadd -r polynum 2> /dev/null || :
|
||||
/usr/sbin/useradd -r -c "PolyNum daemon user" -d /opt/polynum -M -g polynum -s /sbin/nologin polynum 2> /dev/null || :
|
||||
|
||||
%post
|
||||
# This adds the proper /etc/rc*.d links for the script
|
||||
|
@ -124,8 +125,32 @@ make DESTDIR=%{buildroot} install
|
|||
[ -z "$POLYNUM_ETC" ] && POLYNUM_ETC=%{_sysconfdir}/polynum
|
||||
[ -z "$PIDFILE" ] && PIDFILE=/var/run/polynum/polynum.pid
|
||||
|
||||
# create default config
|
||||
# and adjust some files and directories permissions
|
||||
if [ ! -f $POLYNUM_ETC/local_settings.py ]
|
||||
then
|
||||
echo -n "Installing default $POLYNUM_ETC/local_settings.py .."
|
||||
cp /usr/share/doc/polynum-%{version}/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
|
||||
|
||||
echo -n "Creating $POLYNUM_VAR/media .."
|
||||
mkdir -p $POLYNUM_VAR/media 2> /dev/null || true
|
||||
chown -R $POLYNUM_USER:$POLYNUM_GROUP $POLYNUM_VAR/media
|
||||
chmod u=rwx,g=rwxs,o= $POLYNUM_VAR/media
|
||||
echo "..done"
|
||||
|
||||
PIDDIR=$(dirname ${PIDFILE})
|
||||
echo -n "Creating $PIDDIR .."
|
||||
mkdir -p $PIDDIR 2> /dev/null || true
|
||||
chown -R $POLYNUM_USER:$POLYNUM_GROUP $PIDDIR
|
||||
chmod u=rwx,g=rwxs,o= $PIDDIR
|
||||
echo "..done"
|
||||
|
||||
# create pyc with python2.6
|
||||
echo -n "(re)creating pyc files in "
|
||||
echo -n "Compiling py->pyc in "
|
||||
for pydir in polynum bin virtualenv
|
||||
do
|
||||
echo -n "$POLYNUM_HOME/$pydir "
|
||||
|
|
Reference in New Issue