Show at-boot setting

This commit is contained in:
Jamie Cameron
2015-04-28 21:34:52 -07:00
parent c153fae3d8
commit 79e2bf69b4
2 changed files with 6 additions and 4 deletions

View File

@@ -2287,7 +2287,7 @@ foreach my $l (split(/\r?\n/, $out)) {
# Build map from plist files to agents
my @dirs = ("/Library/LaunchAgents",
"/Library/LaunchDaemons/",
"/Library/LaunchDaemons",
"/System/Library/LaunchAgents",
"/System/Library/LaunchDaemons");
my %pmap;
@@ -2306,11 +2306,12 @@ foreach my $a (@rv) {
my %attrs;
foreach my $l (split(/\r?\n/, $out)) {
if ($l =~ /"(\S+)"\s*=\s*"([^"]*)";/ ||
$l =~ /"(\S+)"\s*=\s*\S+;/) {
$l =~ /"(\S+)"\s*=\s*(\S+);/) {
$attrs{lc($1)} = $2;
}
}
$a->{'start'} = $attrs{'program'};
$a->{'boot'} = $attrs{'ondemand'} eq 'false';
$a->{'file'} = $pmap{$a->{'name'}};
}
@@ -2342,7 +2343,7 @@ $plist .= "<key>KeepAlive</key>\n";
$plist .= "<true/>\n";
$plist .= "</dict>\n";
$plist .= "</plist>\n";
&open_locl_tempfile(PLIST, ">$file");
&open_lock_tempfile(PLIST, ">$file");
&print_tempfile(PLIST, $plist);
&close_tempfile(PLIST);
my $out = &backquote_logged("launchctl load ".quotemeta($file)." 2>&1");

View File

@@ -55,7 +55,8 @@ else {
&open_lock_tempfile(CONF, ">$u->{'file'}");
&print_tempfile(CONF, $in{'conf'});
&close_tempfile(CONF);
&restart_launchd();
&system_logged("launchctl unload ".quotemeta($u->{'file'})." 2>&1");
&system_logged("launchctl load ".quotemeta($u->{'file'})." 2>&1");
# Enable or disable
if (defined($in{'boot'})) {