-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-options
executable file
·41 lines (30 loc) · 1.12 KB
/
check-options
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
#!/bin/sh
set -e -u -o pipefail
CURDIR=$(realpath $(dirname $0))
: ${PACKAGE_SET:=}
while getopts "f:z:" OPT; do
case $OPT in
f)
ORIGINS=${OPTARG}
;;
z)
PACKAGE_SET=${OPTARG}
;;
esac
done
shift $((${OPTIND} - 1))
[ -n "${PACKAGE_SET}" ] || {
echo "$(basename $0): package set not specified."
exit 1
}
cat ${ORIGINS} | grep -v "^#" | while read _origin; do
echo "Checking ${_origin}"
_options_file=$(make __MAKE_CONF=${CURDIR}/env/${PACKAGE_SET} PORT_DBDIR=${CURDIR}/options/${PACKAGE_SET}-options -C /usr/ports/${_origin} -V OPTIONS_FILE 2>/dev/null)
if [ -e ${_options_file} ]; then
_package0=$(grep _OPTIONS_READ ${_options_file} | cut -d= -f 2)
_package1=$(make __MAKE_CONF=${CURDIR}/env/${PACKAGE_SET} PORT_DBDIR=${CURDIR}/options/${PACKAGE_SET}-options -C /usr/ports/${_origin} package-name 2>/dev/null)
if [ "${_package0}" != "${_package1}" ]; then
make __MAKE_CONF=${CURDIR}/env/${PACKAGE_SET} PORT_DBDIR=${CURDIR}/options/${PACKAGE_SET}-options -C /usr/ports/${_origin} config
fi
fi
done