%define ver 3.18
%define rel 1

Summary: Application to organize SSH connection information in a menu
Name: sshmenu
Version: %{ver}
Release: %{rel}%{?_dist_release}
License: BSD
Group: User Interface/Desktops
URL: http://sshmenu.sourceforge.net/
Source0: http://dl.sf.net/sshmenu/sshmenu-%{version}.tar.gz
Patch0: sshmenu-3.18-libexec.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: ruby
Requires: openssh-askpass
Requires: ruby-gtk2
# We only have ruby scripts and data, and the bonobo file gets picked up fine
BuildArch: noarch

Vendor: Project Vine
Distribution: Vine Linux
Packager: iwaim

%description
SSHMenu is a small program (which is to be used outside of GNOME) that
keeps all your regular SSH connections within a single menu. If you wish to
have the full GNOME applet version of the menu, install gnome-applet-sshmenu.


%package -n gnome-applet-sshmenu
Summary: GNOME panel applet to organize SSH connection information in a menu
Group: User Interface/Desktops
Requires: %{name} = %{version}-%{release}
Requires: ruby-gnome2

%description -n gnome-applet-sshmenu
SSHMenu is a GNOME panel applet (which can also be used outside of GNOME) that
keeps all your regular SSH connections within a single panel menu.


%prep
%setup -q
%patch0 -p1 -b .libexec


%build
# Nope... only ruby scripts :-)


%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}

# On RHEL we are missing libs to get the gnome applet working (#463022)
%if 0%{?rhel}
%{__rm} -rf %{buildroot}%{_bindir}/sshmenu-gnome
%{__rm} -rf %{buildroot}%{_prefix}/lib/bonobo/
%{__rm} -rf %{buildroot}%{rlibdir}/gnome-sshmenu.rb
%{__rm} -rf %{buildroot}%{_libexecdir}/sshmenu-applet
%{__rm} -rf %{buildroot}%{_datadir}/icons/
%endif


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


%post -n gnome-applet-sshmenu
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun -n gnome-applet-sshmenu
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%files
%defattr(-,root,root,-)
%doc Changes License.txt README
%{_sysconfdir}/bash_completion.d/
%{_bindir}/sshmenu
%{rlibdir}/sshmenu.rb
%{_mandir}/man1/sshmenu.1*


# On RHEL we are missing libs to get the gnome applet working (#463022)
%if 0%{!?rhel:1}
%files -n gnome-applet-sshmenu
%{_bindir}/sshmenu-gnome
%{_prefix}/lib/bonobo/servers/sshmenu-applet.server
%{rlibdir}/gnome-sshmenu.rb
%{_libexecdir}/sshmenu-applet
%{_datadir}/icons/hicolor/48x48/apps/gnome-sshmenu-applet.png
%endif


%changelog
* Sat Apr  9 2011 IWAI, Masaharu <iwai@alib.jp> 3.18-1
- build for Vine Linux

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.18-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Tue Dec  8 2009 Matthias Saou <http://freshrpms.net/> 3.18-2
- Disable the gnome-applet-sshmenu sub-package on RHEL (#463022).

* Tue Dec  8 2009 Matthias Saou <http://freshrpms.net/> 3.18-1
- Update to 3.18.
- Rebased both patches for the Makefile changes.
- Fix scriplets by adding "|| :" for touch.
- Include new bash_completion.d as-is since all packages seem to do it.

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat May  9 2009 Matthias Saou <http://freshrpms.net/> 3.16-1
- Update to 3.16.

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Thu Jan 17 2008 Matthias Saou <http://freshrpms.net/> 3.15-5
- Move gnome-sshmenu.rb to gnome-applet-sshmenu too.

* Wed Jan 16 2008 Matthias Saou <http://freshrpms.net/> 3.15-4
- Keep only ruby(gtk2) req in sshmenu, move others to gnome-applet-sshmenu.

* Mon Jan 14 2008 Matthias Saou <http://freshrpms.net/> 3.15-3
- Split out the GNOME applet as gnome-applet-sshmenu while keeping the basic
  menu application as sshmenu, and have all the shared ruby files be there.

* Mon Jan 14 2008 Matthias Saou <http://freshrpms.net/> 3.15-2
- Follow ruby guidelines : Put ruby files in ruby_sitelib.
- Add required hardcoded ruby abi version requirement.

* Tue Dec 18 2007 Matthias Saou <http://freshrpms.net/> 3.15-1
- Initial RPM release.

