#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# lustre-dkms_post-build.sh
+#
+# Script run after dkms build
+#
+
+#
# $1 : $module
# $2 : $module_version
# $3 : $kernelver
# beginning of the DKMS build step when its content has to be on-target
# customized during pre_build script. This can lead to incomplete list
# of built Lustre kernel modules then to be saved for next DKMS install step.
+#
+#
# Use this place to also save config.log that has been generated during
# pre_build.
# $7/$1/$2/$3/$5/log repository should have already been created to save
# make.log and $kernel_config
-mkdir -p "$7/$1/$2/$3/$5/log"
-mv -f "$7/$1/$2/build/config.log" "$7/$1/$2/$3/$5/log/config.log" 2>/dev/null
-
-# read last dkms.conf version that has just been customized during pre_build
-source $6/$1-$2/dkms.conf
-
-# Make sure all the modules built successfully
-for ((count=0; count < ${#BUILT_MODULE_NAME[@]}; count++)); do
- # Lustre supported kernels are >= 2.5, so don't need to check for old .o
- # module suffix
- [[ -e ${BUILT_MODULE_LOCATION[$count]}${BUILT_MODULE_NAME[$count]}.ko ]] && continue
- echo "Build of ${BUILT_MODULE_NAME[$count]}.ko failed for: $3 ($5)" \
- "Consult logs in $7/$1/$2/$3/$5/log/ for more information."
-done
-
-# Strip modules ?
-for ((count=0; count < ${#BUILT_MODULE_NAME[@]}; count++)); do
- [[ ${STRIP[$count]} = '' ]] && STRIP[$count]=${STRIP[0]:-yes}
- [[ ${STRIP[$count]} != no ]] && strip -g "$7/$1/$2/build/${BUILT_MODULE_LOCATION[$count]}${BUILT_MODULE_NAME[$count]}.ko"
+#
- # Save a copy of the new module in save area that should have been created in previous build steps
- mkdir -p "$7/$1/$2/$3/$5/module" >/dev/null
- # if DEST_MODULE_NAME[] is different than BUILD_MODULE_NAME[], need to use it as the module name in save area
- # this is not presently the case for none of the Lustre kernel modules.
- cp -f "$7/$1/$2/build/${BUILT_MODULE_LOCATION[$count]}${BUILT_MODULE_NAME[$count]}.ko" \
- "$7/$1/$2/$3/$5/module/${BUILT_MODULE_NAME[$count]}.ko" >/dev/null
-done
+mkdir -p "$7/$1/$2/$3/$5/log"
+cp -f "$7/$1/$2/build/config.log" "$7/$1/$2/$3/$5/log/config.log" 2>/dev/null
+cp -f "$7/$1/$2/build/config.h" \
+ "$7/$1/$2/build/Module.symvers" \
+ "$7/$1/$2/$3/$5/" 2> /dev/null
+case $1 in
+ lustre-zfs|lustre-all)
+ # To satisfy the content of lustre-osd-zfs-mount install these scripts:
+ for script in statechange-lustre.sh \
+ vdev_attach-lustre.sh \
+ vdev_clear-lustre.sh \
+ vdev_remove-lustre.sh
+ do
+ install -D -m 0755 lustre/scripts/${script} /etc/zfs/zed.d/${script}
+ done
+ ;;
+esac