gentooup.sh: replace repetitive emerge context by function
This commit is contained in:
parent
b7831f22f1
commit
f4d7d57ba3
1 changed files with 16 additions and 12 deletions
28
gentooup.sh
28
gentooup.sh
|
@ -19,6 +19,7 @@ int_handler() {
|
|||
|
||||
trap int_handler INT TERM EXIT
|
||||
|
||||
SOURCE_ONLY=("--getbinpkg=n" "--usepkg=n")
|
||||
STARTDATE="$(date -Iseconds)"
|
||||
|
||||
if [[ -x /etc/cron.daily/porticron ]] ; then
|
||||
|
@ -62,22 +63,25 @@ if eix -u -# sys-apps/portage > /dev/null ; then
|
|||
echo "portage update detected -> merging it"
|
||||
|
||||
if eix -u -# app-portage/gentoolkit > /dev/null ; then
|
||||
emerge -v1 sys-apps/portage app-portage/gentoolkit
|
||||
myemerge -v1 sys-apps/portage app-portage/gentoolkit
|
||||
else
|
||||
emerge -v1 portage
|
||||
myemerge -v1 portage
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "emerge options: ${PORTAGE_OPTIONS[*]}"
|
||||
emerge $PORTAGE_ASK "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
|
||||
echo "emerge return value: $?"
|
||||
myemerge() {
|
||||
echo emerge "$@"
|
||||
emerge "$@"
|
||||
echo "emerge return value: $?"
|
||||
}
|
||||
|
||||
myemerge "$PORTAGE_ASK" "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
|
||||
echo "emerge return value: $?"
|
||||
if [[ $INTERACTIVE == 1 ]] ; then
|
||||
dispatch-conf
|
||||
echo "dispatch-conf return value: $?"
|
||||
|
||||
emerge "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
|
||||
echo "emerge return value: $?"
|
||||
myemerge "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
|
||||
|
||||
dispatch-conf
|
||||
echo "dispatch-conf return value: $?"
|
||||
|
@ -91,8 +95,8 @@ fi
|
|||
|
||||
echo "Started at $STARTDATE"
|
||||
echo "***************** rebuild packages *******************"
|
||||
echo "run emerge -v --getbinpkg=n --usepkg=n ${PORTAGE_OPTIONS[*]} ${SETS[*]}"
|
||||
emerge -v "${PORTAGE_OPTIONS[@]}" "${SETS[@]}"
|
||||
|
||||
myemerge -v "${PORTAGE_OPTIONS[@]}" "${SOURCE_ONLY[@]}" "${SETS[@]}"
|
||||
|
||||
if [[ -n "$(which webappup.sh 2> /dev/null)" ]] ; then
|
||||
webappup.sh
|
||||
|
@ -126,13 +130,13 @@ if [[ $(qlist -I gentoo-sources) != "" ]] ; then
|
|||
#make sure that current kernel sources are kept:
|
||||
CURRENTKERNELVERSION="$(uname -r)"
|
||||
echo current running kernel:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
||||
emerge --noreplace gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
||||
emerge -a "${PORTAGE_OPTIONS[@]}" --depclean
|
||||
myemerge --noreplace gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
||||
myemerge -a "${PORTAGE_OPTIONS[@]}" --depclean
|
||||
if [[ "$(grep -c gentoo-sources /var/lib/portage/world)" -gt 2 ]] ; then
|
||||
echo too many kernelversion in world file!
|
||||
grep gentoo-source /var/lib/portage/world
|
||||
fi
|
||||
emerge "${PORTAGE_OPTIONS[@]}" --deselect gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
||||
myemerge "${PORTAGE_OPTIONS[@]}" --deselect gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
||||
fi
|
||||
|
||||
if [[ -n "$(which restart_services)" && $CHROOTED == "1" ]] ; then
|
||||
|
|
Loading…
Add table
Reference in a new issue