From 72ecb1c56a78bf7444e943676d1356759e4178a3 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 2 Aug 2012 19:57:33 -0700 Subject: [PATCH] Add an afterboot script. --- .../DNSCrypt-OSX-Installer.pkgproj | 16 ++++++++++++ .../Scripts/dnscrypt-prefpane-postinstall.sh | 3 ++- .../Scripts/dnscrypt-prefpane-preinstall.sh | 1 + .../com.opendns.osx.DNSCryptAfterboot.plist | 26 +++++++++++++++++++ ...om.opendns.osx.DNSCryptConsoleChange.plist | 2 +- ...om.opendns.osx.DNSCryptControlChange.plist | 4 +-- ...om.opendns.osx.DNSCryptNetworkChange.plist | 4 +-- .../usr/scripts/handle-network-change.sh | 7 +++-- 8 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptAfterboot.plist diff --git a/DNSCrypt-OSX-Installer/DNSCrypt-OSX-Installer.pkgproj b/DNSCrypt-OSX-Installer/DNSCrypt-OSX-Installer.pkgproj index e204d07..8caf506 100755 --- a/DNSCrypt-OSX-Installer/DNSCrypt-OSX-Installer.pkgproj +++ b/DNSCrypt-OSX-Installer/DNSCrypt-OSX-Installer.pkgproj @@ -783,6 +783,22 @@ CHILDREN + + CHILDREN + + GID + 0 + PATH + /Users/j/OpenDNS/DNSCrypt/OSX/dnscrypt-osx-client/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptAfterboot.plist + PATH_TYPE + 0 + PERMISSIONS + 420 + TYPE + 3 + UID + 0 + CHILDREN diff --git a/DNSCrypt-OSX-Installer/Scripts/dnscrypt-prefpane-postinstall.sh b/DNSCrypt-OSX-Installer/Scripts/dnscrypt-prefpane-postinstall.sh index a8759c4..a98b774 100755 --- a/DNSCrypt-OSX-Installer/Scripts/dnscrypt-prefpane-postinstall.sh +++ b/DNSCrypt-OSX-Installer/Scripts/dnscrypt-prefpane-postinstall.sh @@ -5,8 +5,8 @@ exec 2>/dev/null /bin/mkdir -p '/Library/Application Support/DNSCrypt/control' /bin/mkdir -p '/Library/Application Support/DNSCrypt/dnscrypt-proxy' /bin/mkdir -p '/Library/Application Support/DNSCrypt/probes' -/bin/mkdir -p '/Library/Application Support/DNSCrypt/tickets' /bin/mkdir -p '/Library/Application Support/DNSCrypt/states' +/bin/mkdir -p '/Library/Application Support/DNSCrypt/tickets' /usr/sbin/chown -R 0:0 '/Library/Application Support/DNSCrypt' /bin/chmod 710 '/Library/Application Support/DNSCrypt' @@ -20,6 +20,7 @@ if [ $? != 0 ]; then fi /bin/launchctl load -D local +/bin/launchctl start com.opendns.osx.DNSCryptAfterboot /bin/launchctl start com.opendns.osx.DNSCryptConsoleChange /bin/launchctl start com.opendns.osx.DNSCryptControlChange /bin/launchctl start com.opendns.osx.DNSCryptNetworkChange diff --git a/DNSCrypt-OSX-Installer/Scripts/dnscrypt-prefpane-preinstall.sh b/DNSCrypt-OSX-Installer/Scripts/dnscrypt-prefpane-preinstall.sh index ccbbc47..0f37f3c 100755 --- a/DNSCrypt-OSX-Installer/Scripts/dnscrypt-prefpane-preinstall.sh +++ b/DNSCrypt-OSX-Installer/Scripts/dnscrypt-prefpane-preinstall.sh @@ -10,6 +10,7 @@ fi /bin/rm -f '/Library/LaunchDaemons/com.opendns.osx.DNSCryptConfigUpdater.plist' /bin/rm -rf '/Library/Application Support/DNSCrypt Updater' +/bin/launchctl remove com.opendns.osx.DNSCryptAfterboot /bin/launchctl remove com.opendns.osx.DNSCryptConsoleChange /bin/launchctl remove com.opendns.osx.DNSCryptControlChange /bin/launchctl remove com.opendns.osx.DNSCryptNetworkChange diff --git a/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptAfterboot.plist b/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptAfterboot.plist new file mode 100644 index 0000000..b427efb --- /dev/null +++ b/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptAfterboot.plist @@ -0,0 +1,26 @@ + + + + + Label + com.opendns.osx.DNSCryptAfterboot + KeepAlive + + RunAtLoad + + WorkingDirectory + /Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr/scripts + ProgramArguments + + /Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr/scripts/afterboot.sh + + ExitTimeOut + 300 + ThrottleInterval + 1 + Nice + 1 + UserName + root + + diff --git a/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptConsoleChange.plist b/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptConsoleChange.plist index 0c6542f..d182b30 100644 --- a/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptConsoleChange.plist +++ b/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptConsoleChange.plist @@ -14,7 +14,7 @@ /Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr/scripts/handle-console-change.sh - ExitTimeout + ExitTimeOut 30 ThrottleInterval 0 diff --git a/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptControlChange.plist b/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptControlChange.plist index 21eb1d0..429fed8 100644 --- a/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptControlChange.plist +++ b/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptControlChange.plist @@ -14,8 +14,8 @@ /Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr/scripts/handle-control-change.sh - ExitTimeout - 30 + ExitTimeOut + 300 ThrottleInterval 0 Nice diff --git a/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptNetworkChange.plist b/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptNetworkChange.plist index bf6893c..2230257 100644 --- a/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptNetworkChange.plist +++ b/DNSCrypt-OSX-Installer/com.opendns.osx.DNSCryptNetworkChange.plist @@ -14,8 +14,8 @@ /Library/PreferencePanes/DNSCrypt.prefPane/Contents/Resources/usr/scripts/handle-network-change.sh - ExitTimeout - 30 + ExitTimeOut + 300 ThrottleInterval 1 Nice diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/handle-network-change.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/handle-network-change.sh index c5a8bc5..bba6101 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/handle-network-change.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/handle-network-change.sh @@ -4,8 +4,11 @@ tickets_count=$(./get-tickets_count) [ "$tickets_count" != '0' ] && exit 0 -[ ! -e "$FALLBACK_FILE" ] && exit 0 -./check-network-change.sh || exit 0 + +if [ $1 != '--boot' ]; then + [ ! -e "$FALLBACK_FILE" ] && exit 0 + ./check-network-change.sh || exit 0 +fi lockfile -1 -r 30 -l 60 "$HANDLERS_LOCK_FILE" || exit 1 ./set-dns-to-dhcp.sh