Any BASH scripters here? (Question about resizeVolume and sizes)

Hiya,

I’m writing a script for Macs that’ll retain the computername an AD information for a NetInstall image. I’m doing it through a pre-install script that will create a new volume and write the Hostname to that volume. The post-flight script will fetch the variable from the new volume and apply it to the ComputerName and LocalHostName vars in the script. MergePartitions will then delete the new volume and then apply the AD bind script.

The problem is that I’m dealing with five or six different SKUs that the script can be applied to, with HDD sizes varying from 60 to 500 gigabytes. And according to the resizeVolume man-page, you can only used specified file sizes for the volume. Meaning, if I use the lowest common denominator, I’ll be reducing the volume of the bigger HDDs significantly.
So the question is, how can I achieve a dynamic volume size that won’t cut away a lot of the original volume to Free Space?

Do you have a way to read what the SKU is? If so, something like this could work:



#!/bin/sh
# SKU is the first and only argument.
SKU_IN=$1
REF_SKU_1=insert_sku1_here
REF_SKU_2=insert_sku2_here
REF_SKU_3=insert_sku3_here
#etc..

if (test "$SKU_IN" = "$REF_SKU_1")
then
 HDD_SIZE=60
else (test "$SKU_IN" = "$REF_SKU_2")
 HDD_SIZE=80
fi

echo $HDD_SIZE
#you can run the rest of your commands


If you were looking for a thorough script which interfaces the specific programs that you mention, I’ll have to say that I’m not familiar with them, so hopefully this is at least of some use.