Skip to content

Commit

Permalink
fix rpm spec
Browse files Browse the repository at this point in the history
  • Loading branch information
librehat committed Sep 28, 2015
1 parent ad4fdeb commit 4aeb4ee
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions rpm/SPECS/shadowsocks-libev.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4aeb4ee

Please sign in to comment.