/usr/sbin/lc_modprobe is in lustre-utils 1.8.5+dfsg-3ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #!/bin/bash
#
# lc_modprobe - add lustre module options into modprobe.conf or
# modules.conf
#
#################################################################################
# Get the library of functions
. /usr/share/lustre/lc_common
# Check the kernel version
KERNEL_VERSION=`uname -r`
KERNEL_VERSION=${KERNEL_VERSION:0:3}
if [ "${KERNEL_VERSION}" = "2.4" ]; then
MODULE_CONF=/etc/modules.conf
else
MODULE_CONF=/etc/modprobe.conf
fi
read -r NETWORKS
MODLINES_FILE=/tmp/modlines$$.txt
START_MARKER=$"# start lustre config"
END_MARKER=$"# end lustre config"
# Generate a temp file contains lnet options lines
generate_lnet_lines() {
local LNET_LINE TMP_LINE
TMP_LINE="${NETWORKS}"
echo ${START_MARKER} > ${MODLINES_FILE}
echo "# Lustre module options added automatically by `basename $0`" >> ${MODLINES_FILE}
while true; do
LNET_LINE=${TMP_LINE%%\\n*}
echo ${LNET_LINE} >> ${MODLINES_FILE}
TMP_LINE=${TMP_LINE#*\\n}
if [ "${TMP_LINE}" == "${LNET_LINE}" ]; then
break
fi
done
echo ${END_MARKER} >> ${MODLINES_FILE}
#echo "--------------${MODLINES_FILE}--------------"
#cat ${MODLINES_FILE}
#echo -e "------------------------------------------\n"
return 0
}
if ! generate_lnet_lines; then
exit 1
fi
MODULE_CONF=$(fcanon ${MODULE_CONF})
# Add lnet options lines to the module configuration file
if [ -e ${MODULE_CONF} ]; then
# Delete the old options
sed -i "/${START_MARKER}/,/${END_MARKER}/d" ${MODULE_CONF}
fi
cat ${MODLINES_FILE} >> ${MODULE_CONF}
rm -f ${MODLINES_FILE}
exit 0
|