#!/bin/sh
PWD=`pwd`
BASENAME=`basename $PWD`
if [ "X$BASENAME" != "Xpam_modules" ]; then
echo "$0 must be run from the .../pam_modules directory"
exit 1
fi
merge_line ()
{
if [ $ echo "usage: merge_line token filename 'new line'"
fi
if [ -f $2 ]; then
grep -v "$1" $2 > $2.tmp
rm -f $2
mv $2.tmp $2
fi
cat << EOT >> $2
$3
EOT
}
if [ $
cat << EOT 2>&1
$0: this script takes TWO arguments:
the 'alphanumeric label' of the module and the location of
its object file from the .../modules/ directory
EOT
exit 1
else
OFILE=$2
echo "
*> registering static module: $1 ($OFILE) <*
"
merge_line "$1" ../pam/pam/modules/_static_module_list "\
extern struct pam_module _$1_modstruct;"
merge_line "$1" ../pam/pam/modules/_static_module_entry " &_$1_modstruct,"
if [ -n "$OFILE" ]; then
merge_line "$OFILE" ../pam/pam/modules/_static_module_objects "../../../pam_modules/$OFILE"
fi
fi
exit 0