All pastes #226780 Raw Edit

salet_de_proprio

public text v1 · immutable
#226780 ·published 2006-10-28 20:50 UTC
rendered paste body
#-------------------------------------------------------------------------
# Copyright (c) 2002-2006, XIMETA, Inc., FREMONT, CA, USA.
# All rights reserved.
#
# LICENSE TERMS
#
# The free distribution and use of this software in both source and binary 
# form is allowed (with or without changes) provided that:
#
#   1. distributions of this source code include the above copyright 
#      notice, this list of conditions and the following disclaimer;
#
#   2. distributions in binary form include the above copyright
#      notice, this list of conditions and the following disclaimer
#      in the documentation and/or other associated materials;
#
#   3. the copyright holder's name is not used to endorse products 
#      built using this software without specific written permission. 
#      
# ALTERNATIVELY, provided that this notice is retained in full, this product
# may be distributed under the terms of the GNU General Public License (GPL),
# in which case the provisions of the GPL apply INSTEAD OF those given above.
# 
# DISCLAIMER
#
# This software is provided 'as is' with no explcit or implied warranties
# in respect of any properties, including, but not limited to, correctness 
# and fitness for purpose. 
#-------------------------------------------------------------------------
%define ndas_rpm_epoch 0
%define ndas_rpm_version 1.0.4
%define ndas_rpm_build 11
%define ndas_kernel_version %(if [ -z "$NDAS_KERNEL_VERSION" ]; then uname -r ; else echo $NDAS_KERNEL_VERSION; fi)
%define ndas_kernel_arch %(if [ -z "$NDAS_KERNEL_ARCH" ]; then uname -m; else echo $NDAS_KERNEL_ARCH; fi)
%define ndas_kernel_arch_general %(echo %{ndas_kernel_arch} | sed -e 's/i.86/i386/')
%define ndas_kernel_version_simple %( echo %{ndas_kernel_version} | sed -e 's|-smp4G||g' -e 's|-bigsmp||g' -e 's|-psmp||g' -e 's|-smp||g' -e 's|smp||g' -e 's|xen0||' -e 's|xenU||' -e 's|-xenpae||' -e 's|-xen||' -e 's|xen||' -e 's|-default||' -e 's|-hugemem||' -e 's|hugemem||' -e 's|-kdump||' -e 's|kdump||' -e 's|PAE||' -e 's|-debug||' -e 's|-bigmem||' -e 's|bigmem||' -e 's|-SLRS||' -e 's|SLRS||' -e 's|-enterprise||' -e 's|enterprise||')
%define ndas_kernel_version_caninical_name %( echo %{ndas_kernel_version_simple} | sed -e 's|-|_|g')
%define ndas_rpm_release %{ndas_kernel_version_caninical_name}.%{ndas_rpm_build}
#
# Distros
#
%define ndas_redhat %(test ! -n "$NDAS_REDHAT"; echo $?)
%define ndas_suse %(test ! -n "$NDAS_SUSE"; echo $?)
%define ndas_debian %(test ! -n "$NDAS_DEBIAN"; echo $?)

