scripts/src/here-pull-overlays

68 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# This file is part of scripts.
# scripts is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
set -o pipefail
trap 'exit 128' INT
export PATH
emsg() {
printf "%s\n" "$(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