darwin: use full path to commands in activation script

This commit is contained in:
midchildan 2022-11-05 12:10:27 +09:00
parent b764068a50
commit c728307482
No known key found for this signature in database
GPG key ID: A64DE57FA5963935
3 changed files with 9 additions and 9 deletions

View file

@ -162,12 +162,12 @@ in {
fi
if [[ -f "$dstPath" ]]; then
for (( i = 0; i < bootout_retries; i++ )); do
$DRY_RUN_CMD launchctl bootout "$domain/$agentName" || err=$?
$DRY_RUN_CMD /bin/launchctl bootout "$domain/$agentName" || err=$?
if [[ -v DRY_RUN ]]; then
break
fi
if (( err != 9216 )) &&
! launchctl print "$domain/$agentName" &> /dev/null; then
! /bin/launchctl print "$domain/$agentName" &> /dev/null; then
break
fi
sleep 1
@ -178,7 +178,7 @@ in {
fi
fi
$DRY_RUN_CMD install -Dm444 -T "$srcPath" "$dstPath"
$DRY_RUN_CMD launchctl bootstrap "$domain" "$dstPath"
$DRY_RUN_CMD /bin/launchctl bootstrap "$domain" "$dstPath"
done
if [[ ! -e "$oldDir" ]]; then
@ -194,7 +194,7 @@ in {
continue
fi
$DRY_RUN_CMD launchctl bootout "$domain/$agentName" || :
$DRY_RUN_CMD /bin/launchctl bootout "$domain/$agentName" || :
if [[ ! -e "$dstPath" ]]; then
continue
fi

View file

@ -13,9 +13,9 @@ let
cliFlags = lib.optionalString isLocal "-currentHost";
toActivationCmd = domain: attrs:
"$DRY_RUN_CMD defaults ${cliFlags} import ${escapeShellArg domain} ${
toDefaultsFile domain attrs
}";
"$DRY_RUN_CMD /usr/bin/defaults ${cliFlags} import ${
escapeShellArg domain
} ${toDefaultsFile domain attrs}";
nonNullDefaults =
mapAttrs (domain: attrs: (filterAttrs (n: v: v != null) attrs))

View file

@ -10,9 +10,9 @@
nmt.script = ''
assertFileRegex activate \
"defaults import 'com.apple.desktopservices' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.desktopservices\\.plist"
"/usr/bin/defaults import 'com.apple.desktopservices' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.desktopservices\\.plist"
assertFileRegex activate \
"defaults -currentHost import 'com.apple.controlcenter' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.controlcenter\\.plist"
"/usr/bin/defaults -currentHost import 'com.apple.controlcenter' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.controlcenter\\.plist"
'';
};
}