gentooup: better adaption to packagebuilding chroots

This commit is contained in:
layman 2018-04-06 09:50:06 +02:00
parent de9207112b
commit d7842fb21d

View file

@ -7,6 +7,10 @@ PORTAGE_UPGRADE_OPTIONS=("-vuNDk")
PORTAGE_ASK="-a"
INTERACTIVE=1
CHROOTED=0
SYNC_COMMAND="emaint sync -a"
int_handler() {
@ -27,6 +31,11 @@ if [[ ! -t 1 ]] ; then
echo "Waiting 10s for manual abortion..."
sleep 10
PORTAGE_ASK=""
INTERACTIVE=0
fi
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
CHROOTED=1
fi
if [[ ${1} == "--no-sync" || ${2} == "--no-sync" ]] ; then
@ -54,15 +63,15 @@ echo "emerge options: ${PORTAGE_OPTIONS[*]}"
emerge $PORTAGE_ASK "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
echo "emerge return value: $?"
if [[ -t 1 ]] ; then
if [[ $INTERACTIVE == 1 ]] ; then
dispatch-conf
echo "dispatch-conf return value: $?"
emerge "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
echo emerge return value: $?
echo "emerge return value: $?"
dispatch-conf
echo dispatch-conf return value: $?
echo "dispatch-conf return value: $?"
fi
SETS=("@preserved-rebuild")
@ -85,18 +94,22 @@ fi
echo "**************** clean /etc/portage/ ***************"
portpeek -rq
echo "**************** clean /usr/portage/distfiles ***********"
eclean-dist -d
#Currently chroots are used to build and preserve packages!
if [[ $CHROOTED == 0 ]] ; then
echo "**************** clean /usr/portage/distfiles ***********"
eclean-dist -d
echo "**************** clean /usr/portage/packages ***********"
eclean-pkg
echo "**************** clean /usr/portage/packages ***********"
eclean-pkg
if [[ -n "$(which buildCurrentSymlinkedKernel.sh 2> /dev/null)" ]] ; then
buildCurrentSymlinkedKernel.sh
elif [[ -x "${HOME}/bin/buildCurrentSymlinkedKernel.sh" ]] ; then
"${HOME}/bin/buildCurrentSymlinkedKernel.sh"
if [[ -n "$(which buildCurrentSymlinkedKernel.sh 2> /dev/null)" ]] ; then
buildCurrentSymlinkedKernel.sh
elif [[ -x "${HOME}/bin/buildCurrentSymlinkedKernel.sh" ]] ; then
"${HOME}/bin/buildCurrentSymlinkedKernel.sh"
fi
fi
echo "***************** remove unneeded packages *******************"
echo Started at "$STARTDATE"
emerge -a "${PORTAGE_OPTIONS[@]}" --depclean