Subversion Repositories livecd

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
36 beyerle@PS 1
# -------------------------------------------------------------------------------------------
2
#
3
# How to build for SMP and UP kernel
4
#
5
#  rpmbuild -ba --target i686   --define 'kernel 2.6.9-42.0.2.EL' unionfs.spec
6
#  rpmbuild -ba --target x86_64 --define 'kernel 2.6.9-42.0.2.EL' unionfs.spec
7
#
8
# or only for UP kernel
9
#
10
#  rpmbuild -ba --target i686   --define 'kernel 2.6.9-42.0.2.EL' --define 'buildsmp 0' unionfs.spec
11
#  rpmbuild -ba --target x86_64 --define 'kernel 2.6.9-42.0.2.EL' --define 'buildsmp 0' unionfs.spec
12
#
13
#
14
# for the running kernel:
15
#
16
#  rpmbuild -ba --target i686   unionfs.spec
17
#  rpmbuild -ba --target x86_64 unionfs.spec
18
#
19
# -------------------------------------------------------------------------------------------
20
 
21
%{!?buildsmp:%define buildsmp 1}
22
 
23
%{?!kernel:%define kernel %(rpm -q kernel-devel | tail -1 | sed -e 's|kernel-devel-||')}
24
 
25
%define kversion %(echo "%{kernel}" | sed -e 's|-.*||')
26
%define krelease %(echo "%{kernel}" | sed -e 's|.*-||')
27
 
28
%define kernel_src_path %{_usrsrc}/kernels/%{kernel}-%{_target_cpu}
29
%define kernel_smp_src_path %{_usrsrc}/kernels/%{kernel}-smp-%{_target_cpu}
30
 
31
%define kernel_moduledir /lib/modules/%{kernel}
32
%define kernel_smp_moduledir /lib/modules/%{kernel}smp
33
 
34
%define pkg_name unionfs
35
%define kmdl_name kernel-module-%{pkg_name}-%{kernel}
36
 
37
# -------------------------------------------------------------------------------------------
38
 
39
Summary: 	A Stackable Unification File System
40
Name: 		%{pkg_name}
41
Version: 	1.1.5
42
Release: 	2.sl4.psi
43
Epoch: 		0
44
Packager: 	Urs Beyerle <urs.beyerle@psi.ch>
45
License: 	GPL
46
Group: 		System Environment/Kernel
47
Source0: 	ftp://ftp.fsl.cs.sunysb.edu/pub/unionfs/%{name}-%{version}.tar.gz
48
URL: 		http://www.am-utils.org/project-unionfs.html
49
Patch0:		unionfs-1.1.5-rhel4.patch
50
Patch1:		unionfs-1.1.5-kernel-2.6.9-42.0.2.EL.patch
51
Patch2:		unionfs-1.1.5-Makefile.patch
52
Patch3:		unionfs-1.1.5-copyup-security.patch
53
BuildRoot: 	%{_tmppath}/%{name}-%{version}-%{release}-buildroot
54
Requires:       kernel-module-%{pkg_name} >= %{version}-%{release}
55
BuildRequires: 	kernel-devel = %{kernel}, 
56
%if %{buildsmp}
57
BuildRequires: 	kernel-smp-devel = %{kernel}
58
%endif
59
 
60
%description
61
This project builds a stackable unification file system, which 
62
can appear to merge the contents of several directories (branches), 
63
while keeping their physical content separate. Unionfs is useful 
64
for unified source tree management, merged contents of split 
65
CD-ROM, merged separate software package directories, data grids, 
66
and more. Unionfs allows any mix of read-only and read-write 
67
branches, as well as insertion and deletion of branches anywhere 
68
in the fan-out. To maintain unix semantics, Unionfs handles 
69
elimination of duplicates, partial-error conditions, and more. 
70
Unionfs is part of the larger FiST project.
71
 
72
Kernel modules for unionfs are in kernel-module-%{pkg_name} rpms.
73
 
74
%package -n 	%{kmdl_name}
75
Summary:        kernel modules for %{name}.
76
Group:          System Environment/Kernel
77
License:        GPL
78
Provides:       kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
79
Requires:       %{pkg_name}
80
 
81
%description -n %{kmdl_name}
82
Kernel modules for %{name}.
83
 
84
%if %{buildsmp}
85
 
