# # A little exercise leading up to getting rdiskXsY loaded into a variable for use in a postflight script # # Do not remove any quotation (") marks! They are important # # Type the commands below into Terminal and observe the results # # in the following line, replace your_partition_name with the name of one of your partitions # this command loads your partition path into variable $gg and then prints it out # gg="/Volumes/your_partition_name" echo $gg # Next, try this # It will find a certain line in the "diskutil info" command that contains "diskXsY" without the leading "r" # diskutil info "$gg" | grep "Device Indentifier" # Next, try this # Same thing, except the same result is loaded into the variable $zz and then printed out # zz=$(diskutil info "$gg" | grep "Device Indentifier") ; echo $zz # Next, try this # This one loads "diskXsY" into variable $zz and prints it out # The "awk" command grabs the 3rd string that is printed in the command above # It is not the variable "$3" from the installer # zz=$(diskutil info "$gg" | grep "Device Indentifier" | awk '{print $3}') ; echo $zz # Next, try this # This one adds the "r" to the front of "diskXsY" and prints it out # zz=$(diskutil info "$gg" | grep "Device Indentifier" | awk '{print "r"$3}') ; echo $zz # In the above command, you should now have "rdiskXsY" loaded into variable $zz # # So, in a postflight script, replacing $gg with installer variable $3 SHOULD give you the "rdiskXsY" in variable $zz # I have not tested this final step in an actual postflight script # You can change the variable $zz to any name you want in the following # zz=$(diskutil info "$3" | grep "Device Indentifier" | awk '{print "r"$3}')