mirror of
https://github.com/pentoo/pentoo-overlay
synced 2025-12-20 23:32:40 +01:00
124 lines
4.7 KiB
Bash
Executable file
124 lines
4.7 KiB
Bash
Executable file
#!/bin/sh
|
|
. /etc/profile
|
|
env-update
|
|
|
|
if [ -n "${clst_target}" ]; then #we are in catalyst
|
|
mkdir -p /var/log/portage/emerge-info/
|
|
emerge --info > /var/log/portage/emerge-info/emerge-info-$(date "+%Y%m%d").txt
|
|
else #we are on a user system
|
|
if ! emerge --sync; then
|
|
printf "emerge --sync failed, aborting update for safety\n"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
safe_exit() {
|
|
#I want a shell when I'm in catalyst but just an exit on failure for users
|
|
if [ -n "${clst_target}" ] && [ -n "${debugshell}" ]; then
|
|
/bin/bash
|
|
elif [ -n "${clst_target}" ] && [ -n "${reckless}" ]; then
|
|
echo "Continuing despite failure...grumble grumble" 1>&2
|
|
#else #let's let it keep going by default instead of just failing out
|
|
# exit
|
|
fi
|
|
}
|
|
|
|
RESET_PYTHON=0
|
|
#first we set the python interpreters to match PYTHON_TARGETS (and ensure the versions we set are actually built)
|
|
PYTHON2=$(emerge --info | grep -oE 'PYTHON_TARGETS\="(python[23]_[0-9]\s*)+"' | head -n1 | cut -d\" -f2 | cut -d" " -f 1 |sed 's#_#.#')
|
|
PYTHON3=$(emerge --info | grep -oE 'PYTHON_TARGETS\="(python[23]_[0-9]\s*)+"' | head -n1 | cut -d\" -f2 | cut -d" " -f 2 |sed 's#_#.#')
|
|
if [ -z "${PYTHON2}" ] || [ -z "${PYTHON3}" ]; then
|
|
printf "Failed to autodetect PYTHON_TARGETS\n"
|
|
printf "Detected Python 2: ${PYTHON2:-none}\n"
|
|
printf "Detected Python 3: ${PYTHON3:-none}\n"
|
|
printf "From PYTHON_TARGETS: $(emerge --info | grep '^PYTHON TARGETS')\n"
|
|
exit 1
|
|
fi
|
|
if eselect python list --python2 | grep -q "${PYTHON2}"; then
|
|
eselect python set --python2 "${PYTHON2}" || safe_exit
|
|
else
|
|
printf "System wants ${PYTHON2} as default python2 version but it isn't installed yet.\n"
|
|
RESET_PYTHON=1
|
|
fi
|
|
if eselect python list --python3 | grep -q "${PYTHON3}"; then
|
|
eselect python set --python3 "${PYTHON3}" || safe_exit
|
|
else
|
|
printf "System wants ${PYTHON3} as default python3 version but it isn't installed yet.\n"
|
|
RESET_PYTHON=1
|
|
fi
|
|
"${PYTHON2}" -c "from _multiprocessing import SemLock" || emerge -1 python:"${PYTHON2#python}"
|
|
"${PYTHON3}" -c "from _multiprocessing import SemLock" || emerge -1 python:"${PYTHON3#python}"
|
|
emerge --update --newuse --oneshot --changed-use --newrepo portage || safe_exit
|
|
|
|
#modified from news item "Python ABIFLAGS rebuild needed"
|
|
if [ -n "$(find /usr/lib*/python3* -name '*cpython-3[3-5].so')" ]; then
|
|
emerge -1v --usepkg=n --buildpkg=y $(find /usr/lib*/python3* -name '*cpython-3[3-5].so')
|
|
fi
|
|
if [ -n "$(find /usr/include/python3.[3-5] -type f 2> /dev/null)" ]; then
|
|
emerge -1v --usepkg=n --buildpkg=y /usr/include/python3.[3-5]
|
|
fi
|
|
|
|
#modified from news item gcc-5-new-c++11-abi
|
|
#gcc_target="x86_64-pc-linux-gnu-5.4.0"
|
|
#if [ "$(gcc-config -c)" != "${gcc_target}" ]; then
|
|
# if gcc-config -l | grep -q "${gcc_target}"; then
|
|
# gcc-config "${gcc_target}"
|
|
# . /etc/profile
|
|
# revdep-rebuild --library 'libstdc++.so.6' -- --buildpkg=y --usepkg=n --exclude gcc
|
|
# fi
|
|
#fi
|
|
|
|
if [ -n "${clst_target}" ]; then
|
|
emerge @changed-deps || safe_exit
|
|
fi
|
|
|
|
emerge --deep --update --newuse -kb --changed-use --newrepo @world || safe_exit
|
|
|
|
perl-cleaner --ph-clean --modules -- --buildpkg=y || safe_exit
|
|
|
|
emerge --deep --update --newuse -kb --changed-use --newrepo @world || safe_exit
|
|
|
|
if [ ${RESET_PYTHON} = 1 ]; then
|
|
eselect python set --python2 "${PYTHON2}" || safe_exit
|
|
eselect python set --python3 "${PYTHON3}" || safe_exit
|
|
fi
|
|
|
|
#if we are in catalyst, update the extra binpkgs
|
|
if [ -n "${clst_target}" ]; then
|
|
#add kde and mate use flags
|
|
echo "pentoo/pentoo kde mate" >> /etc/portage/package.use
|
|
emerge @changed-deps || safe_exit
|
|
emerge --buildpkg --usepkg --onlydeps --oneshot --deep --update --newuse --changed-use --newrepo pentoo/pentoo || safe_exit
|
|
etc-update --automode -5 || safe_exit
|
|
fi
|
|
|
|
if portageq list_preserved_libs /; then
|
|
emerge @preserved-rebuild --buildpkg=y || safe_exit
|
|
fi
|
|
smart-live-rebuild 2>&1 || safe_exit
|
|
revdep-rebuild -i -- --rebuild-exclude dev-java/swt --exclude dev-java/swt --buildpkg=y || safe_exit
|
|
emerge --deep --update --newuse -kb --changed-use --newrepo @world || safe_exit
|
|
#we need to do the clean BEFORE we drop the extra flags otherwise all the packages we just built are removed
|
|
emerge --depclean || safe_exit
|
|
if portageq list_preserved_libs /; then
|
|
emerge @preserved-rebuild --buildpkg=y || safe_exit
|
|
fi
|
|
|
|
if [ -n "${clst_target}" ]; then
|
|
if [ -n "${debugshell}" ]; then
|
|
/bin/bash
|
|
fi
|
|
emerge @changed-deps || safe_exit
|
|
etc-update --automode -5 || safe_exit
|
|
eclean-pkg -d || safe_exit
|
|
fixpackages || safe_exit
|
|
emaint binhost || safe_exit
|
|
#remove kde/mate use flags
|
|
rm /etc/portage/package.use
|
|
fi
|
|
|
|
if [ -f /usr/local/portage/scripts/bug-461824.sh ]; then
|
|
/usr/local/portage/scripts/bug-461824.sh
|
|
elif [ -f /var/lib/layman/pentoo/scripts/bug-461824.sh ]; then
|
|
/var/lib/layman/pentoo/scripts/bug-461824.sh
|
|
fi
|