Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates-src > by-pkgid > ea668eee47f667f0dddecebf8f4c28a6 > files > 12

gogoc-1.2-17.fc17.src.rpm

%global _hardened_build 1
%global distver 1_2-RELEASE

Name:           gogoc
Version:        1.2
Release:        17%{?dist}
Summary:        IPv6 TSP client for gogo6

Group:          System Environment/Daemons
# The entire source code is BSD except gogoc-tsp/include/net_tcp6.c
License:        BSD and GPLv2
URL:            http://gogonet.gogo6.com/page/freenet6-services
Source0:        http://content.gogo6.com/%{name}-%{distver}.tar.gz
Source1:        %{name}.service
Source2:        %{name}-tmpfiles.conf
Source3:        %{name}-sysconfig.conf
Patch1:         %{name}-%{version}-dirpath.patch
Patch2:         %{name}-%{version}-gcc_4.6_compile_fix.patch
Patch3:         %{name}-%{version}-gogoc_conf_5.patch
# Patch4: https://bugs.launchpad.net/ubuntu/+source/gw6c/+bug/418176
Patch4:         %{name}-%{version}-lp418176_client_v4.patch
Patch5:         %{name}-%{version}-selinux_fix.patch
Patch6:         %{name}-%{version}-kill_radvd.patch
Patch7:         %{name}-%{version}-debug_info.patch

BuildRequires:  openssl-devel
BuildRequires:  systemd-units

Requires:       radvd
Requires(post): systemd-units
Requires(post): policycoreutils
Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(postun): policycoreutils

%description
TSP is a control protocol used to establish and maintain static tunnels.
The gogoCLIENT is used on the host computer to connect to a tunnel broker
using the TSP protocol and to get the information for its IPv6 tunnel.
When it receives the information for the tunnel, the gogoCLIENT creates the 
static tunnel on its operating system.
You can setup a dynamic tunnel anonymously, but if you want a static prefix
you need an account in Freenet6 http://gogonet.gogo6.com/page/freenet6-account

%prep
%setup -q -n %{name}-%{distver}
%patch1 -p1 -b .dirpath
%patch2 -p1 -b .gcc_4.6_compile_fix
%patch3 -p1 -b .gogoc_conf_5
%patch4 -p1 -b .lp418176_client_v4
%patch5 -p1 -b .selinux_fix
%patch6 -p1 -b .kill_radvd
%patch7 -p1

%build
CFLAGS=$RPM_OPT_FLAGS; export CFLAGS
CXXFLAGS=$RPM_OPT_FLAGS; export CXXFLAGS
make -j1 all

%install
make installdir=%{buildroot}%{_prefix} install
# Directories that need to be packaged
install -d %{buildroot}%{_datadir} \
           %{buildroot}%{_sysconfdir}/sysconfig \
           %{buildroot}%{_sysconfdir}/%{name}/template \
           %{buildroot}%{_unitdir} \
           %{buildroot}%{_sharedstatedir}/%{name} \
           %{buildroot}%{_localstatedir}/run/%{name} \
           %{buildroot}%{_localstatedir}/log/%{name}
# Systemd unit file
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}
# Copy the Linux shell script to where it's needed
cp -p %{buildroot}%{_datadir}/%{name}/template/linux.sh %{buildroot}%{_sysconfdir}/%{name}/template/linux.sh
# Ghost files
touch %{buildroot}%{_sharedstatedir}/%{name}/gogockeys.pub
touch %{buildroot}%{_sharedstatedir}/%{name}/tsp-last-server.txt
touch %{buildroot}%{_sharedstatedir}/%{name}/tsp-broker-list.txt
touch %{buildroot}%{_localstatedir}/run/%{name}/%{name}-rtadvd.conf
# Remove unneeded files
rm -f %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf.sample
rm -rf %{buildroot}%{_datadir}/%{name}
# The config file can contain passwords, protect it
chmod 0640 %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
# Tmpfiles
mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d
install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf
# Sysconfig file for additional command line arguments
install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}

%post
semanage fcontext -a -t radvd_etc_t '%{_localstatedir}/run/%{name}/%{name}-rtadvd.conf' 2>/dev/null || :
if [ $1 -eq 1 ] ; then 
    # Initial installation 
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi

%preun
if [ $1 -eq 0 ] ; then
    # Package removal, not upgrade
    /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
    /bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
fi

%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
    # Package upgrade, not uninstall
    /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
fi
if [ $1 -eq 0 ] ; then  # final removal
    semanage fcontext -d -t radvd_etc_t '%{_localstatedir}/run/%{name}/%{name}-rtadvd.conf' 2>/dev/null || :
fi


%files
%doc CLIENT-LICENSE.TXT README
%{_mandir}/man5/%{name}.conf.5.gz
%{_mandir}/man8/%{name}.8.gz
%config(noreplace) %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
%dir %{_sharedstatedir}/%{name}
%ghost %{_sharedstatedir}/%{name}/tsp-last-server.txt
%ghost %{_sharedstatedir}/%{name}/gogockeys.pub
%ghost %{_sharedstatedir}/%{name}/tsp-broker-list.txt
%dir %{_localstatedir}/run/%{name}
%ghost %{_localstatedir}/run/%{name}/%{name}-rtadvd.conf
%dir %{_localstatedir}/log/%{name}
%{_bindir}/%{name}
%{_unitdir}/%{name}.service

%changelog
* Thu Jun 28 2012 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-17
- Fix unit file documentation entry
- Update Source URL

* Wed Jun 27 2012 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-16
- Add documentation to systemd service file
- Define variable as global
- Remove unneeded BuildRequires

* Mon Apr 16 2012 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-15
- Hardened build
- Remove unnecesary datadir
- Add missing systemd-units build dependency

* Mon Apr 16 2012 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-14
- Description updated
- Change variable to global
- Don't remove log files while uninstalling

* Tue Feb 14 2012 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-13
- Fix tmpfiles directory creation

* Mon Feb 13 2012 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-12
- Revert FSF address patch
- Update license information

* Mon Feb 13 2012 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-11
- Fix FSF postal address

* Mon Feb 13 2012 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-10
- Honor RPM_OPT_FLAGS

* Thu Nov 24 2011 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-9
- Add tmpfiles directory creation

* Tue Sep 20 2011 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-8
- fixed debug symbols

* Mon Sep 19 2011 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-7
- spec file clean up
- systemd service fix

* Wed Sep 14 2011 Juan Orti Alcaine <j.orti.alcaine@gmail.com> - 1.2-6
- add Debian patches
- add systemd service
- license changed to BSD