%if !%{ndas_redhat} && !%{ndas_suse} && !%{ndas_debian}
%define ndas_redhat %(test ! -f /etc/fedora-release -a ! -f /etc/redhat-release -a ! -f /etc/mandrake-release -a ! -f /etc/mandriva-release -a ! -f /etc/mandrakelinux-release; echo $?)
%define ndas_suse %(test ! -f /etc/SuSE-release; echo $?)
%define ndas_debian %(test ! -f /etc/debian_version; echo $?)
%endif
#
# Identify which kernel version we will build the NDAS driver for.
#
%define ndas_for_2_4 %(echo %{ndas_kernel_version} | grep -c "^2\.4\.")
%define ndas_for_2_6 %(echo %{ndas_kernel_version} | grep -c "^2\.6\.")
#
# If smp or UP(default for SuSE), or xen0, xenU, xen(SuSE), xenpae(SuSE 10.1 or above), bigsmp(SuSE 9.1 or aboe), smp4G(9.0 or below) hugemem(Redhat EL, CentOS), kdump(FC5)
#
%define ndas_for_smp4G %(echo %{ndas_kernel_version} | grep -c smp4G)
%define ndas_for_psmp %(echo %{ndas_kernel_version} | grep -c psmp)
%define ndas_for_smp %(echo %{ndas_kernel_version} | grep -v smp4G | grep -v bigsmp| grep -v psmp| grep -c smp)
%define ndas_for_xen0 %(echo %{ndas_kernel_version} | grep -c xen0)
%define ndas_for_xenU %(echo %{ndas_kernel_version} | grep -c xenU)
%define ndas_for_xenpae %(echo %{ndas_kernel_version} | grep -c xenpae)
%define ndas_for_default %(echo %{ndas_kernel_version} | grep -c default)
%define ndas_for_deflt %(echo %{ndas_kernel_version} | grep -c deflt)
%define ndas_for_xen %(echo %{ndas_kernel_version} | grep -v xen0 | grep -v xenU | grep -v xenpae | grep -c xen)
%define ndas_for_bigsmp %(echo %{ndas_kernel_version} | grep -c bigsmp)
%define ndas_for_hugemem %(echo %{ndas_kernel_version} | grep -c hugemem)
%define ndas_for_kdump %(echo %{ndas_kernel_version} | grep -c kdump)
%define ndas_for_PAE %(echo %{ndas_kernel_version} | grep -c PAE)
%define ndas_for_debug %(echo %{ndas_kernel_version} | grep -c debug)
%define ndas_for_bigmem %(echo %{ndas_kernel_version} | grep -c bigmem)
%define ndas_for_SLRS %(echo %{ndas_kernel_version} | grep -c SLRS)
%define ndas_for_enterprise %(echo %{ndas_kernel_version} | grep -c enterprise)
#
# postfix name of package name ie: -smp, -hugmem
#
%define ndas_name_postfix %(echo "") 
%if %{ndas_for_debug}
%define ndas_name_postfix debug
%endif
%if %{ndas_for_PAE}
%define ndas_name_postfix PAE
%endif
%if %{ndas_for_kdump}
%define ndas_name_postfix kdump
%endif
%if %{ndas_for_bigmem}
%define ndas_name_postfix bigmem
%endif
%if %{ndas_for_hugemem}
%define ndas_name_postfix hugemem
%endif
%if %{ndas_for_default}
%define ndas_name_postfix default
%endif
%if %{ndas_for_deflt}
%define ndas_name_postfix deflt
%endif
%if %{ndas_for_smp}
%define ndas_name_postfix smp
%endif
%if %{ndas_for_psmp}
%define ndas_name_postfix psmp
%endif
%if %{ndas_for_smp4G}
%define ndas_name_postfix smp4G
%endif
%if %{ndas_for_xen0}
%define ndas_name_postfix xen0
%endif
%if %{ndas_for_xenU}
%define ndas_name_postfix xenU
%endif
%if %{ndas_for_xenpae}
%define ndas_name_postfix xenpae
%endif
%if %{ndas_for_xen}
%define ndas_name_postfix xen
%endif
%if %{ndas_for_bigsmp}
%define ndas_name_postfix bigsmp
%endif
%if %{ndas_for_SLRS}
%define ndas_name_postfix SLRS
%endif
%if %{ndas_for_enterprise}
%define ndas_name_postfix enterprise
%endif

#
# Define
#  1. the rpm name of this package
#  2. the rpm name of the kernel on which this rpm depends 
#
%if %{ndas_suse}
#
# SuSE kernel module rpm name
#
#%define ndas_suse_rpm_name km_ndas
# SuSE kernel module has names like "km_{module_name}", but for now, we will use ndas-kernel.
#
%define ndas_suse_rpm_name ndas-kernel
#
# Add post fix such as smp, psmp, smp4G and so on.
#
%define ndas_rpm_name %{ndas_suse_rpm_name}-%{ndas_name_postfix}

%define ndas_rpm_kernel %(if [ "%{ndas_for_2_4}" == "1" ]; then echo "k_" ; else echo "kernel-"; fi)%{ndas_name_postfix}
%else
%if %{ndas_debian}
%if %{ndas_for_2_4} || "%(echo %{ndas_kernel_version} | cut -c1-5)" == "2.6.8"
%define ndas_debian_kernel linux-image
%else
%define ndas_debian_kernel kernel-image
%endif
%if "%{ndas_name_postfix}" == ""
%define ndas_rpm_name ndas-kernel
%define ndas_rpm_kernel %{ndas_debian_kernel}
%else
%define ndas_rpm_name ndas-kernel-%{ndas_name_postfix}
%define ndas_rpm_kernel %{ndas_debian_kernel}-%{ndas_name_postfix}
%endif
%else
%if "%{ndas_name_postfix}" == ""
%define ndas_rpm_name ndas-kernel
%define ndas_rpm_kernel kernel
%else
%define ndas_rpm_name ndas-kernel-%{ndas_name_postfix}
%define ndas_rpm_kernel kernel-%{ndas_name_postfix}
%endif
%endif
%endif
# 
# Module's extension
#
%if %{ndas_for_2_4}
%define module_ext o
%else
%define module_ext ko
%endif
#
# The maximum hard disk supported by NDAS Host in the same time
#
# For kernel 2.4.x , 32
#
%define ndas_max_slot_24 32
# For kernel 2.6.x  (TODO: should be 1048576)
#
# Note: Debian (not Ubuntu) has the file system that doesn't support minor number 
# exceeds 255. So the max number of NDAS disk that can have the slot is 15 
# as 15 * 16(max partitions in a disk in 2.6.x kernel) < 255
# whlie 16 * 16 = 256 > 255. see that the minor for /dev/ndas will be 15*16 = 240
#
%if %{ndas_debian}
%define ndas_max_slot_26 15
%else
%define ndas_max_slot_26 16
%endif
%if %{ndas_for_2_4}
%define ndas_max_slot %(if [ -z "$NDAS_MAX_SLOT" ]; then echo %{ndas_max_slot_24}; else echo $NDAS_MAX_SLOT; fi)
%else
%define ndas_max_slot %(if [ -z "$NDAS_MAX_SLOT" ]; then echo %{ndas_max_slot_26}; else echo $NDAS_MAX_SLOT; fi)
%endif
# Turn off debuginfo package
%define debug_package %{nil}

