]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/Scripts/bonjour-start-mdns-tcpdump
mDNSResponder-878.200.35.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / Scripts / bonjour-start-mdns-tcpdump
1 #! /bin/bash
2 #
3 # Copyright (c) 2018 Apple Inc. All rights reserved.
4 #
5 # This script is currently for Apple Internal use only.
6 #
7
8 version=1.0
9 script=${BASH_SOURCE[0]}
10
11 #============================================================================================================================
12 # PrintUsage
13 #============================================================================================================================
14
15 PrintUsage()
16 {
17 echo ""
18 echo "Usage: $( basename "${script}" ) [options]"
19 echo ""
20 echo "Options:"
21 echo " -V Display version of this script and exit."
22 echo ""
23 }
24
25 #============================================================================================================================
26 # main
27 #============================================================================================================================
28
29 main()
30 {
31 while getopts ":hV" option; do
32 case "${option}" in
33 h)
34 PrintUsage
35 exit 0
36 ;;
37 V)
38 echo "$( basename "${script}" ) version ${version}"
39 exit 0
40 ;;
41 :)
42 ErrQuit "option '${OPTARG}' requires an argument."
43 ;;
44 *)
45 ErrQuit "unknown option '${OPTARG}'."
46 ;;
47 esac
48 done
49
50 [ "${OPTIND}" -gt "$#" ] || ErrQuit "unexpected argument \""${!OPTIND}"\"."
51
52 launchctl load /Library/LaunchDaemons/com.apple.mDNSResponder.mdns-tcpdump.plist
53 launchctl start com.apple.mDNSResponder.mdns-tcpdump
54 }
55
56 main "$@"