LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File freenet.spec of Package freenet (Project home:p_conrad)

#
# spec file for package freenet
#
# Copyright (c) 2013 Peter Conrad
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/

Name:		freenet
Version:	20130328
Release:	1
License:	GPL-2.0+
Summary:	Freenet Reference Daemon
Url:		https://github.com/freenet/fred-official
Group:		Development/Libraries/Java
Source:		fred-official-%{version}.tar.bz2
Source1:	freenet.service
Source2:	freenet.rsyslog
Source3:	README.SUSE
Source4:	freenet.susefw
Source5:	https://downloads.freenetproject.org/alpha/opennet/seednodes.fref
Source6:	sysconfig.freenet
Source7:	freenet.sh
Requires:	jpackage-utils java freenet_ext bouncycastle apache-commons-compress tanukiwrapper jBitcollider
BuildRequires:	jpackage-utils java-devel ant-junit freenet_ext bouncycastle apache-commons-compress tanukiwrapper jBitcollider
%if 0%{?fedora} == 0
Requires(pre):	pwdutils
%else
Requires(pre):	shadow-utils
BuildRequires:	java-1.5.0-gcj-devel
%endif
%if 0%{?suse_version} > 1200 || 0%{?fedora} > 0
BuildRequires:	rsyslog
%endif
BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1210
BuildRequires:	systemd
%endif
%{?systemd_requires}

%description
Freenet is free software which lets you anonymously share files, browse and
publish "freesites" (web sites accessible only through Freenet) and chat on
forums, without fear of censorship. Freenet is decentralised to make it less
vulnerable to attack, and if used in "darknet" mode, where users only connect
to their friends, is very difficult to detect.

Communications by Freenet nodes are encrypted and are routed through other
nodes to make it extremely difficult to determine who is requesting the
information and what its content is.

Users contribute to the network by giving bandwidth and a portion of their hard
drive (called the "data store") for storing files. Files are automatically kept
or deleted depending on how popular they are, with the least popular being
discarded to make way for newer or more popular content. Files are encrypted,
so generally the user cannot easily discover what is in his datastore, and
hopefully can't be held accountable for it. Chat forums, websites, and search
functionality, are all built on top of this distributed data store.

%prep
%setup -q -n fred-official-%{version}
%__cp "%{S:3}" .
%__sed -i '/-Class\|Class-/d' build-clean.xml

%build
JARS="freenet-ext commons-compress xz tanukiwrapper bitcollider"
%__ln_s `build-classpath $JARS | sed 's=:= =g'` lib/freenet
%__mv lib/freenet/bitcollider.jar lib/freenet/bitcollider-core.jar
%__mv lib/freenet/tanukiwrapper.jar lib/freenet/wrapper.jar
%__ln_s "`build-classpath bcprov`" lib
LD_PRELOAD=libgmp.so.10 ant -Dgit.revision="build0`grep 'private.*buildNumber =' src/freenet/node/Version.java | sed 's=[^0-9]*==g'`"

%__sed "s/JARS/$JARS/" <"%{S:7}" >"%{name}"

%install
%__install -dm 0755 "%{buildroot}%{_javadir}"
%__install -m 0644 dist/freenet.jar "%{buildroot}%{_javadir}"

%__install -dm 0755 "%{buildroot}%{_bindir}"
%__install -m 0755 freenet "%{buildroot}%{_bindir}"

%__install -dm 0755 "%{buildroot}%{_datadir}/%{name}"
%__install -m 0644 "%{S:5}" "%{buildroot}%{_datadir}/%{name}/"

%if %{defined _unitdir}
%__install -dm 0700 "%{buildroot}%{_localstatedir}/lib/freenet"
%__ln_s "%{_datadir}/%{name}/seednodes.fref" "%{buildroot}%{_localstatedir}/lib/freenet/"
%__install -dm 0755 "%{buildroot}%{_unitdir}"
%__install -m 0644 "%{S:1}" "%{buildroot}%{_unitdir}"
%__install -dm 0755 "%{buildroot}%{_sysconfdir}/rsyslog.d"
%__install -m 0644 "%{S:2}" "%{buildroot}%{_sysconfdir}/rsyslog.d/freenet.conf"
%__install -dm 0755 "%{buildroot}%{_localstatedir}/adm/fillup-templates"
%__install -m 0644 "%{S:6}" "%{buildroot}%{_localstatedir}/adm/fillup-templates/"
%endif

%if 0%{?suse_version} > 0
%__install -dm 0755 "%{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services"
%__install -m 0644 "%{S:4}" "%{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/freenet"
%endif

%pre
getent group freenet >/dev/null || groupadd -r freenet
getent passwd freenet >/dev/null || useradd -r -g freenet -d "%{_localstatedir}/lib/freenet" -s /sbin/nologin -c "User for freenet" freenet
%if %{defined service_add_pre}
%service_add_pre freenet.service
%endif
exit 0

%if %{defined service_add_post}
%post
%service_add_post freenet.service
%endif

%preun
%if %{defined _unitdir}
%if %{defined service_del_preun}
%service_del_preun freenet.service
%else
test -n "$FIRST_ARG" || FIRST_ARG=$1
if test "$FIRST_ARG" -lt 1 ; then
    /bin/systemctl --no-reload disable freenet.service >/dev/null 2>&1 || :
    /bin/systemctl stop freenet.service >/dev/null 2>&1 || :
fi
%endif
%endif

%postun
%if %{defined _unitdir}
%if %{defined service_del_postun}
%service_del_postun freenet.service
%else
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
test -n "$FIRST_ARG" || FIRST_ARG=$1
if test "$FIRST_ARG" -ge 1 ; then
    /bin/systemctl try-restart freenet.service >/dev/null 2>&1 || :
fi
%endif
%endif

%files
%defattr(-,root,root,-)
%doc AUTHORS LICENSE README*
%{_javadir}/freenet.jar
%{_bindir}/freenet
%{_datadir}/%{name}/
%if %{defined _unitdir}
%attr(-,freenet,freenet) %{_localstatedir}/lib/freenet
%{_unitdir}/freenet.service
%config(noreplace) %{_sysconfdir}/rsyslog.d/freenet.conf
%{_localstatedir}/adm/fillup-templates/sysconfig.freenet
%endif
%if 0%{?suse_version} > 0
%config(noreplace) %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/freenet
%endif

%changelog