#!/bin/sh -e
#
# check-launch - description of folders usage from apple
#
# ---
# see: https://support.apple.com/guide/terminal/script-management-with-launchd-apdc6c1077b-5d5d-4d35-9c19-60f2397b2369/mac
#
# for privileged helper
# see: https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/AccessControl.html

# shellcheck disable=SC2010
info() {
  printf "%b$1%b %s\n" '\e[0;34m\033[1m' '\e[0m' "$2" >&2
}

info "----> ${HOME%/}/Library/LaunchAgents"
info "----> Third-party agents that apply only to the logged-in user:"
ls -a ~/Library/LaunchAgents | grep -Evw '.|.DS_Store'
info "----> /Library/LaunchAgents"
info "----> Third-party agents that apply to all users on a per-user basis:"
ls -a /Library/LaunchAgents | grep -Evw '.|.DS_Store'
info "----> /Library/LaunchDaemons"
info "----> Third-party system daemons:"
ls -a /Library/LaunchDaemons | grep -Evw '.|.DS_Store'
info "----> /Library/PrivilegedHelperTools"
info "----> Privileged Helpers:"
ls -a /Library/PrivilegedHelperTools | grep -Evw '.|.DS_Store'
