helper/gentooup.sh

94 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
PORTAGE_OPTIONS=("--keep-going" "--autounmask-write" "--binpkg-respect-use=y" "--binpkg-changed-deps=y" "--verbose-conflicts")
PORTAGE_UPGRADE_OPTIONS=("-vuNDk")
PORTAGE_ASK="-a"
SYNC_COMMAND="emaint sync -a"
int_handler() {
exit 0
}
trap int_handler INT TERM EXIT
STARTDATE="$(date -Iseconds)"
if [[ -x /etc/cron.daily/porticron ]] ; then
echo "porticron"
PORTAGE_ASK=""
fi
if [[ ${1} == "--no-sync" || ${2} == "--no-sync" ]] ; then
echo "not syncing"
SYNC_COMMAND=""
fi
if [[ ${1} == "--full" || ${2} == "--full" ]] ; then
echo "Do a full upgrade including build dependencies"
PORTAGE_UPGRADE_OPTIONS+=("--with-bdeps=y")
fi
#any parameter prevents syncing
if [[ ! -z ${SYNC_COMMAND} ]] ; then
${SYNC_COMMAND}
eix-update >& /dev/null &
fi
echo "emerge options: ${PORTAGE_OPTIONS[*]}"
emerge $PORTAGE_ASK "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
echo "emerge return value: $?"
dispatch-conf
echo "dispatch-conf return value: $?"
emerge "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
echo emerge return value: $?
dispatch-conf
echo dispatch-conf return value: $?
SETS=("@preserved-rebuild")
if eix -eI smart-live-rebuild &> /dev/null ; then
SETS+=("@smart-live-rebuild")
fi
echo "Started at $STARTDATE"
echo "***************** rebuild packages *******************"
echo "run emerge -v ${PORTAGE_OPTIONS[*]} ${SETS[*]}"
emerge -v "${PORTAGE_OPTIONS[@]}" "${SETS[@]}"
if [[ -n "$(which webappup.sh 2> /dev/null)" ]] ; then
webappup.sh
elif [[ -x "${HOME}/bin/webappup.sh" ]] ; then
"${HOME}/bin/webappup.sh"
fi
echo "**************** clean /etc/portage/ ***************"
portpeek -rq
echo "**************** clean /usr/portage/distfiles ***********"
eclean-dist -d
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"
fi
echo "***************** remove unneeded packages *******************"
echo Started at "$STARTDATE"
emerge -a "${PORTAGE_OPTIONS[@]}" --depclean
if [[ -n "$(which restart_services)" ]] ; then
restart_services -l
fi
echo "Started at $STARTDATE"
echo " Ended at $(date -Iseconds)"