2020-10-21 10:42:51 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
2020-12-29 21:21:17 +01:00
|
|
|
# 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
|
2021-03-29 13:02:30 +02:00
|
|
|
# the Free Software Foundation, version 3.
|
2020-12-29 21:21:17 +01:00
|
|
|
|
|
|
|
# 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/>.
|
|
|
|
|
2021-04-18 02:02:15 +02:00
|
|
|
# Original author: Maciej Barć <xgqt@riseup.net>
|
2020-12-22 01:48:17 +01:00
|
|
|
# Copyright (c) 2020, src_prepare group
|
2020-12-29 21:21:17 +01:00
|
|
|
# Licensed under the GNU GPL v3 License
|
2020-12-22 01:48:17 +01:00
|
|
|
|
|
|
|
|
2020-10-21 10:42:51 +02:00
|
|
|
set -o pipefail
|
2020-12-22 01:48:17 +01:00
|
|
|
trap 'exit 128' INT
|
2020-10-21 10:42:51 +02:00
|
|
|
export PATH
|
|
|
|
|
|
|
|
|
2020-12-22 01:48:17 +01:00
|
|
|
emsg() {
|
2020-10-21 10:42:51 +02:00
|
|
|
echo "$(tput bold)$(tput setaf 6)>>> $(tput setaf 4)$(date +%H:%M:%S)$(tput setaf 7) ${*} $(tput sgr0)"
|
|
|
|
}
|
2020-12-22 01:48:17 +01:00
|
|
|
|
|
|
|
edie() {
|
2020-10-21 10:42:51 +02:00
|
|
|
if [ -z "${1}" ]
|
|
|
|
then
|
|
|
|
emsg "$(tput setaf 1)Failed: last command"
|
|
|
|
else
|
|
|
|
emsg "$(tput setaf 1)Failed: ${*}"
|
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
}
|
2020-12-22 01:48:17 +01:00
|
|
|
erun() {
|
2020-10-21 10:42:51 +02:00
|
|
|
emsg "Running: ${*}"
|
|
|
|
"${@}" | busybox ts '>>> %H:%M:%S' || edie "${@}"
|
|
|
|
}
|
2020-12-22 01:48:17 +01:00
|
|
|
|
|
|
|
einto() {
|
2020-10-21 10:42:51 +02:00
|
|
|
pushd "${1}" >/dev/null || edie "Could not open ${1}"
|
|
|
|
}
|
2020-12-22 01:48:17 +01:00
|
|
|
|
|
|
|
eback() {
|
2020-10-21 10:42:51 +02:00
|
|
|
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
|