+find $RPM_BUILD_ROOT%{_libdir}/@PACKAGE@ \
+ -name \*.la -type f -exec rm -f {} \;
+
+%if %{with lustre_tests}
+echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
+echo '%{_bindir}/mcreate' >>lustre-tests.files
+echo '%{_bindir}/munlink' >>lustre-tests.files
+echo '%{_bindir}/req_layout' >>lustre-tests.files
+echo '%{_sbindir}/wirecheck' >>lustre-tests.files
+echo '%{_sbindir}/wiretest' >>lustre-tests.files
+%if %{with lustre_modules}
+echo '%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko' >>lustre-tests.files
+%endif
+%endif
+
+%if %{defined cross_path}
+%if %{defined rpm_post_base}
+POST_SCRIPT=$RPM_BUILD_DIR/lustre-%{version}/%{post_script}
+if [ -f $POST_SCRIPT ]; then
+ cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}.sh
+ echo '%attr(0555, root, root) %{rpm_post_base}.sh' >>lustre.files
+ cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-modules.sh
+%if %{with ldiskfs}
+ cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-osd-ldiskfs.sh
+%if %{with lustre_utils}
+ cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-mount-osd-ldiskfs.sh
+%endif
+%endif
+%if %{with zfs}
+ cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-osd-zfs.sh
+%if %{with lustre_utils}
+ cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-mount-osd-zfs.sh
+%endif
+%endif
+%if %{with lustre_tests}
+ cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-tests.sh
+ echo '%attr(0555, root, root) %{rpm_post_base}-tests.sh' >>lustre-tests.files
+%endif
+fi
+%endif
+%else
+%if %{with lustre_modules}
+# mark modules executable for find-debuginfo.sh
+find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/%{kmoddir} \
+ -name \*.ko -type f -exec chmod u+x {} \;
+%endif
+%endif
+
+%files -f lustre.files
+%defattr(-,root,root)
+%{_sbindir}/*
+%exclude %{_sbindir}/wirecheck
+%exclude %{_sbindir}/wiretest
+%if %{with zfs}
+%exclude %{_sbindir}/zfsobj2fid
+%endif
+%if %{with lustre_utils}
+%if %{with servers}
+%{_libexecdir}/lustre/lc_common
+%{_libexecdir}/lustre/haconfig
+%{_bindir}/lustre_req_history
+%endif