Updated update-kernel

Signed-off-by: Marcin Wozniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2020-08-30 15:16:53 +02:00 committed by Marcin Wozniak
parent 1c3d517ce5
commit bbfe0149c3
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -7,7 +7,7 @@ DEFAULT_KERNEL="/usr/src/linux/.config"
function starting() { function starting() {
echo -e "\e[93m----------------------COMPILING------------------------------\e[0m" echo -e "\e[93m----------------------COMPILING------------------------------\e[0m"
sudo cp -rv $DEFAULT_KERNEL $TMP_KERNEL sudo cp -rv $DEFAULT_KERNEL $TMP_KERNEL
cp -r $TMP_KERNEL $BACKUP cp -r $TMP_KERNEL $BACKUP
cp -r /etc/portage/* $BACKUP cp -r /etc/portage/* $BACKUP
qlist -I | sort | uniq | tr '\n' ' ' > $BACKUP/list-of-programs-"$(date +"%d-%m-%Y")" qlist -I | sort | uniq | tr '\n' ' ' > $BACKUP/list-of-programs-"$(date +"%d-%m-%Y")"
@ -16,28 +16,27 @@ qlist -I | sort | uniq | tr '\n' ' ' > $BACKUP/list-of-programs-"$(date +"%d-%m-
function selection() { function selection() {
echo -e "\e[93m----------------------SELECTION-----------------------------\e[0m" echo -e "\e[93m----------------------SELECTION-----------------------------\e[0m"
sudo eselect kernel list sudo eselect kernel list
echo echo
echo echo
read -p "New kernel is: " KERVER read -p "New kernel is: " KERVER
echo echo
echo -e "Your kernel now is \e[91m$(uname -sr)\e[0m" echo -e "Your kernel now is \e[91m$(uname -sr)\e[0m"
echo -e "Your selected kernel is \e[91m"$KERVER"\e[0m" echo -e "Your selected kernel is \e[91m"$KERVER"\e[0m"
sudo eselect kernel set $KERVER sudo eselect kernel set $KERVER
sudo eselect kernel list | grep "*" sudo eselect kernel list | grep "*"
echo echo
} }
function compilation() { function compilation() {
read -p "Do you want to accept and compile (Y/N): " agreed read -p "Do you want to accept and compile (Y/N): " agreed
echo echo
if [ "$agreed" == "y" ] || [ "$agreed" == "Y" ] if [ "$agreed" == "y" ] || [ "$agreed" == "Y" ]
then then
echo -e "\e[91m----------------------\e[5mSTARTING\e[0m\e[91m------------------------------\e[0m" && sleep 10 echo -e "\e[91m----------------------\e[5mSTARTING\e[0m\e[91m------------------------------\e[0m" && sleep 10
$NOW > /tmp/compiling-starting $NOW > /tmp/compiling-starting
NEW_KERNEL="/tmp/new-kernel-config" NEW_KERNEL="/tmp/new-kernel-config"
sudo cp -r $TMP_KERNEL $DEFAULT_KERNEL sudo cp -r $TMP_KERNEL $DEFAULT_KERNEL
#cd /usr/src/linux; sudo make menuconfig; sleep 2; sudo cp -r $DEFAULT_KERNEL $NEW_KERNEL cd /usr/src/linux; sudo make menuconfig; sleep 2; sudo cp -r $DEFAULT_KERNEL $NEW_KERNEL
sleep 2; sudo cp -r $DEFAULT_KERNEL $NEW_KERNEL
sudo genkernel all --makeopts=-j$(nproc --all) --kernel-config=$NEW_KERNEL --callback="emerge nvidia-drivers::gentoo" sudo genkernel all --makeopts=-j$(nproc --all) --kernel-config=$NEW_KERNEL --callback="emerge nvidia-drivers::gentoo"
elif [ "$agreed" == "N" ] || [ "$agreed" == "n" ] elif [ "$agreed" == "N" ] || [ "$agreed" == "n" ]
then then
@ -49,7 +48,7 @@ function ending() {
echo echo
echo echo
echo -e "\e[93m----------------------CHECKING-----------------------------\e[0m" echo -e "\e[93m----------------------CHECKING-----------------------------\e[0m"
checking checking
echo echo
echo echo
echo -e "\e[93m----------------------REMEMBER-----------------------------\e[0m" echo -e "\e[93m----------------------REMEMBER-----------------------------\e[0m"
@ -60,7 +59,7 @@ echo "* /boot/vmlinuz-OLD_KERNEL"
echo "* /boot/System.map-OLD_KERNEL" echo "* /boot/System.map-OLD_KERNEL"
echo "* /boot/initramfs-OLD_KERNEL" echo "* /boot/initramfs-OLD_KERNEL"
echo "* /usr/src/linux-OLD_KERNEL" echo "* /usr/src/linux-OLD_KERNEL"
echo echo
echo -e "AFTER EVERYTHING YOU MUST WRITE COMMAND \e[91m"sudo grub-mkconfig -o /boot/grub/grub.cfg"\e[0m" echo -e "AFTER EVERYTHING YOU MUST WRITE COMMAND \e[91m"sudo grub-mkconfig -o /boot/grub/grub.cfg"\e[0m"
} }
@ -80,7 +79,7 @@ function ifchecking () {
FILE=/boot/$1 FILE=/boot/$1
if test -f "$FILE"; then if test -f "$FILE"; then
echo "$FILE exist in the /boot folder ;)" echo "$FILE exist in the /boot folder ;)"
else else
echo "$FILE NOT exist in the /boot folder ;)" echo "$FILE NOT exist in the /boot folder ;)"
fi fi
} }
@ -94,16 +93,16 @@ starting
selection selection
compilation compilation
echo -e "\e[31mI am leaving! Thank You!\e[0m" && sleep 3 echo -e "\e[31mI am leaving! Thank You!\e[0m" && sleep 3
TERMIN=$(date +"%s") TERMIN=$(date +"%s")
DIFFTLPS=$(($TERMIN-$BEGIN)) DIFFTLPS=$(($TERMIN-$BEGIN))
echo -e "\e[93m------------------TIME COMPILATION-------------------------\e[0m" echo -e "\e[93m------------------TIME COMPILATION-------------------------\e[0m"
echo -e "\e[93m$(($DIFFTLPS / 60)) minutes and $(($DIFFTLPS % 60)) seconds \e[0m elapsed for Script Execution." && sleep 3 echo -e "\e[93m$(($DIFFTLPS / 60)) minutes and $(($DIFFTLPS % 60)) seconds \e[0m elapsed for Script Execution." && sleep 3
ending ending
exit exit
} }
main main