Summary: XIMETA,Inc NDAS device driver for Linux operating system
Name: %{ndas_rpm_name}
Epoch: %{ndas_rpm_epoch}
Version: %{ndas_rpm_version}
Release: %{ndas_rpm_release}
Vendor: XIMETA, Inc
Packager: Gene Park (jhpark)
License: Proprietary Copyright (c) XIMETA, Inc
Group: System Environment/Kernel
Source0: http://code.ximeta.com/download/%{ndas_rpm_version}/linux/ndas-%{ndas_rpm_version}-%{ndas_rpm_build}.tar.gz
BuildRoot: %{_tmppath}/ndas-buildroot
%if %{ndas_suse}
BuildPrereq: /bin/uname /usr/bin/sed 
%else
BuildPrereq: /bin/uname /bin/sed 
%endif
Prereq: /sbin/chkconfig
Prereq: /sbin/insmod 
Prereq: /sbin/depmod
Prereq: %{ndas_rpm_kernel} = %{ndas_kernel_version_simple}
Obsoletes: ndas
Provides: ndas
ExclusiveArch: i386 i586 i686 althon
%description 
%{ndas_rpm_name} - This program allows the user to access the XIMETA NDAS hard disk via the Network. This package only works with kernel version %{ndas_kernel_version_simple}.

%package -n ndas-admin
Summary: Administration toosl for XIMETA,Inc NDAS device driver for Linux operating system
Group: System Environment/Base
Release: %{ndas_rpm_build}
Prereq: ndas = %{ndas_rpm_version}-%{ndas_rpm_build}
%description -n ndas-admin
ndas-admin - This program allows the user to register/enable/disable/unregister the XIMETA NDAS hard disk.

%prep
%setup -q -n ndas-%{ndas_rpm_version}-%{ndas_rpm_build}
%build
export NDAS_EXTRA_CFLAGS="$NDAS_EXTRA_CFLAGS -DNDAS_IO_UNIT=64 -DNDAS_SNAP -DNDAS_MAX_SLOT=%{ndas_max_slot}"
ARCH=%{ndas_kernel_arch_general} make ndas_version=%{ndas_rpm_version} ndas_build=%{ndas_rpm_build} ndas-kernel ndas-admin
echo %{_rpmdir}/%{_target_cpu}/%{name}-%{ndas_rpm_version}-%{ndas_rpm_release}.%{_target_cpu}.rpm > /tmp/.file || true 
%install
rm -rf $RPM_BUILD_ROOT
install -d -m 755 $RPM_BUILD_ROOT/lib/modules/%{ndas_kernel_version}/kernel/drivers/block/ndas
install -m 644 ndas_sal.%{module_ext} $RPM_BUILD_ROOT/lib/modules/%{ndas_kernel_version}/kernel/drivers/block/ndas/ndas_sal.%{module_ext}
install -m 644 ndas_core.%{module_ext} $RPM_BUILD_ROOT/lib/modules/%{ndas_kernel_version}/kernel/drivers/block/ndas/ndas_core.%{module_ext}
install -m 644 ndas_block.%{module_ext} $RPM_BUILD_ROOT/lib/modules/%{ndas_kernel_version}/kernel/drivers/block/ndas/ndas_block.%{module_ext}
install -m 444 CREDITS.txt $RPM_BUILD_ROOT/lib/modules/%{ndas_kernel_version}/kernel/drivers/block/ndas/CREDITS.txt

