Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ###
  4. #
  5. # Name: shard.sh
  6. # Description: This Casper extension attribute takes a Mac serial
  7. # number as input and uses that serial number to output a
  8. # number from 1 to 10. This can be useful in scoping Casper
  9. # policies to a specific percentage of the fleet.
  10. # Author: Elliot Jordan <elliot@lindegroup.com>
  11. # Created: 2015-05-15
  12. # Last Modified: 2015-05-15
  13. # Version: 1.0
  14. #
  15. ###
  16.  
  17. SERIAL=$(ioreg -c IOPlatformExpertDevice -d 2 |awk '/IOPlatformSerialNumber/ {print $3}' |sed s/\"//g)
  18. HEX=$(echo "$SERIAL" | md5 | colrm 1 28) # last four hex digits of the serial's md5
  19. DEC=$(( 16#$HEX )) # number between 0 and 65535
  20. SHARD=$(( DEC % 10 )) # number between 0 and 9
  21.  
  22. echo "<result>$SHARD</result>"
  23.  
  24. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement