+# fc18 needs 'x' permission for library files
+find $RPM_BUILD_ROOT -name \*.so -type f -exec chmod +x {} \;
+
+%if %{with lnet_dlc}
+echo '%attr(-, root, root) %{_libdir}/liblnetconfig.a' >>lustre.files
+echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so' >>lustre.files
+%endif
+
+%if %{with ldiskfs}
+echo '%{_libdir}/libiam.a' >>lustre.files
+%endif
+
+if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
+ echo '%{_libdir}/lustre/snmp' >>lustre.files
+ echo '%{_datadir}/lustre/snmp/mibs' >>lustre.files
+fi
+
+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