From 65edb50d4cc851f1ebe2af83ede7c36f394f68e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Bar=C4=87?= Date: Wed, 21 Oct 2020 10:42:51 +0200 Subject: [PATCH] here-pull-overlays: new script --- src/here-pull-overlays | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 src/here-pull-overlays diff --git a/src/here-pull-overlays b/src/here-pull-overlays new file mode 100755 index 0000000..2dfea2c --- /dev/null +++ b/src/here-pull-overlays @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + + +set -o pipefail +trap 'exit 1' INT +export PATH + + +emsg() +{ + echo "$(tput bold)$(tput setaf 6)>>> $(tput setaf 4)$(date +%H:%M:%S)$(tput setaf 7) ${*} $(tput sgr0)" +} +edie() +{ + if [ -z "${1}" ] + then + emsg "$(tput setaf 1)Failed: last command" + else + emsg "$(tput setaf 1)Failed: ${*}" + fi + exit 1 +} +erun() +{ + emsg "Running: ${*}" + "${@}" | busybox ts '>>> %H:%M:%S' || edie "${@}" +} +einto() +{ + pushd "${1}" >/dev/null || edie "Could not open ${1}" +} +eback() +{ + popd >/dev/null || edie +} + + +for repo in * +do + if [ -f "${repo}"/metadata/layout.conf ] + then + emsg "Pulling: ${repo}" + einto "${repo}" + erun git pull --all --verbose + eback + erun chown -R "${USER}":portage "${repo}" + fi +done + +erun eix-update