mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-02 13:03:28 +01:00
7c0aa811ec
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
50 lines
1.2 KiB
Bash
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: #
|