install -d -m 755 $RPM_BUILD_ROOT/usr/share/ndas/
install -d -m 755 $RPM_BUILD_ROOT%{_sbindir}/
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/init.d
install -m 700 mknod.sh $RPM_BUILD_ROOT/usr/share/ndas/mknod.sh
install -s -m 755 ndasadmin $RPM_BUILD_ROOT%{_sbindir}/ndasadmin
install -m 755 ndas $RPM_BUILD_ROOT/usr/share/ndas
install -m 755 ndas.suse $RPM_BUILD_ROOT/usr/share/ndas
install -m 644 README $RPM_BUILD_ROOT/usr/share/ndas/README
install -m 644 INSTALL $RPM_BUILD_ROOT/usr/share/ndas/INSTALL
%post
depmod > /dev/null 2>&1 || true
%post -n ndas-admin
if [ -f /dev/ndas ] ; then
    rm -f /dev/ndas; # for ticket #44 of code.ximeta.com
fi     
if [ -f /etc/debian_version ]; then
    ln -sf /usr/share/ndas/ndas /etc/init.d/ndas;
    /usr/sbin/update-rc.d ndas start 73 2 3 4 5 . stop 13 0 1 6 .
else
if [ ! -f /etc/SuSE-release ] ; then
    ln -sf /usr/share/ndas/ndas /etc/init.d/ndas;
    /sbin/chkconfig --add ndas;
    /sbin/chkconfig --level 2345 ndas on ;
else
    ln -sf /usr/share/ndas/ndas.suse /etc/init.d/ndas;
    /sbin/chkconfig --add ndas;
fi
fi
/bin/sh /etc/init.d/ndas start
%preun -n ndas-admin
/bin/sh /etc/init.d/ndas stop
%postun -n ndas-admin
rm -f /etc/rc?.d/[SK]??ndas > /dev/null 2>&1 || /bin/true
rm -f /etc/init.d/ndas
if [ -f /etc/debian_version ]; then
    /usr/sbin/update-rc.d -f ndas remove > /dev/null 2>&1 || /bin/true
else
    /sbin/chkconfig --del ndas > /dev/null 2>&1 || /bin/true
fi
rm -rf /dev/nd* || /bin/true
%clean
rm -rf $RPM_BUILD_ROOT
%files
/lib/modules/%{ndas_kernel_version}/kernel/drivers/block/ndas/ndas_sal.%{module_ext}
/lib/modules/%{ndas_kernel_version}/kernel/drivers/block/ndas/ndas_core.%{module_ext}
/lib/modules/%{ndas_kernel_version}/kernel/drivers/block/ndas/ndas_block.%{module_ext}
/lib/modules/%{ndas_kernel_version}/kernel/drivers/block/ndas/CREDITS.txt
%files -n ndas-admin
%{_sbindir}/ndasadmin
/usr/share/ndas/mknod.sh
/usr/share/ndas/README
/usr/share/ndas/INSTALL
/usr/share/ndas/ndas
/usr/share/ndas/ndas.suse

%doc 
%changelog
* Fri Jul 29 2005 XIMETA,Inc. <supports@ximeta.com>
- NDAS RAID 0/1/4 (beta)
 
* Mon Mar 21 2005 XIMETA,Inc. <supports@ximeta.com>
- Multi Network Interface cards are supported
- Better supports for multi NDAS disks
- Fixed other bugs 

* Thu Mar 17 2005 XIMETA,Inc. <supports@ximeta.com>
- Fixed ticks per a second

 
 * Version 1.0.4
 * Version 1.0.3
   Fixed the crash on registering after register/enable/disable/unregister
 * Version 1.0.2
   Fixed the bug when registering 5 or more disks
   Added the more routine to identify the cause on starting the service
 * Version 1.0.1
   Added the routines to check the kernel version on ndas_sal module instertion
   Avoid cfq io elevation scheduler due to incompatibility issue
   Compatible with SuSE 9.0 2.4.21-99 kernels, Redhat Enterprise Linux 2.x and
CentOS 2.x.
 * Version 1.0.0
   /proc/ndas/devices/[registered name] directory is provided
   Compatible with Debian, Ubuntu, Redhat Enterprise Linux, Gentoo, SuSE, Fedora Core, Mandriva, CentOS.
   Package is seperated into ndas-kernel-* and ndas-admin. so that the
multiple kernel packages can be installed into one system for the multiple
kernels.
 * Version 0.9.9
   Package name is changed as km_ndas-default, km_ndas-smp for SuSE. 
 * Version 0.9.8
   Block device path is now /dev/ndas-[NDAS serial]:[unit #] for 2.6.x kernel
   The previous enabled devices are enabled at the booting time and will be mounted by autofs if the disk is online.
 * Version 0.9.6
   GFS Support
 * Version 0.9.5
    First public release
 * Version 0.9.4
    Fixed possible deadlock. 
 * Version 0.9.3
    Fixed problems that make kernel panic when communicating with PC side
software.
 * Version 0.9.2
    Fixed problems that driver hangs while reading.
    Minor bug fixes.
 * Version 0.9.0
    Write-performance optimization. Fixed a problem that hang. Fixed a
problem using VFAT in Linux 2.6 kernel.
    Reconnection funtion is enabled.