Skip to content

Instantly share code, notes, and snippets.

Avatar

Armin Briegel scriptingosx

View GitHub Profile
@scriptingosx
scriptingosx / pkgAndNotarize.sh
Created Sep 10, 2019
Script that builds, packages and notarizes an Xcode command line tool.
View pkgAndNotarize.sh
#!/bin/zsh
# pkgAndNotarize.sh
# 2019 - Armin Briegel - Scripting OS X
# place a copy of this script in in the project folder
# when run it will build for installation,
# create a pkg from the product,
# upload the pkg for notarization and monitor the notarization status
@scriptingosx
scriptingosx / bash_prompt.sh
Last active Sep 10, 2019
Sample code for dynamic bash prompt that shows exit codes.
View bash_prompt.sh
# PROMPT
# default macOS prompt is: \h:\W \u\$
# assemble the prompt string PS1
# inspired from: https://stackoverflow.com/a/16715681
function __build_prompt {
local EXIT="$?" # store current exit code
# define some colors
@scriptingosx
scriptingosx / InstallerBuilds.sh
Created Mar 28, 2019
This script will print the build numbers of the macOS version from all installer apps
View InstallerBuilds.sh
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
installerBuildVersion() { # $1 path to the installer app
installerApp=${1:?"no path for installer"}
# echo "inspecting: $installerApp"
if [[ -d "$installerApp" ]]; then
identifier=$(/usr/libexec/PlistBuddy -c "print CFBundleIdentifier" "$installerApp/Contents/Info.plist")
@scriptingosx
scriptingosx / checkmembers.sh
Created Nov 19, 2018
This script will loop through all users and use dseditgroup to check if they are a member of a given group (macOS)
View checkmembers.sh
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# checkusers
#
# written by Armin Briegel, Scripting OS X, 2018
#
# code is provided as is, with no guarantees that it will work etc.
# adapt and use as you will
@scriptingosx
scriptingosx / allusers.sh
Created Nov 19, 2018
This script will try to determine a list of members of the given group and list all members (macOS)
View allusers.sh
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# allusers.sh
#
# written by Armin Briegel, Scripting OS X, 2018
#
# code is provided as is, with no guarantees that it will work etc.
# adapt and use as you will
@scriptingosx
scriptingosx / userpictures.sh
Created Oct 23, 2018
sample script that loops through all users and sets a different user picture.
View userpictures.sh
#!/bin/bash
# create an array from all images in the User Pictures subfolders
IFS=$'\n' read -rd '' -a pictures <<< "$(find '/Library/User Pictures/Fun' -name *.tif -print )"
# loop through all users
picIndex=0
@scriptingosx
scriptingosx / setdesktop.sh
Last active Apr 20, 2020
Sample script to set the desktop with desktoppr
View setdesktop.sh
#!/bin/sh
##
## sets the desktop using `desktoppr`
##
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# set the path to the desktop image file here
picturepath="/Library/Desktop Pictures/BoringBlueDesktop.png"
@scriptingosx
scriptingosx / com.scriptingosx.setdesktop.plist
Created Sep 14, 2018
simple LaunchAgent plist which re-sets the desktop at login with desktoppr https://github.com/scriptingosx/desktoppr
View com.scriptingosx.setdesktop.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.scriptingosx.setdesktop</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/desktoppr</string>
<string>/Library/Desktop Pictures/BoringBlueDesktop.png</string>
@scriptingosx
scriptingosx / desktop_picture_boringblue.mobileconfig
Last active Sep 12, 2018
sample configuration profile to set the desktop picture.
View desktop_picture_boringblue.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDisplayName</key>
<string>Desktop</string>
<key>PayloadEnabled</key>
@scriptingosx
scriptingosx / EmptyProfile.mobileconfig
Last active Aug 17, 2018
Empty Mobile Configuration file suitable as a placeholder for certain operations
View EmptyProfile.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDescription</key>
<string>Empty Profile that controls nothing</string>
<key>PayloadDisplayName</key>
You can’t perform that action at this time.