Forums

Skip to content

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

Pre/Post emerge commands

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
4 posts • Page 1 of 1
Author
Message
s0be
Apprentice
Apprentice
User avatar
Posts: 240
Joined: Sat Nov 23, 2002 1:12 pm

Pre/Post emerge commands

  • Quote

Post by s0be » Wed May 30, 2012 5:33 am

Is there any built in facility to have emerge run a script/command when a emerge is starting/finishing?

---

Back story: I have a poorly designed lenovo w510 that overheats. While I battle with Lenovo about getting it repaired (again and again and again), I've found that forcing the fan on full while compiling remedies the problem. Unfortunately, I often forget to do so, which can lead to unexpected shutdowns. I've modified my non portage related build stuffs to handle this automatically, but before 'kludging' this the same way, I figured I check to make sure I hadn't missed such a feature, and if not, would attempt to implement it.
Top
ppurka
Advocate
Advocate
Posts: 3257
Joined: Sun Dec 26, 2004 5:05 pm

  • Quote

Post by ppurka » Wed May 30, 2012 5:42 am

Maybe through /etc/portage/bashrc:

http://www.gentoo-wiki.info/TIP_The_/et ... ashrc_file
http://www.funtoo.org/wiki/Portage's_bashrc

There could be other ways. But I can't recall them as of now.
emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/
Top
ppurka
Advocate
Advocate
Posts: 3257
Joined: Sun Dec 26, 2004 5:05 pm

  • Quote

Post by ppurka » Wed May 30, 2012 5:54 am

I forgot.. if you use my script (which has only one argument of its own "--help" and passes everything on to emerge), then you can define a post and pre command in the config file. See my sig below for the script and see this README for more information on the post and pre commands.
emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/
Top
s0be
Apprentice
Apprentice
User avatar
Posts: 240
Joined: Sat Nov 23, 2002 1:12 pm

  • Quote

Post by s0be » Wed May 30, 2012 6:20 am

Thanks for the bashrc pointer. I was able to achieve what I needed with:

Code: Select all

eecho() {
        [ "$NOCOLOR" = "false" ] && echo -ne '\e[1;34m>\e[1;36m>\e[1;35m>\e[0m ' || echo -n ">>> "
        echo "$*"
}

pre_src_compile() {
  eecho "Ramping up fans"
  echo level full-speed > /proc/acpi/ibm/fan
}

post_src_compile() {
  eecho "Returning fans to auto"
  echo level auto > /proc/acpi/ibm/fan
}
in bashrc, and adding:

Code: Select all

#needed to add fan magic
SANDBOX_WRITE="/proc/acpi/ibm/fan"
to /etc/sandbox.conf

That's elegant enough for me.
Top
Post Reply

4 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