Skip to content
This repository has been archived by the owner on May 22, 2018. It is now read-only.

Commit

Permalink
Merge pull request #82 from n0ts/master
Browse files Browse the repository at this point in the history
Support refreshonly
  • Loading branch information
rafaelfranca committed Jan 1, 2014
2 parents 0b1d418 + aa54456 commit d0a6d72
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions manifests/osx_defaults.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Public: Set a system config option with the OS X defaults system

define boxen::osx_defaults(
$ensure = 'present',
$host = undef,
$domain = undef,
$key = undef,
$value = undef,
$user = undef,
$type = undef,
$ensure = 'present',
$host = undef,
$domain = undef,
$key = undef,
$value = undef,
$user = undef,
$type = undef,
$refreshonly = undef,
) {
$defaults_cmd = '/usr/bin/defaults'
$default_cmds = $host ? {
Expand Down Expand Up @@ -42,10 +43,16 @@

$read_cmd = shellquote($default_cmds, 'read', $domain, $key)

$refreshonly_ = $refreshonly ? {
undef => false,
default => true,
}

exec { "osx_defaults write ${host} ${domain}:${key}=>${value}":
command => $write_cmd,
unless => "${read_cmd} && (${read_cmd} | awk '{ exit \$0 != \"${checkvalue}\" }')",
user => $user
command => $write_cmd,
unless => "${read_cmd} && (${read_cmd} | awk '{ exit \$0 != \"${checkvalue}\" }')",
user => $user,
refreshonly => $refreshonly_
}
} # end present

Expand Down

0 comments on commit d0a6d72

Please sign in to comment.