summaryrefslogtreecommitdiffstats
path: root/postsync.d/eix-update
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2009-01-08 20:48:47 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2009-01-08 20:48:47 +0100
commit0ca3f6991a7c8352423a1b2673d91941917cfcb2 (patch)
treee2e1f4d5ae01801fde3f6e3197a529a0108ab4de /postsync.d/eix-update
parent1e57b0b6831f84fe435695816fd9f870750e2498 (diff)
downloadportage-ext-0ca3f6991a7c8352423a1b2673d91941917cfcb2.tar.gz
portage-ext-0ca3f6991a7c8352423a1b2673d91941917cfcb2.tar.xz
portage-ext-0ca3f6991a7c8352423a1b2673d91941917cfcb2.zip
reworked scripts
sync of overlays is now possible sync gives output prepended with the overlay name to enable sync set $SYNC in the overlay configuration to the command that should be executed in the directory of the overlay to sync it
Diffstat (limited to 'postsync.d/eix-update')
-rwxr-xr-xpostsync.d/eix-update56
1 files changed, 56 insertions, 0 deletions
diff --git a/postsync.d/eix-update b/postsync.d/eix-update
new file mode 100755
index 0000000..00c6bd9
--- /dev/null
+++ b/postsync.d/eix-update
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+. /etc/init.d/functions.sh
+
+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
+ if [[ ! -d "${LOCATION}" ]]; then
+ mkdir -p "${LOCATION}"
+ fi
+
+ OVERLAY_PARAM="${OVERLAY_PARAM} --add-overlay ${LOCATION}"
+
+ if [[ -n ${CACHE_FORMAT} ]]; then
+ OVERLAY_PARAM="${OVERLAY_PARAM} -m ${LOCATION} ${CACHE_FORMAT}"
+ fi
+
+ OVERLAY_NAME="$(echo ${overlay_config} | sed 's/\.[^\.]*$//')"
+ if [[ -n ${SYNC} ]]; then
+ echo
+ pushd ${LOCATION} > /dev/null 2>&1
+ ${SYNC} 2>&1 | sed -ue "s/^/${OVERLAY_NAME}> /g"
+
+ if [[ "0" -ne "${PIPESTATUS[0]}" ]]; then
+ ewarn "Sync of ${OVERLAY_NAME} failed"
+ fi
+
+ popd > /dev/null 2>&1
+ fi
+ fi
+done
+
+echo
+
+[ -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