Summary: A helper application which loads modules for USB devices.
Name: hotplug
Version: 2002_04_01
Release: 17
Epoch: 3
Group: System Environment/Kernel
License: GPL
URL: http://linux-hotplug.sourceforge.net/
Source0: %{name}-%{version}.tar.gz
Source1: http://www.linuxalpha.compaq.com/pcihpd/files/cpqphpd_gui-0.1.2.tar.gz
Source2: http://www.linuxalpha.compaq.com/pcihpd/files/hpioctl.tar.gz
Source3: cpqphpd_ioctl.h
Source4: fxload-2002_04_11.tar.gz

%ifnarch s390 s390x
%define with_fxload     1
%define with_hppci      1

BuildRequires: gnome-libs-devel, ORBit-devel, libglade-devel
Requires: usbutils >= 0.9

%else
%define with_fxload     0
%define with_hppci      0
%endif

# We don't want hotplug to initialize the USB core modules, but we
# want to synthesize boot events
Patch0: hotplug-2001_04_24-nousbinit.patch

# Add support for wireless devices
Patch1: hotplug-2001_09_19-wireless2.patch

# Run updfstab on some add and remove events
Patch2: hotplug-2001_04_24-updfstab.patch

# Don't ifup interfaces if the network subsystem isn't up
Patch3: hotplug-2001_04_24-networkdown.patch

# Some joydevs
Patch4: hotplug-2002_04_01-joydev.patch

# We don't include initscript, don't reference it in the man page
Patch5: hotplug-2002_04_01-initfile.patch

# Don't hotplug when adding tunnels
Patch6: hotplug-2002_04_01-tunl.patch

# Wacom
Patch7: hotplug-2002_04_01-wacom.patch

# usblcd
Patch8: hotplug-2002_04_01-usblcd.patch

# devlabel support
Patch9: hotplug-devlabel.patch

# add IN_HOTPLUG for net devices
Patch10: hotplug-2002_04_01-inhotplug.patch

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

%if %{with_hppci}
%package gtk
Summary: GTK control interface for Hotplug PCI
Group: Applications/System

%description gtk
This is the GTK interface for the Compaq PCI hotplug controller
%endif

%description
The term "hotplugging" refers to the dynamic reconfiguration performed
after a device has been attached to a running system. This package
contains the application which is called by the kernel when a USB
device is added; hotplug then loads the required modules for that
device.

%prep
%setup -q
%setup -q -a 1

tar -zxvf %{SOURCE2}
tar -zxvf %{SOURCE4}


%patch0 -p1
# no need for this anymore -- PGB 06/26/02
#%patch1 -p1 -b .wireless
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p0
%patch10 -p1

rm -f etc/hotplug/*.orig

%build
%if %{with_hppci}
pushd cpqphpd_gui
%configure
make -s -j2
pushd ../usr/src/hpioctl
cp -fv $RPM_SOURCE_DIR/cpqphpd_ioctl.h  .
make
popd
popd
%endif

%if %{with_fxload}
pushd fxload-2002_04_11
make
popd
%endif

%install
# build directories
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT/etc/hotplug
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8

# install the main hotplug script
install -m 755 sbin/* $RPM_BUILD_ROOT/sbin/

# install the helper hotplug scripts
cp -a -r etc/hotplug/* ${RPM_BUILD_ROOT}/etc/hotplug/

# install the usb startup script
cp -a etc/rc.d/init.d/* ${RPM_BUILD_ROOT}/etc/rc.d/init.d/

# the man page
install -m 644 hotplug.8 $RPM_BUILD_ROOT/%{_mandir}/man8

%if %{with_fxload}
# firmware load utility
pushd fxload-2002_04_11
install -m 755 fxload $RPM_BUILD_ROOT/sbin
install -m 644 fxload.8 $RPM_BUILD_ROOT/%{_mandir}/man8/
mv README.txt ../README.txt.fxload
popd
%endif

%if %{with_hppci}
# hotplug PCI program
mkdir -p $RPM_BUILD_ROOT/usr/sbin
cp usr/src/hpioctl/iotest $RPM_BUILD_ROOT/usr/sbin/hotplugctl

pushd cpqphpd_gui
make DESTDIR=$RPM_BUILD_ROOT install
popd
%endif

# We don't use this
rm -f $RPM_BUILD_ROOT/etc/rc.d/init.d/hotplug

%clean
rm -fr $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README ChangeLog
%if %{with_fxload}
  %doc README.txt.fxload
%endif
%if %{with_hppci}
  /usr/sbin/hotplugctl
%endif
/sbin/*
%config /etc/hotplug/*
%dir /etc/hotplug
%config(noreplace)  /etc/hotplug/usb.usermap
%{_mandir}/*/*

