+%if %{build_lustre_osd_ldiskfs}
+%post osd-ldiskfs
+if [ -f /boot/System.map-%{kversion} ]; then
+ depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
+else
+ depmod -ae %{kversion} || exit 0
+fi
+
+OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
+# "weak modules" support
+# Suse
+if [ -x /usr/lib/module-init-tools/weak-modules ]; then
+ rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
+ /usr/lib/module-init-tools/weak-modules --add-modules
+fi
+# RedHat
+if [ -x /sbin/weak-modules ]; then
+ rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
+ /sbin/weak-modules --add-modules
+fi
+
+# If the kernel was built to reject unsupported modules (e.g. not a Lustre
+# kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
+# print a warning so that users are aware of this issue.
+if sysctl kernel.unsupported >/dev/null 2>&1 &&
+ [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
+ ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
+ echo "
+ warning: the Lustre modules are not supported by Novell. To use Lustre
+ on this system, you should put
+
+ allow_unsupported_modules 1
+
+ into /etc/modprobe.d/unsupported_modules"
+fi
+%endif
+
+%if %{build_lustre_osd_zfs}
+%post osd-zfs
+if [ -f /boot/System.map-%{kversion} ]; then
+ depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
+else
+ depmod -ae %{kversion} || exit 0
+fi
+
+OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
+# "weak modules" support
+# Suse
+if [ -x /usr/lib/module-init-tools/weak-modules ]; then
+ rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
+ /usr/lib/module-init-tools/weak-modules --add-modules
+fi
+# RedHat
+if [ -x /sbin/weak-modules ]; then
+ rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
+ /sbin/weak-modules --add-modules
+fi
+
+# If the kernel was built to reject unsupported modules (e.g. not a Lustre
+# kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
+# print a warning so that users are aware of this issue.
+if sysctl kernel.unsupported >/dev/null 2>&1 &&
+ [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
+ ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
+ echo "
+ warning: the Lustre modules are not supported by Novell. To use Lustre
+ on this system, you should put
+
+ allow_unsupported_modules 1
+
+ into /etc/modprobe.d/unsupported_modules"
+fi
+%endif
+