Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/Mk/Scripts/dialog4ports.sh
16461 views
1
#! /bin/sh
2
# Maintainer: [email protected]
3
set -e
4
set -o pipefail
5
6
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DIALOG4PORTS}" ] && set -x
7
8
if [ -z "${DIALOG4PORTS}" -o -z "${PORTSDIR}" -o -z "${MAKE}" ]; then
9
echo "DIALOG4PORTS, MAKE and PORTSDIR required in environment." >&2
10
exit 1
11
fi
12
13
: ${DIALOGPORT:=ports-mgmt/portconfig}
14
: ${DIALOGNAME:=portconfig}
15
16
OPTIONSFILE="$1"
17
18
if ! [ -e $DIALOG4PORTS ]; then
19
# If INSTALL_AS_USER is set then just build and use the WRKDIR version
20
# Also do this if PREFIX!=LOCALBASE to avoid missing file or double
21
# installs
22
if [ -n "${INSTALL_AS_USER}" -o "${PREFIX}" != "${LOCALBASE}" ]; then
23
if ! [ -d "${PORTSDIR}/${DIALOGPORT}" ]; then
24
echo "===> Skipping 'config' as ${DIALOGPORT} is not checked out" >&2
25
exit 1
26
fi
27
DIALOG4PORTS=$(${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -V DIALOG4PORTS)
28
if ! [ -e "${DIALOG4PORTS}" ]; then
29
echo "===> Building ${DIALOGNAME} as it is required for the config dialog"
30
${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean build
31
fi
32
else
33
# Build+install through su-install as normal
34
echo "===> Building/installing ${DIALOGNAME} as it is required for the config dialog"
35
${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean install
36
# Need to clean again as it can't run twice in 1 call above
37
${MAKE} -C ${PORTSDIR}/${DIALOGPORT} -D NO_DIALOG clean
38
fi
39
fi
40
41
# Backwards compat with older version which used stdout [<= 0.1.1] (or stderr [0.1.2]).
42
# Clear environment of PKGNAME or the dialog will show on older versions
43
# that do not understand -v.
44
if ! env -u PKGNAME ${DIALOG4PORTS} -v > /dev/null 2>&1; then
45
exec env LC_ALL=C.UTF-8 $DIALOG4PORTS > $OPTIONSFILE 2>&1
46
fi
47
48
# Newer versions use stderr to work around a jail issue
49
# http://lists.freebsd.org/pipermail/freebsd-ports/2013-March/082383.html
50
exec env LC_ALL=C.UTF-8 $DIALOG4PORTS 2> $OPTIONSFILE
51
52