File i2p.spec of Package i2p
#
# spec file for package i2p
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 https://bugs.opensuse.org/
#
%define debug_package %{nil}
Name: i2p
Version: 0.9.41
Release: 1%{?dist}
Summary: I2P is an anonymous network
License: SUSE-Public-Domain AND BSD AND GPL + exeption AND Artistic MIT AND Apache-2.0 AND EPL-1.0 AND check the source
Group: Productivity/Networking/Security
URL: http://www.i2p2.de
Source0: http://mirror.i2p2.de/i2psource_%{version}.tar.bz2
Source1: http://mirror.i2p2.de/i2psource_%{version}.tar.bz2.sig
Source2: %{name}.keyring
BuildRequires: ant
BuildRequires: gettext
Requires: java >= 1.7.0
#Requires(pre): /usr/sbin/useradd
#Requires(post): chkconfig
%description
I2P is an anonymous network, exposing a simple layer that applications can use to anonymously and securely send messages to each other. The network itself is strictly message based (a la IP), but there is a library available to allow reliable streaming communication on top of it (a la TCP). All communication is end to end encrypted (in total there are four layers of encryption used when sending a message), and even the end points ("destinations") are cryptographic identifiers (essentially a pair of public keys).
%prep
%setup -q
%build
export LANG=en_US.UTF-8
java -version
sleep 3
# Change the home path (i2p config dir) before izpack does it
#sed -i "s:%USER_HOME:\$HOME:g" installer/resources/i2prouter
%{ant} pkg
%install
#rm -rf $RPM_BUILD_ROOT
echo "------!!! Install in !!!------"
echo "Folder: %{buildroot}%{_bindir}/%{name}"
# java -jar i2pinstall* -console
java -jar i2pinstall.jar -console
#expect -c "spawn java -jar i2pinstall.jar -console; expect redisplay; send \"1\r\"; expect path; send \"$RPM_BUILD_ROOT%{_bindir}/%{name}\r\"; expect redisplay; send \"1\n\"; expect done"
# Remove problematic and unnecessary files
#rm $RPM_BUILD_ROOT%{_bindir}/%{name}/.installationinformation
#rm -rf $RPM_BUILD_ROOT%{_bindir}/%{name}/Uninstaller
# Strip buildroot from files
#sed -i "s:$RPM_BUILD_ROOT::g" $RPM_BUILD_ROOT%{_bindir}/%{name}/eepget
#sed -i "s:$RPM_BUILD_ROOT::g" $RPM_BUILD_ROOT%{_bindir}/%{name}/runplain.sh
#sed -i "s:$RPM_BUILD_ROOT::g" $RPM_BUILD_ROOT%{_bindir}/%{name}/wrapper.config
#sed -i "s:$RPM_BUILD_ROOT::g" $RPM_BUILD_ROOT%{_bindir}/%{name}/i2prouter
# Install i2p service (eq 'i2prouter install')
#mkdir -p $RPM_BUILD_ROOT%{_initrddir}
#install -m755 $RPM_BUILD_ROOT%{_bindir}/%{name}/i2prouter $RPM_BUILD_ROOT%{_initrddir}/i2p
# Remove redundant functionality from i2p service
#sed -i "s:^.*gettext.*install.*Install to start automatically.*::g" $RPM_BUILD_ROOT%{_initrddir}/i2p
#sed -i "s:^.*gettext.*remove.*Uninstall.*::g" $RPM_BUILD_ROOT%{_initrddir}/i2p
#sed -i "s: | install | remove::g" $RPM_BUILD_ROOT%{_initrddir}/i2p
# Use i2p user to run the service
#sed -i "s:^#RUN_AS_USER=:RUN_AS_USER=\"i2p\":g" $RPM_BUILD_ROOT%{_initrddir}/i2p
# Fix for upstream bug (runuser and a secure (without a shell) service account)
# Fix: add a shell with -s /bin/sh
#sed -i "s:/sbin/runuser -:/sbin/runuser -s /bin/sh -:g" $RPM_BUILD_ROOT%{_initrddir}/i2p
# Append init order to row 2
#sed -i '2 a # chkconfig: - 99 10' $RPM_BUILD_ROOT%{_initrddir}/i2p
%posttrans
# Condrestart and return 0
#/sbin/service i2p condrestart >/dev/null 2>&1 || :
%post
# Register the i2p service
#/sbin/chkconfig --add i2p > /dev/null 2>&1
%pre
# Add the "i2p" user
#getent group i2p >/dev/null || groupadd -r i2p
#getent passwd i2p >/dev/null || useradd -r -g i2p -s /sbin/nologin -d /usr/local/i2p -c "I2P" i2p
# Create the home diretory for i2p if it not exist (useradd cant do it with selinux enabled)
#if [ ! -d "/usr/local/i2p" ]; then
# mkdir /usr/local/i2p
# chown i2p:i2p /usr/local/i2p
#fi
#exit 0
%preun
# Unregister the i2p service
#if [ $1 = 0 ]; then
# /sbin/service i2p stop > /dev/null 2>&1
# /sbin/chkconfig --del i2p > /dev/null 2>&1
#fi
%files
%doc
%{_bindir}/%{name}
%{_initddir}/i2p
%changelog