Skip to content

Instantly share code, notes, and snippets.

View grahampugh's full-sized avatar

Graham Pugh grahampugh

View GitHub Profile
#!/bin/sh
# Adapted from script by "henkb"; http://deploystudio.com/Forums/viewtopic.php?id=4914
echo ""
echo "### Checking filesystem architecture on disk0 (HFS or CoreStorage). ###"
TYPE=`diskutil list | grep -A4 /dev/disk0 | tail -n 1 | awk '{print $2}' | cut -d "_" -f2`
if [ "$TYPE" = "HFS" ]
then echo "# Architecture is HFS. Skipping additional steps and continue with regular DeployStudio-workflow."
elif [ "$TYPE" = "CoreStorage" ]
#!/bin/bash
### ACTIVE DIRECTORY USER PERMISSIONS SCRIPT ###
### by Graham Pugh
### Props to Jeff Kelley, Graham Gilbert and various others for elements of script
### This script looks at the "Allow Administration By" field of the
### `dsconfigad -show` command and checks each of the Active Directory users
### with mobile accounts on the computer to check whether they should have
### local admin rights. It amends each user's membership of the local
@grahampugh
grahampugh / com.github.grahampugh.checklocaladmin.plist
Last active April 11, 2017 12:07
Check Local Admin LaunchAgent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.grahampugh.checklocaladmin</string>
<key>Program</key>
<string>/Library/Management/checklocaladmin/check_local_admin.sh</string>
<key>RunAtLoad</key>
<true/>
@grahampugh
grahampugh / deleteparentlvg.sh
Last active April 8, 2020 00:14
deleteparentlvg.sh
#!/bin/sh
SCRIPT_NAME=`basename "${0}"`
VERSION=1.1
SYS_VERS=`sw_vers -productVersion | awk -F. '{ print $2 }'`
if [ ${SYS_VERS} -lt 7 ]
then
echo "This script requires OS X 10.7 or later!" >>/dev/stderr
exit 1
@grahampugh
grahampugh / munkirm
Last active October 8, 2020 15:19
Search and delete Munki repo items
#!/bin/bash
### A script to search your Munki repo and offer to delete items. Use with care!
### It will search all directories including pkgs, pkgsinfo and icons.
### Syntax: /path/to/munkirm -d <search-term>
### For example, /path/to/munkirm -d xcode
### Search is case insensitive.
### Options are y or Y to delete, n, N or anything else to skip, and q or Q to quit
### If any changes are made, `makecatalogs` is run
### Put munkirm in /usr/local/munki/ if you wish to run from all directories
@grahampugh
grahampugh / manifest-find.sh
Last active August 29, 2015 14:19
Munki Manifest Find
#!/bin/bash
### A script to find which manifests contain references to a package or other manifest via included_manifests
### Your Munki repository must be mounted as a volume
### Syntax:
### $ ./manifest-find.sh -f <package or manifest name>
### Examples:
### $ ./manifest-find.sh -f Xcode
### $ ./manifest-find.sh -f _regular_users
@grahampugh
grahampugh / enroll.php
Last active August 29, 2015 14:23
Variant of munki-enroll's enrol.php script to allow leveraging of DeployStudio's Computer Information Fields to influence Munki Included Manifests
<?php
require_once( 'cfpropertylist-1.1.2/CFPropertyList.php' );
// Default catalog
$catalog = 'standard';
// Get the varibles passed by the enroll script
$identifier1 = $_POST["identifier1"];
$identifier2 = $_POST["identifier2"];
@grahampugh
grahampugh / matlab-mable-ubuntu14.sh
Last active August 29, 2015 14:23
Installs Matlab and Maple from packages.bris.ac.uk to UoB Ubuntu 14.04 LTS desktops. Will only work within the University.
#!/bin/bash
# uncomment these to force a reinstall
# dpkg -r opt-maple-18 opt-maple-18-modules
# rm -rf /opt/matlab-R2014a
# matlab
if [ ! -f /opt/matlab-R2014a/bin/matlab ]; then
wget -O /opt-matlab-R2014a--plus-module.tar.bz2 http://packages.bris.ac.uk/unpackaged/zone_d/opt-matlab-R2014a--plus-module.tar.bz2
tar xvjf /opt-matlab-R2014a--plus-module.tar.bz2 -C /
#!/bin/sh
SCRIPT_NAME=`basename "${0}"`
SCRIPT_PATH=`dirname "${0}"`
echo "${SCRIPT_NAME} - v1.0 ("`date`")"
if [ ${#} -ne 1 ]
then
echo "Command: ${SCRIPT_NAME} ${*}"
@grahampugh
grahampugh / postinstall
Last active August 29, 2015 14:23
Munki installer postinstall - checks against CSV
#!/bin/bash
# This postinstall script runs all the scripts that the package placed into the target
# Library, and then deletes the folder that was previously created to remove the cruft
log() {
echo "${@}" 2>&1
logger -t Munki installer "${@}"
}