86
%package -n 	%{kmdl_name}smp
87
Summary: 	smp kernel modules for %{name}.
88
Group: 		System Environment/Kernel
89
License: 	GPL
90
Provides:	kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
91
Requires:	%{pkg_name}
92
 
93
%description -n %{kmdl_name}smp
94
SMP kernel modules for %{name}.
95
 
96
%endif
97
 
98
%prep
99
%setup -q
100
 
101
%patch0 -p1
102
%patch1 -p1
103
%patch2 -p1
104
%patch3 -p1
105
 
106
%build
107
echo -e "\nDriver version: %{version}\nKernel version: %{kernel}\n"
108
 
109
### build statically linked unionctl
110
make clean
111
cp -a Makefile Makefile.ori
112
sed -i "s|^CC.*=.*gcc|CC      = gcc -static|" Makefile
113
make unionctl
114
cp -a unionctl unionctl.static
115
mv -f Makefile.ori Makefile
116
 
117
### UP kernel
118
make clean
119
KVERS="%{kernel}" PREFIX=${RPM_BUILD_ROOT}%{_prefix} make
120
 
121
INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kernel}/kernel"
122
mkdir -p "${INST_MODLIB}/fs/unionfs"
123
install -p -m 744 unionfs.ko "${INST_MODLIB}/fs/unionfs/"
124
 
125
### SMP kernel
126
%if %{buildsmp}
127
 
128
make clean
129
KVERS="%{kernel}smp" PREFIX=${RPM_BUILD_ROOT}%{_prefix} make
130
 
131
INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kernel}smp/kernel"
132
mkdir -p "${INST_MODLIB}/fs/unionfs"
133
install -p -m 744 unionfs.ko "${INST_MODLIB}/fs/unionfs/"
134
 
135
%endif
136
 
137
%install
138
# "make install-utils" does not work - we do it manually
139
# PREFIX=${RPM_BUILD_ROOT}/%{_prefix} make install-utils
140
 
141
mkdir -p ${RPM_BUILD_ROOT}/%{_prefix}/sbin
142
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man4
143
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man8
144
 
145
cp unionctl ${RPM_BUILD_ROOT}/%{_prefix}/sbin
146
cp unionctl.static ${RPM_BUILD_ROOT}/%{_prefix}/sbin
147
cp uniondbg ${RPM_BUILD_ROOT}/%{_prefix}/sbin
148
cp unionimap ${RPM_BUILD_ROOT}/%{_prefix}/sbin
149
 
150
cp man/unionfs.4 ${RPM_BUILD_ROOT}/%{_mandir}/man4
151
cp man/unionctl.8 ${RPM_BUILD_ROOT}/%{_mandir}/man8
152
cp man/uniondbg.8 ${RPM_BUILD_ROOT}/%{_mandir}/man8
153
 
154
%clean
155
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
156
 
157
%postun -n %{kmdl_name}
158
depmod -a %{kernel} >/dev/null 2>&1 || :	
159
 
160
%post -n %{kmdl_name}
161
depmod -a %{kernel} >/dev/null 2>&1 || :
162
 
163
%if %{buildsmp}
164
%postun -n %{kmdl_name}smp
165
depmod -a %{kernel}smp >/dev/null 2>&1 || :
166
 
167
%post -n %{kmdl_name}smp
168
depmod -a %{kernel}smp >/dev/null 2>&1 || :
169
%endif
170
 
171
%files 
172
%defattr(-,root,root,-)
173
%doc AUTHORS BUGS ChangeLog COPYING INSTALL NEWS README
174
%{_prefix}/sbin/*
175
%{_mandir}/man4/*
176
%{_mandir}/man8/*
177
 
178
%files -n %{kmdl_name}
179
%defattr(-,root,root,-)
180
/lib/modules/%{kernel}/kernel/fs/unionfs
181
 
182
%if %{buildsmp}
183
%files -n %{kmdl_name}smp
184
%defattr(-,root,root,-)
185
/lib/modules/%{kernel}smp/kernel/fs/unionfs
186
%endif
187
 
188
%changelog
189
* Mon Oct 16 2006 Urs Beyerle <urs.beyerle@psi.ch>  1.1.5-2.sl4.psi
190
- add unionctl.static (statically linked unionctl), needed for LiveCD
191
 
192
* Thu Aug 31 2006 Urs Beyerle <urs.beyerle@psi.ch>  1.1.5-1.sl4.psi
193
- inital build.