CloverBootloader/CloverPackage/CloverV2/rcScripts/etc/rc.boot.d/70.disable_sleep_proxy_client.local.disabled
2019-09-03 12:58:42 +03:00

50 lines
1.2 KiB
Bash

#!/bin/bash
#
# disable mDNSResponder sleep proxy client
# this will prevent the system waking from sleep every hours
#
# © JrCs 2013
# Check that all variable are bound
set -u
#
# Source clover rc library if needed
#
if [[ ! "$(type -t GetNVRamKey)" == "function" ]]; then
selfDir=$(cd $(dirname "$0") && pwd -P)
source "${selfDir}"/../rc.clover.lib
fi
# Variables
mDNSResponderPList=/System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
pListBuddy=/usr/libexec/PlistBuddy
disableOption='-DisableSleepProxyClient'
# Debug mode ?
[[ "$DEBUG" -ne 0 ]] && set -x
[[ ! -f "$mDNSResponderPList" ]] && exit 0
# Check if sleep proxy is not already disabled
already_disabled=$($pListBuddy -c 'Print ProgramArguments:' \
"$mDNSResponderPList" | grep -c -- "$disableOption")
if [[ $already_disabled -eq 0 ]]; then
echo "Disabling mDNS responder sleep proxy"
$pListBuddy -c "Add ProgramArguments: string $disableOption" \
"$mDNSResponderPList"
else
echo "mDNS responder sleep proxy already disabled"
fi
# Local Variables: #
# mode: ksh #
# tab-width: 4 #
# indent-tabs-mode: nil #
# End: #
#
# vi: set expandtab ts=4 sw=4 sts=4: #