buildCurrentSymlinkedKernel: make package in chroot; make install if not

This commit is contained in:
layman 2019-06-25 10:51:11 +02:00
parent 30dc18a5dc
commit 4a0e69ea3a

View file

@ -26,6 +26,10 @@ for config in "/proc/config.gz" "$CONFIGDIR/latest" ; do
fi
done
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
CHROOTED=1
fi
if [[ "$NOCONFIG" || "$FORCE" ]] ; then
echo "**************** building kernel ***********"
@ -35,7 +39,7 @@ if [[ "$NOCONFIG" || "$FORCE" ]] ; then
if [[ -n "$OLDCONFIG" ]] ; then
OUT+=("********** Using old config ************")
echo "${OUT[-1]}"
zcat -f "$config" > .config
zcat -f "$OLDCONFIG" > .config
else
OUT+=("********** WARNING! No old config has been found! Using defconfig! ************")
echo "${OUT[-1]}"
@ -52,7 +56,12 @@ if [[ "$NOCONFIG" || "$FORCE" ]] ; then
mount /boot 2> /dev/null
CORES="$(getconf _NPROCESSORS_ONLN)"
(nice make -j -l$((CORES-1)) CC="ccache gcc" && make install ; make modules_install) > "buildlog-$TIMESTAMP" || tail -n 20 "buildlog-$TIMESTAMP"
(nice make -j -l$((CORES-1)) CC="ccache gcc") > "buildlog-$TIMESTAMP" || tail -n 20 "buildlog-$TIMESTAMP"
SUCCESS=$?
if [[ $SUCCESS == 0 ]] && [[ $CHROOTED == 1 ]] ; then
( make tarxz-pkg ) >> "buildlog-$TIMESTAMP"
elif [[ $SUCCESS == 0 ]]
( make install ; make modules_install ) >> "buildlog-$TIMESTAMP"
GRUBMKONFIG="$(which grub2-mkconfig 2> /dev/null)"
if [[ -z "$GRUBMKONFIG" ]] ; then
@ -66,6 +75,7 @@ if [[ "$NOCONFIG" || "$FORCE" ]] ; then
else
echo "please update bootloader manually!"
fi
fi
echo
echo
echo Summary: