%define name	initng
%define version	0.3.3
%define release	1%{?_dist_release}
Summary:	A next generation init replacement
Summary(ja): 	高速起動の可能な次世代 init
Name:		%{name}
Version:	%{version}
Release: 	%{release}
Source0:	http://initng.thinktux.net/download/%{name}-%{version}.tar.bz2
Source1:	keymaps.i
Source2:	unicon.i
Source3:	mingetty.i
Source4:	prefdm.i
Source5:	initial.i
Patch0:		initng_see_vine-release.pl.patch
License:	GPL
Group:		System Environment/Base
URL:		http://initng.thinktux.net/

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


%description
Initng is a full replacement of the old and in many ways deprecated
SysVinit tool. It is designed with speed in mind, doing as much as
possible asynchronously. In other words: It will boot your unix-system
much faster, and give you more control and statistics over your
system.

%description -l ja
Initng は古くて時代遅れになってきている SysVinit を完全に置き換える
ものです。Initng はスピードを考慮して設計されており、可能な限り非同
期的に処理を行います。要するに、これはシステムをより速く起動し、
システムをよりきめ細かく制御できるようにします。


%prep

%setup -q
%patch0 -p1

%build
%configure --libdir=/%{_lib} --sbindir=%{_syssbindir}
%__make

%install
%__rm -rf ${RPM_BUILD_ROOT}
%__make install DESTDIR=${RPM_BUILD_ROOT}
%__install -m644 %{SOURCE1} ${RPM_BUILD_ROOT}/%{_sysconfdir}/initng/system
%__install -m644 %{SOURCE2} ${RPM_BUILD_ROOT}/%{_sysconfdir}/initng/system
%__install -m644 %{SOURCE3} ${RPM_BUILD_ROOT}/%{_sysconfdir}/initng/daemon
%__install -m644 %{SOURCE4} ${RPM_BUILD_ROOT}/%{_sysconfdir}/initng/daemon
%__install -m644 %{SOURCE5} ${RPM_BUILD_ROOT}/%{_sysconfdir}/initng/system

## remove unuse files
rm -f $RPM_BUILD_ROOT/%{_lib}/*.la
rm -f $RPM_BUILD_ROOT/%{_lib}/%{name}/*.la


%post
if [ $1 = 1 ]; then
   /sbin/ng-update del coldplug system
   /sbin/ng-update del static-modules system
   /sbin/ng-update del agetty system
   /sbin/ng-update del acpid default
   /sbin/ng-update del alsasound default
   /sbin/ng-update add unicon system
   /sbin/ng-update add mingetty system

   echo 'daemon/mingetty/tty1' > ${RPM_BUILD_ROOT}/%{_sysconfdir}/initng/up.runlevel
fi

%clean
%__rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,root)
%doc AUTHORS CODING_STANDARDS COPYING ChangeLog FAQ INSTALL
%doc NEWS README TEMPLATE_HEADER TODO
%doc doc/*.txt doc/*.conf doc/*.png
%{_sysconfdir}/hotplug/net.agent
%{_sysconfdir}/ifplugd/action.d/ngcupdown
%{_sysconfdir}/initng
#%{_sysconfdir}/pcmcia/network
/%{_lib}/initng
/%{_lib}/libinitng*
%{_syssbindir}/gen_system_runlevel
%{_syssbindir}/initng
%{_syssbindir}/initng-segfault
%{_syssbindir}/install_service
%{_syssbindir}/ng-update
%{_syssbindir}/ngc
%{_syssbindir}/ngdc
%{_syssbindir}/system_off
%{_sbindir}/ifplugd.action
%{_sbindir}/ngcupdown
%{_sbindir}/wpa_cli.action
%{_syssbindir}/shutdown_script
#%{_datadir}/doc/initng*
%{_mandir}/man8/*


%changelog
* Fri Sep 26 2008 Shu KONNO <owa@bg.wakwak.com> 0.3.3-1vl5
- applied new versioning policy, spec in utf-8
- removed *.la

* Sun Dec 18 2005 Ryoichi INIAGAKI <ryo1@bc.wakwak.com> 0.3.3-0vl2
- changed Group:

* Mon Oct 17 2005 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.3.3-0vl1
- source update.
- add initng-segfault in %%files section.
- add prefdm.i(Source4) and initial.i(Source5) for run X Window System. 

* Wed Oct 05 2005 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.3.1-0vl1
- source update.
- update mingetty.i.

* Tue Oct 04 2005 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.3.0-0vl1
- initial build for VineSeed.