%if %{with_hppci}
%files gtk
%defattr(-,root,root)
/usr/bin/cpqphpgui
/usr/share/pixmaps/cpqphpgui/*
%endif

%changelog
* Tue Feb 11 2003 Bill Nottingham <notting@redhat.com> 2002_04_1-17
- add IN_HOTPLUG back (#84045)

* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt

* Mon Jan 20 2003 Florian La Roche <Florian.LaRoche@redhat.de>
- add IBM mainframe changes

* Mon Dec  2 2002 Bill Nottingham <notting@redhat.com> 2002_04_01-14
- devlabel support
- utf8-ify spec file

* Wed Aug 28 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-13
- Add new device to hotplug list (#72646)

* Fri Aug 23 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-12
- Merge remove sections (#72362)

* Wed Aug 14 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-11
- Add fxload (#71495)
- More wacom

* Wed Aug  7 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-10
- Handle ip tunnel devices properly (#70659)
- Add support for another wacom tablet

* Wed Jun 26 2002 Preston Brown <pbrown@redhat.com>
- remove wireless patch, should be handled all by ifup.

* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Tue Jun 18 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-7
- Minor syntax change in specfile to satisfy new rpm

* Sun May 26 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Tue May 21 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-5
- Remove the reference that got away (#65200)

* Wed May 15 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-4
- Don't reference the initscript in the man page(#64800)

* Thu Apr 11 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-3
- Make it insert the joydev module for Gravis Gamepad and Saitek
  Cyborg 3D USB (#63148)

* Fri Apr  5 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-2
- Remove the build root after build (#62790)

* Mon Apr  1 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_04_01-1
- 2002_04_01

* Thu Feb 21 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_01_14-2
- Rebuild

* Mon Jan 14 2002 Trond Eivind Glomsrød <teg@redhat.com> 2002_01_14-1
- 2002_01_14
- usbutils is now a separate package. Require it.

* Tue Nov  6 2001 Trond Eivind Glomsrød <teg@redhat.com> 2001_09_19-1
- 2001_09_19

* Tue Nov  6 2001 Trond Eivind Glomsrød <teg@redhat.com> 2001_04_24-13
- Add /etc/hotplug/usb directory (#55775)

* Tue Sep 18 2001 Trond Eivind Glomsrød <teg@redhat.com> 2001_04_24-12
- Add patch from mlord@pobox.com to use gt, not ge for one of the comparions
  in the usb.agent script(#53435). We use usbmodules for this now, so the
  patch isn't in the path of execution.

* Mon Aug 27 2001 Trond Eivind Glomsrød <teg@redhat.com> 2001_04_24-11
- Install usbmodules from usbutils to help sove various
  module insertion problems (#52630, #52100, #51229, #52546)

* Sun Aug 19 2001 Bill Nottingham <notting@redhat.com>
- revert last change. I was on crack.

* Wed Aug  8 2001 Bill Nottingham <notting@redhat.com>
- handle network unregistration events too

* Mon Aug  6 2001 Trond Eivind Glomsrød <teg@redhat.com>
- Add extra identifiers for Wacom tablets (#50454)
- Define IN_HOTPLUG before invoking ifup (part of #47483)

* Mon Jul 16 2001 Bill Nottingham <notting@redhat.com>
- own /etc/hotplug
- what dunderhead put that broken code in the wireless stuff? Oh yeah, me.
  (#49021)

* Tue Jul 10 2001 Trond Eivind Glomsrød <teg@redhat.com>
- Add defattr to gtk subpackage
- make the lines in the description shorter

* Sun Jul  8 2001 Bill Nottingham <notting@redhat.com>
- fix namespace collision with initscripts in net.agent (HWADDR),
  use ip, not ifconfig

* Tue Jun 19 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- Preston is right, ExcludeArch is better

* Tue Jun 19 2001 Arjan van de Ven <arjanv@redhat.com>
- Added hotplug PCI support

* Wed Jun 13 2001 Trond Eivind Glomsrød <teg@redhat.com>
- Change for wireless as suggested in #44381

* Mon May 21 2001 Trond Eivind Glomsrød <teg@redhat.com>
- 2001-04-24 packages
- redo all patches, drop some, consolidate others
- Include new man page

* Sun Apr 01 2001 Erik Troan <ewt@redhat.com>
- devices wouldn't match the upper limit of device id ranges

* Thu Mar 29 2001 Trond Eivind Glomsrød <teg@redhat.com>
- Make it sleep (20 intervals of 30 seconds) if /tmp is ro
  instead of exiting. This should make "hotplugging"
  of devices present at boot time work.

* Tue Mar 20 2001 Trond Eivind Glomsrød <teg@redhat.com>
- run updfstab on remove events
- remove the initscript, usbdevfs is now initialized before the controller

* Fri Mar  2 2001 Trond Eivind Glomsrød <teg@redhat.com>
- don't ifup interfaces when the network is stopped
  (#22978)

* Fri Mar  2 2001 Bill Nottingham <notting@redhat.com>
- move wireless invocations to the right place

* Thu Mar  1 2001 Trond Eivind Glomsrød <teg@redhat.com>
- Run updfstab when adding usb-storage devices

* Thu Mar  1 2001 Bill Nottingham <notting@redhat.com>
- don't ship backup files

* Wed Feb 28 2001 Bill Nottingham <notting@redhat.com>
- ignore cipe, plip, and loopback devices as well

* Wed Feb 28 2001 Nalin Dahyabhai <nalin@redhat.com>
- fire off netreport updates when interfaces get registered/deregistered

* Tue Feb 27 2001 Bill Nottingham <notting@redhat.com>
- invoke the pcmcia wireless script for wireless devices

* Thu Feb 22 2001 Trond Eivind Glomsrød <teg@redhat.com>
- add pci hotplug scripts (those weren't the ones bringing machines down)
- activate the script
- change initscript so it never tries to load usb controller modules, just synthesize events

* Fri Feb 16 2001 Trond Eivind Glomsrød <teg@redhat.com>
- Fix ppp/isdn issue (interface up/down/up/down...)

* Thu Feb 15 2001 Trond Eivind Glomsrød <teg@redhat.com>
- remove init script - it makes some of the Dell servers hang.
- remove chkconfig in post, preun
- only include the usb files in /etc/hotplug - PCI hotplug
  doesn't work

* Wed Feb 14 2001 Trond Eivind Glomsrød <teg@redhat.com>
- Make summary and description match our old package
- sanitize initscript, so it matches the others
- Add Epoch, so we can upgrade older RPMs with Epoch: 2

* Wed Feb 14 2001 Greg Kroah-Hartman <greg@kroah.com>
- 2001_02_14 release

* Wed Jan 17 2001 Greg Kroah-Hartman <greg@kroah.com>
- changed specfile based on Chmouel Boudjnah's <chmouel@mandrakesoft.com> comments.

* Tue Jan 16 2001 Greg Kroah-Hartman <greg@kroah.com>
- tweaked the file locations due to the change in the tarball structure.
- 2001_01_16 release

* Mon Jan 15 2001 Greg Kroah-Hartman <greg@kroah.com>
- First cut at a spec file for the hotplug scripts.
- added patch to usb.rc to allow chkconfig to install and remove it.