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 fi
done done
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
CHROOTED=1
fi
if [[ "$NOCONFIG" || "$FORCE" ]] ; then if [[ "$NOCONFIG" || "$FORCE" ]] ; then
echo "**************** building kernel ***********" echo "**************** building kernel ***********"
@ -35,7 +39,7 @@ if [[ "$NOCONFIG" || "$FORCE" ]] ; then
if [[ -n "$OLDCONFIG" ]] ; then if [[ -n "$OLDCONFIG" ]] ; then
OUT+=("********** Using old config ************") OUT+=("********** Using old config ************")
echo "${OUT[-1]}" echo "${OUT[-1]}"
zcat -f "$config" > .config zcat -f "$OLDCONFIG" > .config
else else
OUT+=("********** WARNING! No old config has been found! Using defconfig! ************") OUT+=("********** WARNING! No old config has been found! Using defconfig! ************")
echo "${OUT[-1]}" echo "${OUT[-1]}"
@ -52,19 +56,25 @@ if [[ "$NOCONFIG" || "$FORCE" ]] ; then
mount /boot 2> /dev/null mount /boot 2> /dev/null
CORES="$(getconf _NPROCESSORS_ONLN)" 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)" GRUBMKONFIG="$(which grub2-mkconfig 2> /dev/null)"
if [[ -z "$GRUBMKONFIG" ]] ; then if [[ -z "$GRUBMKONFIG" ]] ; then
GRUBMKONFIG="$(which grub-mkconfig)" GRUBMKONFIG="$(which grub-mkconfig)"
fi fi
if [[ -f /boot/grub2/grub.cfg && -n "$GRUBMKONFIG" ]] ; then if [[ -f /boot/grub2/grub.cfg && -n "$GRUBMKONFIG" ]] ; then
"$GRUBMKONFIG" -o /boot/grub2/grub.cfg "$GRUBMKONFIG" -o /boot/grub2/grub.cfg
elif [[ -f /boot/grub/grub.cfg && -n "$GRUBMKONFIG" ]] ; then elif [[ -f /boot/grub/grub.cfg && -n "$GRUBMKONFIG" ]] ; then
"$GRUBMKONFIG" -o /boot/grub/grub.cfg "$GRUBMKONFIG" -o /boot/grub/grub.cfg
else else
echo "please update bootloader manually!" echo "please update bootloader manually!"
fi
fi fi
echo echo
echo echo