scripts/src/eball

63 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# 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-2021, src_prepare group
# Licensed under the GNU GPL v3 License
trap 'exit 128' INT
export PATH
usage() {
cat << HELP
Usage: eball FILES
eball - test new ebuilds
Original author: Maciej Barć
Copyright (c) 2020-2021, src_prepare group
Licensed under the GPLv3
HELP
}
if [ -z "${1}" ]
then
usage
exit 1
elif [ "${1}" = "-h" ] || [ "${1}" = "--help" ]
then
usage
exit 0
fi
for ebuild in "${@}"
do
# one may want this to be unprivileged
GENTOO_MIRRORS="" repoman manifest || ebuild "${ebuild}" manifest
# we want this to be privileged on Gentoo systems
if [ "$(whoami)" != root ] && [ -z "${EPREFIX}" ]
then
printf "%s\n" "Switching to the root account"
su root -c "ebuild ${ebuild} clean test merge"
else
ebuild "${ebuild}" clean test merge
fi
done