Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Essentially, I am looking for a fully silent, non-interactive version of

freebsd-update fetch
freebsd-update install

and

portsnap fetch update
share|improve this question

2 Answers 2

Blindly installing updates (even freebsd-update updates) can be a Bad Thing: One option in rc.conf changes, and suddenly your machine has no SSH daemon anymore.

Similarly you probably don't want to blindly install all available port updates via portsnap / portupgrade -a -- you might take a major version number bump and break the universe, or you might just have a port with new configuration options that need to be changed (you can make ports just accept whatever their defaults are, but sometimes that's not what you want).


The best way to do this is to use a configuration management tool like Puppet or radmind to deploy your changes.
Make a machine template based on a box you've successfully upgraded and tested, then deploy that to the rest of your environment. This ensures that you're pushing out a working system configuration, and that you only have to do the manual steps once (on the machine you're templating from).

share|improve this answer
    
Does freebsd-update overwrite configuration data like rc.conf? But even if so: we want to automatically (nightly) create VM images (OVA, AMI, ..) from scratch. Hence, there is no problem of configs overwritten, since after base install, the system is first updated, and then configured. So how do I run freebsd-update and portsnap unattended? On RH Linux, I just fire yum -y update and voila. How do I do that with FreeBSD? –  oberstet May 16 '13 at 18:22
    
freebsd-update generally doesn't overwrite configuration files, but it will replace stock rc scripts in /etc/rc.d when they're updated. (I believe it checks rc.conf and friends for obvious problems, but I could be wrong. I still build my systems the old fashioned way with make world & mergemaster). –  voretaq7 May 16 '13 at 18:26
    
the short answer to your question though is "You don't blindly install updates." -- it's irresponsible to do so (I can tell you horror stories of production environments destroyed by yum -y update). If the tool asks you a question it's because it really needs you to stop, think, and respond. You can always pipe yes to freebsd-upgrade and run portupgrade --batch if you want to, but IMHO that's a pretty big foot-gun. –  voretaq7 May 16 '13 at 18:28
1  
@oberstet that's only for fetch (and it tells you what to do about it in the error message). Also to be blunt I don't think you know the requirements of freebsd-upgrade better than the dude who wrote it (he's been doing this longer than I have, and he's pretty good at this whole "write stuff that doesn't destroy the universe" thing), but if you really think you know better it's just a shell script -- You can copy it and hack to your heart's content to make it behave how you want... –  voretaq7 May 16 '13 at 19:02
1  
No it won't destroy a newly installed system. He's worrying you'll blow up your systems and obviously didn't read any of the bits about nightly images. –  Florian Heigl Apr 26 at 21:13
up vote 2 down vote accepted

Allow freebsd-update to run fetch without stdin attached to a terminal:

sed 's/\[ ! -t 0 \]/false/' /usr/sbin/freebsd-update > /tmp/freebsd-update
chmod +x /tmp/freebsd-update

Allow portsnap to run fetch without stdin attached to a terminal:

sed 's/\[ ! -t 0 \]/false/' /usr/sbin/portsnap > /tmp/portsnap
chmod +x /tmp/portsnap

Credits: veewee

share|improve this answer
    
Outstanding! I was looking for this to automate an installation! –  Vinícius Ferrão Apr 23 at 2:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.