summaryrefslogtreecommitdiffstats
path: root/postsync.d/50-eix-update
blob: e9eb5acffc8f57ddd5fb1995e792d6a3a2b54fea (plain) (blame)
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
EIXCACHE=$(update-eix --print EIX_CACHEFILE)
OVERLAY_CONFIG_DIR="$(update-eix --print EIXCFGDIR)/overlays"

TMPFILE=""
if [ -r "${EIXCACHE}" ]; then
	TMPFILE=$(mktemp -t eix.cache.XXXXXXXX)
	cp "${EIXCACHE}" "${TMPFILE}"
fi

OVERLAY_PARAM=""
for overlay_config in $(ls ${OVERLAY_CONFIG_DIR}); do
	unset LOCATION
	unset SYNC
	unset CACHE_FORMAT

	source ${OVERLAY_CONFIG_DIR}/${overlay_config}
	if [[ -n ${LOCATION} ]]; then
		OVERLAY_PARAM="${OVERLAY_PARAM} --add-overlay ${LOCATION}"

		if [[ -n ${CACHE_FORMAT} ]]; then
			OVERLAY_PARAM="${OVERLAY_PARAM} -m ${LOCATION} ${CACHE_FORMAT}"
		fi
	fi
done

[ -x /usr/bin/update-eix ] && /usr/bin/update-eix ${OVERLAY_PARAM}

if [ -r "${EIXCACHE}" -a -r "${TMPFILE}" ]; then
	echo
	diff-eix "${TMPFILE}"
	echo
	rm -f "${TMPFILE}"
fi