fix rpm spec

This commit is contained in:
Symeon Huang
2015-09-28 12:31:06 +01:00
parent ad4fdeb364
commit 4aeb4eed01
+20 -10
View File
@@ -11,6 +11,13 @@ Source0: %{url}/archive/v%{version}.tar.gz
BuildRequires: openssl-devel
Requires: openssl
%if 0%{?rhel} != 6
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
%endif
Conflicts: python-shadowsocks python3-shadowsocks
AutoReq: no
@@ -36,28 +43,31 @@ mkdir -p %{buildroot}%{_initddir}
install -m 755 %{_builddir}/%{buildsubdir}/rpm/SOURCES/etc/init.d/shadowsocks-libev %{buildroot}%{_initddir}/shadowsocks-libev
%else
mkdir -p %{buildroot}%{_sysconfdir}/default
mkdir -p %{buildroot}%{_unitdir}
install -m 644 %{_builddir}/%{buildsubdir}/debian/shadowsocks-libev.default %{buildroot}%{_sysconfdir}/default/shadowsocks-libev
install -m 644 %{_builddir}/%{buildsubdir}/debian/shadowsocks-libev.service %{buildroot}%{_unitdir}/shadowsocks-libev.service
%endif
install -m 644 %{_builddir}/%{buildsubdir}/debian/config.json %{buildroot}%{_sysconfdir}/shadowsocks-libev/config.json
%if 0%{?rhel} == 6
%post
%if 0%{?rhel} == 6
/sbin/chkconfig --add shadowsocks-libev
%else
%systemd_post shadowsocks-libev.service
%endif
%preun
%if 0%{?rhel} == 6
if [ $1 -eq 0 ]; then
/sbin/service shadowsocks-libev stop
/sbin/chkconfig --del shadowsocks-libev
fi
%else
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
%post
%systemd_post shadowsocks-libev.service
%preun
%systemd_preun shadowsocks-libev.service
%endif
%if 0%{?rhel} != 6
%postun
%systemd_postun_with_restart shadowsocks-libev.service
%endif
@@ -66,14 +76,14 @@ BuildRequires: systemd
%files
%{_bindir}/*
%{_libdir}/*
%config(noreplace) %{_sysconfdir}/shadowsocks-libev/config.json
%doc %{_mandir}/*
%if 0%{?rhel} == 6
%{_initddir}/shadowsocks-libev
%else
%{_unitdir}/shadowsocks-libev.service
%config(noreplace) %{_sysconfdir}/default/shadowsocks-libev
%endif
%config(noreplace) %{_sysconfdir}/shadowsocks-libev/config.json
%doc %{_mandir}/*
%package devel
Summary: Development files for shadowsocks-libev