X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=template.spec;h=8828ed78c2d2a49e96cd5fb7d4eca5172974e3e4;hb=2f89de89a978d1a8bb6d369047a579ebda5e7854;hp=4320a7ce06bc664c5d628412c463ddb480302f87;hpb=5309e6bb6fbf0582776885a9cc8404f78fe41d77;p=projects%2Ftemplate-specs.git diff --git a/template.spec b/template.spec index 4320a7c..8828ed7 100644 --- a/template.spec +++ b/template.spec @@ -10,6 +10,8 @@ Version: _ Release: 0.1 License: - (enter GPL/GPL v2/GPL v3/LGPL/BSD/BSD-like/other license name here) Group: Applications +# SF URL: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz +# github URL https://github.com/USER/PROJECT/archive/v%{version}/%{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz # Source0-md5: - #Source1: - @@ -19,6 +21,12 @@ URL: - %if %{with initscript} BuildRequires: rpmbuild(macros) >= 1.228 Requires(post,preun): /sbin/chkconfig +Requires: rc-scripts +%endif +%if %{with systemd_service} +BuildRequires: rpmbuild(macros) >= 1.647 +Requires(post,preun,postun): systemd-units >= 38 +Requires: systemd-units >= 0.38 %endif #BuildRequires: - #BuildRequires: autoconf @@ -46,6 +54,10 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) Summary: - Summary(pl.UTF-8): - Group: - +# noarch subpackages only when building with rpm5 +%if "%{_rpmversion}" >= "5" +BuildArch: noarch +%endif %description subpackage @@ -61,8 +73,8 @@ Group: Libraries %description libs -l pl.UTF-8 %package devel -Summary: Header files for ... library -Summary(pl.UTF-8): Pliki nagłówkowe biblioteki ... +Summary: Header files for %{name} library +Summary(pl.UTF-8): Pliki nagłówkowe biblioteki %{name} Group: Development/Libraries # if base package contains shared library for which these headers are #Requires: %{name} = %{version}-%{release} @@ -70,22 +82,22 @@ Group: Development/Libraries #Requires: %{name}-libs = %{version}-%{release} %description devel -Header files for ... library. +Header files for %{name} library. %description devel -l pl.UTF-8 -Pliki nagłówkowe biblioteki .... +Pliki nagłówkowe biblioteki %{name}. %package static -Summary: Static ... library -Summary(pl.UTF-8): Statyczna biblioteka ... +Summary: Static %{name} library +Summary(pl.UTF-8): Statyczna biblioteka %{name} Group: Development/Libraries Requires: %{name}-devel = %{version}-%{release} %description static -Static ... library. +Static %{name} library. %description static -l pl.UTF-8 -Statyczna biblioteka .... +Statyczna biblioteka %{name}. %prep %setup -q @@ -102,18 +114,18 @@ Statyczna biblioteka .... # you'll need this if you cp -a complete dir in source # cleanup backups after patching -find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f +find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f %build # if ac/am/* rebuilding is necessary, do it in this order and add # appropriate BuildRequires -#%%{__intltoolize} -#%%{__gettextize} -#%%{__libtoolize} -#%%{__aclocal} -#%%{__autoconf} -#%%{__autoheader} -#%%{__automake} +#%{__intltoolize} +#%{__gettextize} +#%{__libtoolize} +#%{__aclocal} +#%{__autoconf} +#%{__autoheader} +#%{__automake} # if not running libtool or automake, but config.sub is too old: #cp -f /usr/share/automake/config.sub . %configure @@ -123,10 +135,15 @@ find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f # CFLAGS="%{rpmcflags}" \ # LDFLAGS="%{rpmldflags}" +%{?with_tests:%{__make} test} + %install rm -rf $RPM_BUILD_ROOT # create directories if necessary #install -d $RPM_BUILD_ROOT +%if %{with initscript} +install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d} +%endif #install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} %{__make} install \ @@ -136,12 +153,18 @@ rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT %pre +%groupadd -g xxx %{name} +%useradd -u xxx -d /var/lib/%{name} -g %{name} -c "XXX User" %{name} %post %preun %postun +if [ "$1" = "0" ]; then + %userremove %{name} + %groupremove %{name} +fi %if %{with ldconfig} %post -p /sbin/ldconfig @@ -149,26 +172,37 @@ rm -rf $RPM_BUILD_ROOT %endif %if %{with initscript} -%post init +%post /sbin/chkconfig --add %{name} %service %{name} restart -%preun init +%preun if [ "$1" = "0" ]; then %service -q %{name} stop /sbin/chkconfig --del %{name} fi %endif +%if %{with systemd_service} +%post +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_reload +%endif + %files %defattr(644,root,root,755) -%doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO +%doc AUTHORS CREDITS CHANGES ChangeLog NEWS README THANKS TODO %if 0 # if _sysconfdir != /etc: #%%dir %{_sysconfdir} %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/* -%attr(755,root,root) %{_bindir}/* +%attr(755,root,root) %{_bindir}/%{name}* %{_datadir}/%{name} %endif @@ -178,6 +212,10 @@ fi %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} %endif +%if %{with systemd_service} +%{systemdunitdir}/%{name}.service +%endif + #%{_examplesdir}/%{name}-%{version} %if %{with subpackage}