Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Automatically run Portage Command after rebuilding @world?

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
StevenC21
n00b
n00b
Posts: 63
Joined: Thu Jun 07, 2018 1:04 pm

Automatically run Portage Command after rebuilding @world?

  • Quote

Post by StevenC21 » Fri Jan 04, 2019 4:05 am

Hey! I just installed the nvidia blob, and, as many of you know, whenever I modify my kernel I have to reinstall the nvidia driver. This is something that I feel I may often forget, so I was wondering if I could somehow automate it so that @module-rebuild is always rebuilt when @world is?

Thanks for any and all help guys!
Top
Muso
Veteran
Veteran
User avatar
Posts: 1052
Joined: Tue Oct 22, 2002 7:45 am
Location: The Holy city of Honolulu
Contact:
Contact Muso
Website

Re: Automatically run Portage Command after rebuilding @worl

  • Quote

Post by Muso » Fri Jan 04, 2019 4:12 am

StevenC21 wrote:Hey! I just installed the nvidia blob, and, as many of you know, whenever I modify my kernel I have to reinstall the nvidia driver. This is something that I feel I may often forget, so I was wondering if I could somehow automate it so that @module-rebuild is always rebuilt when @world is?

Thanks for any and all help guys!
After building a new kernel, run :

Code: Select all

emerge @module-rebuild
Just make it a habit.

If you really want it after each @world upgrade, just tack it on the end :

Code: Select all

emerge -uUD --ask --keep-going --newuse --with-bdeps=y @world && emerge @module-rebuild
The thing with @module-rebuild is that it will rebuild against the kernel in /usr/src/linux. So unless you put the new kernel there, there's not much point in doing that.
"You can lead a horticulture but you can't make her think" ~ Dorothy Parker
2021 is the year of the Linux Desktop!
Top
StevenC21
n00b
n00b
Posts: 63
Joined: Thu Jun 07, 2018 1:04 pm

  • Quote

Post by StevenC21 » Fri Jan 04, 2019 4:16 am

Well, yes... but in such a way that I don't manually run it, lest I forget.
Top
The Doctor
Bodhisattva
Bodhisattva
User avatar
Posts: 2678
Joined: Tue Jul 27, 2010 10:56 pm

  • Quote

Post by The Doctor » Fri Jan 04, 2019 4:16 am

I wrote a kernel update script that prompts the user for interactions to select the new kernel, update the .config, build it, mounts /boot, copies it to boot, unmounts /boot, and runs the emerge command. It keeps everything convenient with minimal effort
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Top
StevenC21
n00b
n00b
Posts: 63
Joined: Thu Jun 07, 2018 1:04 pm

  • Quote

Post by StevenC21 » Fri Jan 04, 2019 4:17 am

Would you mind sharing it?
Top
The Doctor
Bodhisattva
Bodhisattva
User avatar
Posts: 2678
Joined: Tue Jul 27, 2010 10:56 pm

  • Quote

Post by The Doctor » Fri Jan 04, 2019 4:30 am

Sure, but keep in mind that it is customized to my use.

Code: Select all

#!/bin/bash

# first, find the active kernel
active=`readlink -f /usr/src/linux`

# eselect the new kerenl version
eselect kernel list

# read kernel selection
echo -n "Select kernel: "
read kernel


# number regex
re='^[0-9]+$'
if [[ $kernel =~ $re ]]
then
	echo 
else
	echo invalid number \'${kernel}\', exiting
	exit
fi

# set the new kernel safely
eselect kernel set $kernel
if [ $? -eq 0 ]
then
	echo set kernel.
else
	echo kernel number \'${kernel}\'does not exist, exiting.
	exit
fi

# copy the .config
echo
echo 'copying config'
cp ${active}/.config /usr/src/linux/

# cd into the src directory
cd /usr/src/linux
# update the config to work with the new kernel
make oldconfig

# make sure that it is OK to proceed
read -p "Procceed with the update? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
        echo '### building kernel ###'
else
        echo 'aborting'
        exit
fi

# build the kernel
make
make modules_install

#install the kernel
mount /boot
echo
echo Build finished. Copying to /boot

#mv /boot/EFI/Boot/bootx64.efi /boot/EFI/Boot/vmlinuz.efi
mv /boot/EFI/Boot/vmlinuz.efi /boot/EFI/Boot/vmlinuz-rescue.efi
cp /usr/src/linux/arch/x86_64/boot/bzImage /boot/EFI/Boot/vmlinuz.efi

echo buld complete.
umount /boot

emerge @module-rebuild
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Top
StevenC21
n00b
n00b
Posts: 63
Joined: Thu Jun 07, 2018 1:04 pm

  • Quote

Post by StevenC21 » Fri Jan 04, 2019 4:42 am

You have a typo at the end. It says "buld complete".
Top
Post Reply

7 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic