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
|
trap int_handler INT TERM EXIT
|
||||||
|
|
||||||
|
SOURCE_ONLY=("--getbinpkg=n" "--usepkg=n")
|
||||||
STARTDATE="$(date -Iseconds)"
|
STARTDATE="$(date -Iseconds)"
|
||||||
|
|
||||||
if [[ -x /etc/cron.daily/porticron ]] ; then
|
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"
|
echo "portage update detected -> merging it"
|
||||||
|
|
||||||
if eix -u -# app-portage/gentoolkit > /dev/null ; then
|
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
|
else
|
||||||
emerge -v1 portage
|
myemerge -v1 portage
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "emerge options: ${PORTAGE_OPTIONS[*]}"
|
myemerge() {
|
||||||
emerge $PORTAGE_ASK "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
|
echo emerge "$@"
|
||||||
echo "emerge return value: $?"
|
emerge "$@"
|
||||||
|
echo "emerge return value: $?"
|
||||||
|
}
|
||||||
|
|
||||||
|
myemerge "$PORTAGE_ASK" "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
|
||||||
|
echo "emerge return value: $?"
|
||||||
if [[ $INTERACTIVE == 1 ]] ; then
|
if [[ $INTERACTIVE == 1 ]] ; then
|
||||||
dispatch-conf
|
dispatch-conf
|
||||||
echo "dispatch-conf return value: $?"
|
echo "dispatch-conf return value: $?"
|
||||||
|
|
||||||
emerge "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
|
myemerge "${PORTAGE_UPGRADE_OPTIONS[@]}" "${PORTAGE_OPTIONS[@]}" world
|
||||||
echo "emerge return value: $?"
|
|
||||||
|
|
||||||
dispatch-conf
|
dispatch-conf
|
||||||
echo "dispatch-conf return value: $?"
|
echo "dispatch-conf return value: $?"
|
||||||
|
@ -91,8 +95,8 @@ fi
|
||||||
|
|
||||||
echo "Started at $STARTDATE"
|
echo "Started at $STARTDATE"
|
||||||
echo "***************** rebuild packages *******************"
|
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
|
if [[ -n "$(which webappup.sh 2> /dev/null)" ]] ; then
|
||||||
webappup.sh
|
webappup.sh
|
||||||
|
@ -126,13 +130,13 @@ if [[ $(qlist -I gentoo-sources) != "" ]] ; then
|
||||||
#make sure that current kernel sources are kept:
|
#make sure that current kernel sources are kept:
|
||||||
CURRENTKERNELVERSION="$(uname -r)"
|
CURRENTKERNELVERSION="$(uname -r)"
|
||||||
echo current running kernel:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
echo current running kernel:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
||||||
emerge --noreplace gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
myemerge --noreplace gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
||||||
emerge -a "${PORTAGE_OPTIONS[@]}" --depclean
|
myemerge -a "${PORTAGE_OPTIONS[@]}" --depclean
|
||||||
if [[ "$(grep -c gentoo-sources /var/lib/portage/world)" -gt 2 ]] ; then
|
if [[ "$(grep -c gentoo-sources /var/lib/portage/world)" -gt 2 ]] ; then
|
||||||
echo too many kernelversion in world file!
|
echo too many kernelversion in world file!
|
||||||
grep gentoo-source /var/lib/portage/world
|
grep gentoo-source /var/lib/portage/world
|
||||||
fi
|
fi
|
||||||
emerge "${PORTAGE_OPTIONS[@]}" --deselect gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
myemerge "${PORTAGE_OPTIONS[@]}" --deselect gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$(which restart_services)" && $CHROOTED == "1" ]] ; then
|
if [[ -n "$(which restart_services)" && $CHROOTED == "1" ]] ; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue