Path: blob/main/Mk/Scripts/dialog4ports.sh
16147 views
#! /bin/sh1# Maintainer: [email protected]2set -e3set -o pipefail45[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DIALOG4PORTS}" ] && set -x67if [ -z "${DIALOG4PORTS}" -o -z "${PORTSDIR}" -o -z "${MAKE}" ]; then8echo "DIALOG4PORTS, MAKE and PORTSDIR required in environment." >&29exit 110fi1112: ${DIALOGPORT:=ports-mgmt/dialog4ports}13: ${DIALOGNAME:=dialog4ports}1415OPTIONSFILE="$1"1617if ! [ -e $DIALOG4PORTS ]; then18# If INSTALL_AS_USER is set then just build and use the WRKDIR version19# Also do this if PREFIX!=LOCALBASE to avoid missing file or double20# installs21if [ -n "${INSTALL_AS_USER}" -o "${PREFIX}" != "${LOCALBASE}" ]; then22if ! [ -d "${PORTSDIR}/${DIALOGPORT}" ]; then23echo "===> Skipping 'config' as ${DIALOGPORT} is not checked out" >&224exit 125fi26DIALOG4PORTS=$(${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -V DIALOG4PORTS)27if ! [ -e "${DIALOG4PORTS}" ]; then28echo "===> Building ${DIALOGNAME} as it is required for the config dialog"29${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean build30fi31else32# Build+install through su-install as normal33echo "===> Building/installing ${DIALOGNAME} as it is required for the config dialog"34${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean install35# Need to clean again as it can't run twice in 1 call above36${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean37fi38fi3940# Backwards compat with older version which used stdout [<= 0.1.1] (or stderr [0.1.2]).41# Clear environment of PKGNAME or the dialog will show on older versions42# that do not understand -v.43if ! env -u PKGNAME ${DIALOG4PORTS} -v > /dev/null 2>&1; then44exec $DIALOG4PORTS > $OPTIONSFILE 2>&145fi4647# Newer versions use stderr to work around a jail issue48# http://lists.freebsd.org/pipermail/freebsd-ports/2013-March/082383.html49exec $DIALOG4PORTS 2> $OPTIONSFILE505152