File os-prober.spec of Package os-prober

Name:           os-prober
Version:        1.56
Release:        1%{?dist}
Summary:        Probes disks on the system for installed operating systems

Group:          System Environment/Base
# For more information about licensing, see copyright file.
License:        GPL-2.0+
URL:            http://kitenet.net/~joey/code/os-prober/
Source0:        http://ftp.de.debian.org/debian/pool/main/o/os-prober/%{name}_%{version}.tar.gz
# move newns binary outside of os-prober subdirectory, so that debuginfo
# can be automatically generated for it
Patch0:         os-prober-newnsdirfix.patch
Patch1:         os-prober-no-dummy-mach-kernel.patch
Patch2:         os-prober-SUSE.patch
# Sent upstream
Patch3:         os-prober-mdraidfix.patch
Patch4:         os-prober-yaboot-parsefix.patch
Patch5:         os-prober-usrmovefix.patch
# added by Agnelo de la Crotche
Patch6:         os-prober-mountedtests-ufs2fix.patch
Patch7:         os-prober-linuxdistro-ufsfix.patch
Patch8:         os-prober-bsd-newprobesfix.patch
# added by arvidjaar & Agnelo de la Crotche for ELILO
Patch9:         os-prober-lsb-long.patch
Patch10:        os-prober-skip-MS-legacy-on-UEFI.patch
Patch11:        os-prober-UEFI-support.patch

Requires:       dmraid lvm2 udev coreutils util-linux
Requires:       /bin/grep /bin/sed /sbin/modprobe

%define libexecdir   %{_libexecdir}
%if 0%{?mandriva_version}
%ifarch x86_64
%define libexecdir   %{_prefix}/lib
%endif
%endif

%description
This package detects other OSes available on a system and outputs the results
in a generic machine-readable format. Support for new OSes and Linux
distributions can be added easily. 

%prep
%setup -q
%patch0 -p1 -b .newnsdirfix
%patch1 -p1 -b .macosxdummyfix
%patch2 -p1
%patch3 -p1
%patch4 -p1 -b .yaboot-parsefix
%patch5 -p1
%patch6 -p1 
%patch7 -p1 
%patch8 -p1 
%patch9 -p1 
%patch10 -p1 
%patch11 -p1 
#
%if 0%{?rhel_version} || 0%{?fedora_version} || 0%{?centos_version}
find -type f -exec sed -i -e 's|usr/lib|usr/libexec|g' {} \;
sed -i -e 's|grub-probe|grub2-probe|g' os-probes/common/50mounted-tests \
     linux-boot-probes/common/50mounted-tests
%endif

%if 0%{?suse}
sed -i -e 's|grub-probe|grub2-probe|g' os-probes/common/50mounted-tests \
     linux-boot-probes/common/50mounted-tests
%endif


%build
%{__make} %{?_smp_mflags} CFLAGS="%{optflags}"

chmod 0755 os-probes/mounted/x86/*bsd 
chmod 0755 os-probes/mounted/x86/05efi 
chmod 0755 os-probes/mounted/x86/efi/10elilo 
chmod 0755 os-probes/mounted/x86/efi/20microsoft 

%install
install -m 0755 -d %{buildroot}%{_bindir}
install -m 0755 -d %{buildroot}%{_var}/lib/%{name}

install -m 0755 -p os-prober linux-boot-prober %{buildroot}%{_bindir}
install -m 0755 -Dp newns %{buildroot}%{libexecdir}/newns
install -m 0644 -Dp common.sh %{buildroot}%{_datadir}/%{name}/common.sh

%ifarch m68k
ARCH=m68k
%endif
%ifarch ppc ppc64
ARCH=powerpc
%endif
%ifarch sparc sparc64
ARCH=sparc
%endif
%ifarch %{ix86} x86_64
ARCH=x86
%endif

for probes in os-probes os-probes/mounted os-probes/init \
              linux-boot-probes linux-boot-probes/mounted; do
        install -m 755 -d %{buildroot}%{libexecdir}/$probes 
        cp -a $probes/common/* %{buildroot}%{libexecdir}/$probes
        if [ -e "$probes/$ARCH" ]; then 
                cp -a $probes/$ARCH/* %{buildroot}%{libexecdir}/$probes 
        fi
done
if [ "$ARCH" = x86 ]; then
        install -m 755 -p os-probes/mounted/powerpc/20macosx \
            %{buildroot}%{libexecdir}/os-probes/mounted
fi

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc README TODO debian/copyright debian/changelog
%{_bindir}/*
%{libexecdir}/*
%{_datadir}/%{name}
%{_var}/lib/%{name}

%changelog

* Sat Oct 13 2012 Agnelo de la Crotche <agnelo@unixversal.com> 1.56-1
- added os-prober-lsb-long.patch
- modified os-prober-SUSE.patch to include codename in OS description
- modified os-prober-UEFI-support.patch to include vendor name in ELILO long name
 
* Tue Oct 09 2012 Agnelo de la Crotche <agnelo@unixversal.com> - 1.56
- Update to version 1.56
- add UEFI support - arvidjaar <arvidjaar@gmail.com>
  * os-prober-skip-MS-legacy-on-UEFI.patch
  * os-prober-UEFI-support.patch

* Mon Aug 27 2012 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.55-1
- Update to new upstream version: 1.55

* Sat Jun 02 2012 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.53-3
- Consider usrmoved distribtions in fallback linux detector (bug #826754)
- Remove patch backup files from final rpm package (by not creating a backup!)

* Thu May 31 2012 Agnelo de la Crotche <agnelo@unixversal.com> - 1.53-3
- Fixed ufs2 mounting bug
- Added support for FreeBSD, NetBSD and openBSD
- Fixed 'unknown Linux' by skiping ufs partitions
- Added Debug flag OSPDEBUG to 50mounted-tests  

* Fri May 25 2012 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.53-2
- Add support for OSes installed on Linux mdraid partitions, bug #752402
- Add Fedora's grub2 config path, fixes generating menu entries for other
  installed Fedora's
- Fixed bug in parsing yaboot.conf: accept spaces around '=' for append, 
  bug #825041

* Fri May 11 2012 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.53-1
- Updated to 1.53 for a bugfix
- Fixed directory name in upstream tarbal

* Thu May 10 2012 Peter Jones <pjones@redhat.com> - 1.52-3
- Don't detect our Mac boot blocks as OS X.
  Resolves: rhbz#811412

* Sun Apr 29 2012 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.52-2
- use correct directory name for setup

* Sun Apr 29 2012 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.52-1
- Updated to 1.52, supports win 8

* Wed Mar 28 2012 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.51-1
- Update to latest upstream version, 1.51

* Sat Jan 21 2012 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.48-3
- Remove dmraid and lvm2 dependency. bug #770393

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.48-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Jul 25 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.48-1
- Updated to 1.48 release

* Thu May 19 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.47-1
- Updated to the new upstream version 1.47

* Wed May 04 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.46-2
- Removed obsolete parts (build tag, defattr, etc)
- Added a patch to move newns outside of os-prober subdirectory
- Added required utilities as package requires

* Sat Apr 30 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.46-1
- Updated to 1.46 release

* Tue Feb 22 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.42-2
- Remove executable permission from common.sh

* Thu Feb 17 2011 Hedayat Vatankhah <hedayat.fwd+rpmchlog@gmail.com> - 1.42-1
- Initial version
openSUSE Build Service is sponsored by