%define name	update-notifier
%define version	0.70.4
%define release	1%{?_dist_release}

Summary:	Application which notifies about package updates
Summary(ja): 	パッケージの更新を通知するアプリケーション
Name:		%{name}
Version:	%{version}
Release: 	%{release}
Source0:	%{name}_%{version}.tar.gz
Source1:	apt-check.vine
Source2:	markupgrade.lua
Source3:	update-notifier.conf
Source4:	update-notifier.lua
Source5:	update-notifier.cron
Source100:	update-notifier-0.70.4-ja.po

License:	GPL
Group:		Applications/System
URL:		https://launchpad.net/ubuntu/+source/update-notifier

Requires:	apt, synaptic, notification-daemon, vixie-cron, anacron
BuildRequires:	gtk2-devel, libgnomeui-devel, libglade2-devel
BuildRequires:	GConf2-devel, hal-devel, dbus-glib-devel, libnotify-devel
BuildRequires:	perl-XML-Parser

Requires(post):   GConf2
Requires(postun): GConf2

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

%description
Update Notifier will check for the availability of new packages for your
system on a daily basis. When it detects new versions of the packages 
installed on the system are available, it will add an icon on the desktop 
notification area.

It will work with any Desktop system that implements the FreeDesktop 
notification area specification, like GNOME, KDE and XFCE.

%description -l ja
Update Notifier は更新可能なパッケージがないか1日1回自動的にチェックします。
システムにインストールされたパッケージのより新しいバージョンを検出すると、
デスクトップの通知エリアにアイコンを表示します。

このアプリケーションは freedesktop.org の notification area speficification
に準拠しているので、GNOME や KDE、XFCE など、どうようなデスクトップ環境でも
利用できます。


%prep
%setup -q -n %{name}-%{version}
%{__cp} %{SOURCE100} po/ja.po

%build
%configure --disable-schemas-install
%{__make}


%install
%{__rm} -rf ${RPM_BUILD_ROOT}
# seems configure option --disable-schemas-install is ignoring...
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
%makeinstall schemadir=${RPM_BUILD_ROOT}/%{_sysconfdir}/gconf/schemas
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL

%find_lang %{name}

# create local state directory
%{__install} -d -m755 ${RPM_BUILD_ROOT}/%{_localstatedir}/lib/update-notifier
%{__install} -d -m755 ${RPM_BUILD_ROOT}/%{_localstatedir}/lib/update-notifier/user.d

# install additional script for vine
%{__install} -m755 %{SOURCE1} ${RPM_BUILD_ROOT}/%{_libdir}/update-notifier/apt-check
%{__install} -m755 %{SOURCE2} ${RPM_BUILD_ROOT}/%{_libdir}/update-notifier/markupgrade.lua

%{__install} -d -m755 ${RPM_BUILD_ROOT}/%{_sysconfdir}/apt/apt.conf.d
%{__install} -m644 %{SOURCE3} ${RPM_BUILD_ROOT}/%{_sysconfdir}/apt/apt.conf.d/update-notifier.conf
%{__install} -d -m755 ${RPM_BUILD_ROOT}/%{_datadir}/apt/scripts
%{__install} -m755 %{SOURCE4} ${RPM_BUILD_ROOT}/%{_datadir}/apt/scripts/update-notifier.lua

# install cron script
%{__install} -d -m755 ${RPM_BUILD_ROOT}/%{_sysconfdir}/cron.daily
%{__install} -m755 %{SOURCE5} ${RPM_BUILD_ROOT}/%{_sysconfdir}/cron.daily/update-notifier.cron


%post
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule \
    %{_sysconfdir}/gconf/schemas/update-notifier.schemas > /dev/null;


%preun
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule \
    %{_sysconfdir}/gconf/schemas/update-notifier.schemas >/dev/null;


%clean
%{__rm} -rf ${RPM_BUILD_ROOT}


%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog HOOKS INSTALL NEWS README TODO
%{_sysconfdir}/apt/apt.conf.d/update-notifier.conf
%{_sysconfdir}/cron.daily/update-notifier.cron
%{_sysconfdir}/gconf/schemas/update-notifier.schemas
%{_sysconfdir}/xdg/autostart/update-notifier.desktop
%{_bindir}/update-notifier
%{_datadir}/apt/scripts/update-notifier.lua
%{_datadir}/icons/hicolor
%{_datadir}/update-notifier/glade
%{_datadir}/update-notifier/notify-reboot-required
%{_libdir}/update-notifier
%dir %{_localstatedir}/lib/update-notifier
%dir %{_localstatedir}/lib/update-notifier/user.d


%changelog
* Mon Oct 13 2008 Shu KONNO <owa@bg.wakwak.com> 0.70.4-1vl5
- applied new versioning policy, spec in utf-8

* Mon Mar 03 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.70.4-0vl2
- add Source100 (updated japanese message).

* Sun Feb 24 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.70.4-0vl1
- initial build for Vine Linux
