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

View file

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

View file

@ -10,9 +10,9 @@
nmt.script = '' nmt.script = ''
assertFileRegex activate \ 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 \ 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"
''; '';
}; };
} }