File l2tp-ipsec-vpn.spec of Package l2tp-ipsec-vpn

#
# spec file for package l2tp-ipsec-vpn (Version 1.0.8)
#
# Copyright 2008 SUSE LINUX Products 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.

%define name l2tp-ipsec-vpn
%define version 1.0.8

Name:      %{name}
Version:   %{version}
Release:   1
Summary:   Control your L2TP IPsec VPN connections
Group:     Productivity/Networking/Security
License:   GPL-3.0
URL:        http://sourceforge.net/projects/l2tp-ipsec-vpn/
Source0:   http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}_%{version}.tar.gz
Source1:   ip-up.local
Source2:   ip-down.local

BuildRoot: %{_tmppath}/%{name}-%{version}-build

BuildRequires: gcc-c++

BuildRequires: libcppunit-devel >= 1.12.0
BuildRequires: libctemplate-devel >= 0.96
BuildRequires: libtool >= 2.2.6
BuildRequires: libqt4-devel >= 4.6.2

BuildRequires: engine_pkcs11 >= 0.1.8-2
BuildRequires: openssl-devel >= 0.9.8

%if 0%{?suse_version}
BuildRequires: update-desktop-files
%endif

Requires: l2tp-ipsec-vpn-daemon >= 0.9.9
%if 0%{?fedora_version}
Requires: beesu
%endif


%description
This GUI provides a system tray icon in the notification area from which a non
privileged user can establish and bring down L2TP over IPsec VPN connections.

There is also a configuration editor that allows configuring various options
for IPsec, L2TP and PPP.

%prep
%setup -n %{name}
%{__cp} -p %SOURCE1 .
%{__cp} -p %SOURCE2 .

%build
%{__make} %{?_smp_mflags}

%files
%defattr(-,root,root,-)
%{_sysconfdir}/xdg/autostart/L2tpIPsecVpn.desktop
%{_bindir}/L2tpIPsecVpn
%dir %{_datadir}/L2tpIPsecVpn
%{_datadir}/L2tpIPsecVpn/logo.png
%{_datadir}/applications/L2TP-Ipsec-VPN-Manager.desktop
%{_datadir}/applications/L2tpIPsecVpn-Applet.desktop
%{_mandir}/man1/L2tpIPsecVpn.1.gz
%config %{_sysconfdir}/ppp/ip-up.local
%config %{_sysconfdir}/ppp/ip-down.local

%install
%{__rm} -rf %{buildroot}
%{__make} install INSTALL_ROOT=%{buildroot}
%{__install} -D -m 644 -p docs/L2tpIPsecVpn.1 %{buildroot}%{_mandir}/man1/L2tpIPsecVpn.1
%{__install} -D -m 755 -p ip-up.local %{buildroot}%{_sysconfdir}/ppp/ip-up.local
%{__install} -D -m 755 -p ip-down.local %{buildroot}%{_sysconfdir}/ppp/ip-down.local
%if 0%{?suse_version}
   %suse_update_desktop_file -r -G "Control your L2TP IPsec VPN connections" L2tpIPsecVpn-Applet Network Dialup
   %suse_update_desktop_file -r -G "Manage and change your L2TP IPsec VPN connection settings" L2TP-Ipsec-VPN-Manager Settings Security
   %suse_update_desktop_file -G "Control your L2TP IPsec VPN connections" L2tpIPsecVpn
%endif

%post
# if applet is running try to terminate it
PIDS=$(/sbin/pidof L2tpIPsecVpn || true)
if [ -n "$PIDS" ]; then
   /bin/echo "Trying to terminate L2tpIPsecVpn applet" >&2
   kill $PIDS || true
fi

# re-apply settings just in case the new version has changed some things
%{_bindir}/L2tpIPsecVpn applySettings || true

# create rsyslog pipe
%{__rm} -f /var/log/l2tpipsecvpn.pipe
%{_bindir}/mkfifo -m go+r /var/log/l2tpipsecvpn.pipe

# restart rsyslog daemon just in case the new version has changed the
# rsyslogd  configuration file (potentially  written out with the command
# 'L2tpIPsecVpn applySettings' above)
%if 0%{?suse_version}
   if [ -f %{_sysconfdir}/rsyslog.early.conf ]; then
      %{__sed} -i '/30-l2tp-ipsec-vpn.conf/ d' %{_sysconfdir}/rsyslog.early.conf
      %{__sed} -i '/additional-log-sockets.conf/ a\
$IncludeConfig %{_sysconfdir}/rsyslog.d/30-l2tp-ipsec-vpn.conf' %{_sysconfdir}/rsyslog.early.conf
   fi
   /sbin/service syslog restart || true
%else
   /sbin/service rsyslog restart || true
%endif

%preun
if [ "$1" -eq 0 ]; then
   # if applet is running try to terminate it
   PIDS=$(/sbin/pidof L2tpIPsecVpn || true)
   if [ -n "$PIDS" ]; then
      /bin/echo "Trying to terminate L2tpIPsecVpn applet" >&2
      kill $PIDS || true
   fi

   # Remove all generated configuration files
   %{_bindir}/L2tpIPsecVpn deleteAllConfFiles || true

   # Remove syslog pipe and restart syslog service
   %{__rm} -f /var/log/l2tpipsecvpn.pipe
   %if 0%{?suse_version}
      if [ -f %{_sysconfdir}/rsyslog.early.conf ]; then
         %{__sed} -i '/30-l2tp-ipsec-vpn.conf/ d' %{_sysconfdir}/rsyslog.early.conf
      fi
      /sbin/service syslog restart || true
   %else
      /sbin/service rsyslog restart || true
   %endif
fi

%postun
# if the last version of this package is erased
if [ "$1" -eq 0 ]; then
   # Remove man page
   %{__rm} -f %{_mandir}/man1/L2tpIPsecVpn.1*
   
   # Remove settings file
   %{__rm} -rf %{_sysconfdir}/xdg/WernerJaeger
   %{__rm} -rf %{_sysconfdir}/WernerJaeger
fi

%clean
%{__rm} -rf %{buildroot}

%changelog
* Tue May 8 2012 Werner Jaeger <werner_jaeger@web.d> - 1.0.7-1
- to be compatible with more linux distributions use service command
  instead of invoke-rc.d command to start and stop runlevel services
- corrected wrong desktop check
- corrected platform specific qt includes
- in Makefile configure the appropriate qmake command (qmake or qmake-qt4)
- fixed bug connection editor crashes on selecting a certificate or private
  key from smart card (LP: #975822)
- fixed bug trayicon doesn't scale properly (LP: #98616)
- provided a separate error status icon


* Wed May 2 2012 Werner Jaeger <werner_jaeger@web.d> - 1.0.6-1
- initial release
openSUSE Build Service is sponsored by