dfad6b83d9ee96bee41e40cd382f435078533778
[puppet-modules/puppetlabs-apt.git] / manifests / mark.pp
1 # @summary Manages apt-mark settings
2 #
3 # @param setting
4 #   auto, manual, hold, unhold
5 #   specifies the behavior of apt in case of no more dependencies installed
6 #   https://manpages.debian.org/stable/apt/apt-mark.8.en.html
7 #
8 define apt::mark (
9   Enum['auto','manual','hold','unhold'] $setting,
10 ) {
11   case $setting {
12     'unhold': {
13       $unless_cmd = undef
14     }
15     default: {
16       $unless_cmd = "/usr/bin/apt-mark show${setting} ${title} | /bin/fgrep -qs ${title}"
17     }
18   }
19   exec { "/usr/bin/apt-mark ${setting} ${title}":
20     onlyif => "/usr/bin/dpkg -l ${title}",
21     unless => $unless_cmd,
22   }
23 }
24