[
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2022 Meter, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "See https://www.meter.com/mac-osx-awdl-psa for more context. This script will disable AWDL (Apple Wireless Direct Link)\nin order to improve WiFi connectivity for Apple M1/M2 MacBooks.\n\n# Usage\n\n## Run it one time\n\n1. On your Mac, open the Terminal app.\n2. Run: \n```bash <(curl -sL https://www.meter.com/awdl.sh)```\n3. Acknowledge the prompt and type in your admin password.\n\n\n## Run it automatically after a restart. \n\n1. On your Mac, open the Terminal app.\n2. Run: \n```curl -sL https://www.meter.com/awdl-daemon.sh | bash```\n\n## Remove the scripts and renable awdl0 interface\n```\ncurl -s https://raw.githubusercontent.com/meterup/awdl_wifi_scripts/main/cleanup-and-reenable-awdl.sh | bash &> /dev/null\n``` \n"
  },
  {
    "path": "awdl-daemon.sh",
    "content": "#!/bin/bash\n\ncurl -s https://raw.githubusercontent.com/meterup/awdl_wifi_scripts/main/disable_awdl.sh > ~/disable_awdl.sh\nsudo chmod u+x ~/disable_awdl.sh\ncd /Library/LaunchDaemons/ && sudo curl -sO https://raw.githubusercontent.com/meterup/awdl_wifi_scripts/main/com.meter.wifi.awdl.plist\nsudo sed -i -- \"s/YOUR_USERNAME/${USER}/g\" /Library/LaunchDaemons/com.meter.wifi.awdl.plist\nsudo launchctl unload -w /Library/LaunchDaemons/com.meter.wifi.awdl.plist 2> /dev/null\nsudo launchctl load -w /Library/LaunchDaemons/com.meter.wifi.awdl.plist\n"
  },
  {
    "path": "awdl.sh",
    "content": "#!/usr/bin/env bash\n\nread -p \"See https://www.meter.com/mac-osx-awdl-psa for more details. You will be prompted for your admin password. Do you want to continue? y/n\" choice\n\ncase $choice in\n[yY]* ) sudo echo \"Installing disable_awdl.sh in your tmp directory. This will run in the background.\" ;;\n[nN]* ) exit ;;\n*) exit ;;\nesac\n\ncurl -s https://raw.githubusercontent.com/meterup/awdl_wifi_scripts/main/disable_awdl.sh > /tmp/disable_awdl.sh\nchmod u+x /tmp/disable_awdl.sh\n\nsudo bash /tmp/disable_awdl.sh > /dev/null &\n"
  },
  {
    "path": "cleanup-and-reenable-awdl.sh",
    "content": "#!/bin/bash\n\nsudo launchctl unload -w /Library/LaunchDaemons/com.meter.wifi.awdl.plist\nsudo rm /Library/LaunchDaemons/com.meter.wifi.awdl.plist*\nsudo pkill -f /tmp/disable_awdl.sh\nsudo pkill -f ~/disable_awdl.sh\nsudo rm /tmp/disable_awdl.sh\nrm ~/disable_awdl.sh\nsudo ifconfig awdl0 up\n"
  },
  {
    "path": "com.meter.wifi.awdl.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>Label</key>\n\t<string>com.meter.wifi.awdl</string>\n\t<key>ProgramArguments</key>\n\t<array>\n\t\t<string>/Users/YOUR_USERNAME/disable_awdl.sh</string>\n\t</array>\n\t<key>RunAtLoad</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "disable_awdl.sh",
    "content": "#!/usr/bin/env bash\n\nset -euo pipefail\n\nwhile true; do\n    if ifconfig awdl0 |grep -q \"<UP\"; then\n        (set -x; ifconfig awdl0 down)\n    fi\n\n    sleep 1\ndone"
  },
  {
    "path": "disable_disable_awdl.sh",
    "content": "#!/usr/bin/env bash\n\nset -euo pipefail\n\nread -p \"See https://www.meter.com/mac-osx-awdl-psa for more details. You will be prompted for your admin password. Do you want to continue? y/n: \" choice\n\ncase $choice in\n[yY]* ) sudo echo \"Stopping disable_awdl.sh from running in the background.\" ;;\n[nN]* ) exit ;;\n*) exit ;;\nesac\n\nsudo pkill -f /tmp/disable_awdl.sh\nsudo ifconfig awdl0 up\n"
  }
]