Puppet, debian and update-alternatives
One way to solve it would be:
define check_alternatives($linkto) {
exec { "/usr/sbin/update-alternatives --set $name $linkto":
unless => "/bin/sh -c '[ -L /etc/alternatives/$name ] && [ /etc/alternatives/$name -ef $linkto ]'"
}
}
Use it as:
# We want to use pinfo as infobrowser
check_alternatives { "infobrowser":
linkto => "/usr/bin/pinfo"
}
Can probably be done better, but this works for me :)