Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Scripting a successful update of world?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
microugly
n00b
n00b


Joined: 22 Dec 2013
Posts: 31

PostPosted: Sat Aug 16, 2014 9:13 am    Post subject: Scripting a successful update of world? Reply with quote

I have written provisioning script for build a Gentoo Vagrant box. If you are not familiar with Vagrant, all this means is that I have a collection of scripts that run on a very vacant Gentoo virtual machine to populate with everything we need to use it as a development environment. These scripts are ran unattended, so ideally I want them to work each and every time.

The problem I have is that my script does an update of world, that may not always succeed.

Recently it has been failing when it reaches the help2man package. Prior to then, shared-mime-info would fail. In both cases running perl-cleaner --all fixes things up.

I can use --keep-going to stop the command from ending on these packages, but it still requires a manual step to clean up things if it fails.

This is what I currently run:
Code:
#!/bin/bash
#
# Perform the initial preparation of the Gentoo box before installing any packages.
#

emerge-webrsync
emerge -u portage

# Updating world removes net.lo.  Updating openrc first seems to get around that.
emerge -u openrc

# Stops x11-misc/shared-mime-info from erroring... but sys-apps/help2man is still going to fail.

perl-cleaner --all

emerge --update --newuse --deep --with-bdeps=y --keep-going @world[/code]

Is there something I could be doing to improve the success of the script?
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1682

PostPosted: Sat Aug 16, 2014 10:10 am    Post subject: Reply with quote

You can make that script use the newest stage3 for installation, so there is no need to update it. If you're running many installs, it would be a good idea to use your own, local server for hosting newest stage3 for use with this method. The same goeas about portage tarball. Or, you can use shared portage tree mounted over network.
You can also check exit code and make your script alert you if it's not 0. You will never make a script that can handle every possible failure. Make it work in usual conditions, and cry for help otherwise :) In this case reporting of success might also be desirable, as e.g. broken connection might prevent error message making it's way to you resulting in false-negative.

Also, assuming you have already working gentoo you use as a base, you can run
'ROOT=/mnt/gentoo USE="<changes between build host and target image>" emerge -e --root-deps=rdeps system' to build a new, clean stage located in /mnt/gentoo. If you keep build host up to date and don't change use flags you reduce risk of this build failing. You can reduce it even further and speed up build process if you make portage build and use binary packages

BTW, you might be interested in puppet or similar tools
Back to top
View user's profile Send private message
microugly
n00b
n00b


Joined: 22 Dec 2013
Posts: 31

PostPosted: Thu Aug 21, 2014 11:41 am    Post subject: Reply with quote

I'm familiar with Puppet, but not the rest of you suggestion. I'll have to study up on them. Thanks for the suggestions, I appreciate them.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum