diff --git a/rpm/SOURCES/shadowsocks-server@.service b/rpm/SOURCES/shadowsocks-server@.service deleted file mode 100644 index 9dd381ff..00000000 --- a/rpm/SOURCES/shadowsocks-server@.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Shadowsocks Server Service -After=network.target - -[Service] -Type=simple -User=nobody -ExecStart=/usr/bin/ss-server -c /etc/shadowsocks/%i.json - -[Install] -WantedBy=multi-user.target diff --git a/rpm/SOURCES/shadowsocks@.service b/rpm/SOURCES/shadowsocks@.service deleted file mode 100644 index ed6e7f45..00000000 --- a/rpm/SOURCES/shadowsocks@.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Shadowsocks Client Service -After=network.target - -[Service] -Type=simple -User=nobody -ExecStart=/usr/bin/ss-local -c /etc/shadowsocks/%i.json - -[Install] -WantedBy=multi-user.target diff --git a/rpm/SPECS/shadowsocks-libev.spec b/rpm/SPECS/shadowsocks-libev.spec index fbb6a442..e793c4e8 100644 --- a/rpm/SPECS/shadowsocks-libev.spec +++ b/rpm/SPECS/shadowsocks-libev.spec @@ -1,56 +1,89 @@ -Name: shadowsocks-libev -Version: 2.1.4 -Release: 1%{?dist} -Summary: A lightweight secured socks5 proxy for embedded devices and low end boxes. +Name: shadowsocks-libev +Version: 2.4.0 +Release: 1%{?dist} +Summary: A lightweight and secure socks5 proxy -License: GPLv3+ -URL: https://github.com/shadowsocks/shadowsocks-libev -Source0: %{name}-%{version}.tar.xz -Source1: shadowsocks@.service -Source2: shadowsocks-server@.service +Group: Applications/Internet +License: GPLv3+ +URL: https://github.com/madeye/%{name} +Source0: %{url}/archive/v%{version}.tar.gz +BuildRequires: openssl-devel +Requires: openssl + +Conflicts: python-shadowsocks python3-shadowsocks + +AutoReq: no %description -Shadowsocks-libev is a lightweight secured socks5 proxy for embedded devices and low end boxes. +shadowsocks-libev is a lightweight secured scoks5 proxy for embedded devices and low end boxes. + %prep %setup -q %build -%configure +%configure --enable-shared make %{?_smp_mflags} %install -rm -rf $RPM_BUILD_ROOT -%make_install -mkdir -p %{buildroot}/usr/lib/systemd/system -cp %{SOURCE1} %{SOURCE2} %{buildroot}/usr/lib/systemd/system +make install DESTDIR=%{buildroot} +mkdir -p %{buildroot}/etc/shadowsocks-libev +%if 0%{?rhel} == 6 +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 +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 +/sbin/chkconfig --add shadowsocks-libev +%preun +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 +%postun +%systemd_postun_with_restart shadowsocks-libev.service +%endif %files -%{_bindir}/ss-local -%{_bindir}/ss-redir -%{_bindir}/ss-server -%{_bindir}/ss-tunnel +%{_bindir}/* +%{_libdir}/* +%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}/* -%doc /usr/lib/systemd/system/* - %package devel -Summary: Files for development of applications which will use shadowsocks. -License: GPLv3+ -URL: https://github.com/shadowsocks/shadowsocks-libev +Summary: Development files for shadowsocks-libev +License: GPLv3+ %description devel -Shadowsocks-libev is a lightweight secured socks5 proxy for embedded devices and low end boxes. +Development files for shadowsocks-libev %files devel -%{_includedir}/shadowsocks.h -%{_libdir}/libshadowsocks.a -%{_libdir}/libshadowsocks.la -%{_libdir}/pkgconfig/shadowsocks-libev.pc - +%{_includedir}/* %changelog + diff --git a/rpm/genrpm.sh b/rpm/genrpm.sh index a9695477..3bc2ff60 100755 --- a/rpm/genrpm.sh +++ b/rpm/genrpm.sh @@ -7,12 +7,12 @@ show_help() echo echo -e "Options:" echo -e " -h show this help." - echo -e " -v with argument version(2.1.4 by default)." - echo -e " -f with argument format(tar.xz by default) used by git archive." + echo -e " -v with argument version (2.4.0 by default)." + echo -e " -f with argument format (tar.xz by default) used by git archive." echo echo -e "Examples:" - echo -e " to build base on version \`2.1.4' with format \`tar.xz', run:" - echo -e " `basename $0` -f tar.xz -v 2.1.4" + echo -e " to build base on version \`2.4.0' with format \`tar.xz', run:" + echo -e " `basename $0` -f tar.xz -v 2.4.0" } while getopts "hv:f:" opt @@ -48,7 +48,7 @@ get_att_val() fi } -get_att_val version "2.1.4" +get_att_val version "2.4.0" get_att_val format "tar.xz" name="shadowsocks-libev"