#!/bin/bash # $HeadURL$ $LastChangedRevision$ PROGNAME=${0##*/} echo "loading support modules ..." . $(ade-config ade_share_prefix)/include/adetestsupport.sh echo "setting up environment ..." SANDPIT=$(pwd) # We are going to install this module into a temp directory, with absolutely # no deferring to environment variables or to the contents of the -config.sh # script. First we need to work out the name of the script and also the # environment variable prefix, both of which depend on the name of the module, # which we don't know yet. So get that first. MODULE=$(ls $ADETEST_MODROOT/bin | sed -n 's/devsh.sh//p') UC_MODULE=${MODULE^^} [ "X$MODULE" != X ] || adetestsupport_error "can't get the name of this module" # Now we can unset environment variables set by *this* module's *-devsh # script, which we may be running under. eval "$(env | sed -nr "s/^(${UC_MODULE}_[A-Z_]+=).*/\\1/p")" echo "copying sources from working copy to sandpit and blanking settings in *-config.sh ..." cp -ar $ADETEST_MODROOT sources cd sources MODULE_CONFIG_SH=bin/$MODULE-config.sh perl -pi -e "s@^(${UC_MODULE}_(?:|LIB_|DOC_|BIN_|SHARE_|MAN_|MAN1_|MAN2_|MAN3_|MAN4_|MAN5_|MAN6_|MAN7_|MAN8_|ETC_|STATE_|LOG_)PREFIX)=.*@\$1=@; s@(^${UC_MODULE}_PREFIX)=@\$1=$SANDPIT/target@;" $MODULE_CONFIG_SH echo "remaking and installing ..." make clean distclean > /dev/null 2>&1 make > /dev/null 2>&1 make install > /dev/null 2>&1 echo "checking target contains all man pages ..." cd ../target # Assume all commands have man pages until proven otherwise ALL_HAVE_MAN_PAGES=true # Commands are in bin or sbin for CMD_DIR in bin sbin; do for CMD_FILE in $(ls $CMD_DIR 2>/dev/null); do # Man page directory and extension vary accordingly case $CMD_DIR in bin) MAN_EXT=1 ;; sbin) MAN_EXT=8 ;; esac if [ ! -f share/man/man$MAN_EXT/$CMD_FILE.$MAN_EXT ]; then echo "$CMD_FILE: has no man page" ALL_HAVE_MAN_PAGES=false fi done done # Set a suitable exit code echo "all done, setting appropriate exit code ..." $ALL_HAVE_MAN_PAGES