Skip to content

Instantly share code, notes, and snippets.

@krispayne
Last active April 18, 2019 13:55
Show Gist options
  • Save krispayne/d4bff4705c1ca32f7ded043758ae6fad to your computer and use it in GitHub Desktop.
Save krispayne/d4bff4705c1ca32f7ded043758ae6fad to your computer and use it in GitHub Desktop.
wrapper to update a patch definition with patchstarter.py from brysontyrell
#!/bin/bash
# update a patch
PATCHSTARTER="/usr/local/sbin/patchstarter"
echo -n "Enter an app name: "
read -e APP_NAME
echo -n "Enter a Publisher name (blank to match App Name): "
read -e PUBLISHER_NAME
echo -n "Minimum OS Version (if known): "
read -e MINIMUM_OS_VERSION
if [[ -z "${PUBLISHER_NAME}" ]]; then
PUBLISHER_NAME = "${APP_NAME}"
fi
if [[ -z "${MINIMUM_OS_VERSION"} ]]; then
MINIMUM_OS_VERSION="10.9"
fi
echo -n "Enter an app path. e.g. \"/Users/autopkg/Library/AutoPkg/Cache/local.jss.${APP_NAME}/${APP_NAME}/${APP_NAME}.app\": "
read -e APP_PATH
#trim spaces for $APP_TITLE
APP_TITLE="$(echo -e "${APP_NAME}" | tr -d '[:space:]')"
curl -X POST "http://localhost:5000/api/v1/title/${APP_TITLE}/version" \
-d "{\"items\": [$(python "${PATCHSTARTER}" "${APP_PATH}" -p "${PUBLISHER_NAME}" -n "${APP_NAME}" --min_sys_version "${MINIMUM_OS_VERSION}" --patch-only)]}" \
-H 'Content-Type: application/json'
@krispayne
Copy link
Author

I should really update this to just read the contents of the plist...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment