File hp-network-simulator.spec of Package hp-network-simulator

#
# spec file for package hp-network-simulator
#
# # Copyright (c) 2016, Martin Hauke <mardnh@gmx.de>
#
# 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/
#

%define __filter_GLIBC_PRIVATE 1

Name:           hp-network-simulator
Version:        7.1.50
Release:        0
Summary:        HP Network Simulator
License:        SUSE-NonFree
Group:          System/Emulators/Other
Url:            http://h20564.www2.hpe.com/hpsc/swd/public/readIndex?sp4ts.oid=7107838&swLangOid=8&swEnvOid=4145
Source0:        HP_Network_Simulator_for_Comware_Devices_Ubuntu64.rar
Source99:       hp-network-simulator.rpmlintrc
BuildRequires:  unrar
Recommends:	virtualbox
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  x86_64

%description
HP Network Simulator is a kind of network simulators developed by Hewlett-Packard Development Company, L.P.. HP Network Simulator, which based on the vitualbox, customizes a majority of Comware V7's function.


%prep
unrar x %{SOURCE0}
cd HP_Network_Simulator_for_Comware_Devices_Ubuntu64
ar x HNS_7.1.50_x86_64.deb
tar xzvf data.tar.gz
tar xzvf control.tar.gz
find . -name "*.cfg" -print0 | xargs -0 chmod -v a-x
find . -name "*.cfg" -print0 | xargs -0 sed -i 's/\r//'
find . -name "*.txt" -print0 | xargs -0 sed -i 's/\r//'
chmod -v a-x usr/share/HNS/resource/HNS.xpm
# cp irf version (taken from the original deb-package)
cp -f usr/share/HNS/version/chassis_mpu32.vmdk usr/share/HNS/version/box_irf32.vmdk
cp -f usr/share/HNS/version/chassis_mpu64.vmdk usr/share/HNS/version/box_irf64.vmdk
# fix permissions
chmod 666 usr/share/HNS/version/*.vmdk

# docs
mkdir docs
mv "HP Network Simulator for Comware Devices - Ubuntu User Guide_v2.0.pdf" docs/HP.Network.Simulator.for.Comware.Devices-Ubuntu.User.Guide_v2.0.pdf
mv "HP Network Simulator - IRF LAB" docs/HP.Network.Simulator-IRF.LAB
mv "LEGAL NOTICE.pdf" LEGAL.NOTICE.pdf

%build

%install
# do not strip binaries
export NO_BRP_STRIP_DEBUG=true
export NO_DEBUGINFO_STRIP_DEBUG=true
%define __debug_install_post %{nil}
: >debugfiles.list
: >debugsources.list
# no rpath checks
export NO_BRP_CHECK_RPATH=true

cd HP_Network_Simulator_for_Comware_Devices_Ubuntu64
install -d %{buildroot}/%{_datadir}
cp -arv usr/share/HNS/ %{buildroot}/%{_datadir}
install -Dpm 0644 usr/share/applications/hns.desktop %{buildroot}/%{_datadir}/applications/hns.desktop

%post
ln -sf /usr/bin/VirtualBox /usr/bin/virtualbox
ln -sf "/usr/share/HNS/HP Network Simulator" "/usr/bin/HP Network Simulator"
ln -sf "/usr/share/HNS/HP Network Simulator" /usr/bin/HNS

%postun
rm -f "/usr/bin/HP Network Simulator"
rm -f /usr/bin/HNS


%files
%defattr(-,root,root)
%doc HP_Network_Simulator_for_Comware_Devices_Ubuntu64/docs/
%doc HP_Network_Simulator_for_Comware_Devices_Ubuntu64/LEGAL.NOTICE.pdf
%{_datadir}/HNS
%{_datadir}/applications/hns.desktop

%changelog
openSUSE Build Service is sponsored by