create /srv/static.debian.org/master static-masters
[mirror/dsa-puppet.git] / modules / site / manifests / alternative.pp
1 define site::alternative ($linkto, $ensure = present) {
2         case $ensure {
3                 present: {
4                         exec { "/usr/bin/update-alternatives --set ${name} ${linkto}":
5                                 unless => "[ $(update-alternatives --query ${name} | grep ^Value | awk '{print \$2}') = ${linkto} ]",
6                         }
7                 }
8                 absent: {
9                         exec { "/usr/bin/update-alternatives --remove ${name} ${linkto}":
10                                 unless => "[ $(update-alternatives --query ${name} | grep ^Value | awk '{print \$2}') != ${linkto} ]",
11                         }
12                 }
13                 default: { fail ( "Unknown ensure value: '$ensure'" ) }
14         }
15 }