Skip to content

Instantly share code, notes, and snippets.

@apizz
apizz / Install_AirPrint_Printer.sh
Last active May 1, 2024 14:34
Programmatically adds an AirPrint printer, ideally with an icon
#!/bin/bash
# Use the built-in ipp2ppd tool to create a PPD file for AirPrint
# Add icon to PPD (if we can get one) and install the printer
# Required printer info
readonly PRINTER_IP='XXX.XXX.XXX.XXX'
readonly PRINTER_NAME='PRINTER_NAME'
readonly PRINTER_DISPLAY_NAME='PRINTER NAME'
readonly PRINTER_LOCATION='PRINTER LOCATION'
@apizz
apizz / autopkg_cache_cleanup.sh
Created February 27, 2021 07:04
Given an autopkg cache path, will remove any download and pkg items older than X days
#!/bin/bash
# Script to find and delete .dmg, .pkg, .tar.gz, and .zip files from
# your autopkg cache
# Failed / incomplete downloads (prefixed with tmp) are also removed
# Number of days after which to delete matching files
readonly DAYS_TO_DELETE=7
# Path to autopkg Cache folder for current user
@apizz
apizz / macOS-BrewFormula-Template.sh
Created October 18, 2020 02:47
Jamf script template to install or remove a specified homebrew formula as part of a policy
#!/bin/bash
# Script template to install or remove an installed homebrew
# formula.
# Variable to supply as part of the assigned Jamf policy to
# install or remove the specified brew formula
BREW_ITEM="$4"
# Comment out the undesired BREW_ACTION
BREW_ACTION="install"
@apizz
apizz / appleloops_MainStage_All_installcheck.bash
Created July 17, 2020 04:36
installcheck_script for appleloops MainStage nopkg item for all loops
#!/bin/bash
RECEIPT_ONE="/Library/Receipts/.appleLoopsMSMandatoryDone"
RECEIPT_TWO="/Library/Receipts/.appleLoopsMSOptionalDone"
# If either RECEIPT not present, run nopkg postinstall script
if [ ! -f "$RECEIPT_ONE" ] || [ ! -f "$RECEIPT_TWO" ]; then
exitcode=0
else
exitcode=1
@apizz
apizz / appleloops_LogicPro_All_installcheck.bash
Created July 17, 2020 04:35
installcheck_script for appleloops Logic Pro nopkg item for all loops
#!/bin/bash
RECEIPT_ONE="/Library/Receipts/.appleLoopsLPMandatoryDone"
RECEIPT_TWO="/Library/Receipts/.appleLoopsLPOptionalDone"
# If either RECEIPT not present, run nopkg postinstall script
if [ ! -f "$RECEIPT_ONE" ] || [ ! -f "$RECEIPT_TWO" ]; then
exitcode=0
else
exitcode=1
@apizz
apizz / appleloops_GarageBand_All_installcheck.bash
Created July 17, 2020 04:34
installcheck_script for appleloops GarageBand nopkg item for all loops
#!/bin/bash
RECEIPT_ONE="/Library/Receipts/.appleLoopsGBMandatoryDone"
RECEIPT_TWO="/Library/Receipts/.appleLoopsGBOptionalDone"
# If either RECEIPT not present, run nopkg postinstall script
if [ ! -f "$RECEIPT_ONE" ] || [ ! -f "$RECEIPT_TWO" ]; then
exitcode=0
else
exitcode=1
@apizz
apizz / appleloops_MainStage_Optional_installcheck.bash
Created July 17, 2020 04:32
installcheck_script for appleloops MainStage nopkg item for optional loops
#!/bin/bash
RECEIPT="/Library/Receipts/.appleLoopsMSOptionalDone"
# If RECEIPT not present, run nopkg postinstall script
if [ ! -f "$RECEIPT" ]; then
exitcode=0
else
exitcode=1
fi
@apizz
apizz / appleloops_LogicPro_Optional_installcheck.bash
Created July 17, 2020 04:31
installcheck_script for appleloops Logic Pro nopkg item for optional loops
#!/bin/bash
RECEIPT="/Library/Receipts/.appleLoopsLPOptionalDone"
# If RECEIPT not present, run nopkg postinstall script
if [ ! -f "$RECEIPT" ]; then
exitcode=0
else
exitcode=1
fi
@apizz
apizz / appleloops_GarageBand_Optional_installcheck.bash
Last active July 17, 2020 04:31
installcheck_script for appleloops GarageBand nopkg item for optional loops
#!/bin/bash
RECEIPT="/Library/Receipts/.appleLoopsGBOptionalDone"
# If RECEIPT not present, run nopkg postinstall script
if [ ! -f "$RECEIPT" ]; then
exitcode=0
else
exitcode=1
fi
@apizz
apizz / appleloops_MainStage_Mandatory_installcheck.bash
Created July 15, 2020 01:48
installcheck_script for appleloops MainStage nopkg item for mandatory loops
#!/bin/bash
RECEIPT="/Library/Receipts/.appleLoopsMSMandatoryDone"
# If RECEIPT not present, run nopkg postinstall script
if [ ! -f "$RECEIPT" ]; then
exitcode=0
else
exitcode=1
fi