partitioning post image: script not working

AdvancedNoob
New Contributor III

Hi Nation,

I took the script from @mvught from here and changed it a bit, see below. The idea is to delete the recovery partition and merge it with the main partition.

When I run it 'after', it doesn't work, when I run it on 'reboot', it works perfectly.

any ideas?

#Find the boot partition and recovery partition
main=$(diskutil list internal | grep Apple_HFS | grep -v Data | grep -v iMac2 | awk '{print ($6)}');
recovery=$(diskutil list | grep "Recovery HD" |awk '{print ($7)}');

#This will merge the two partitions, with Apple_HFS absorbing the space from Recovery HD and expanding, it causes no data loss on the Apple_HFS disk.
sudo diskutil eraseVolume JHFS+ Blank $recovery ;
sudo diskutil mergePartitions JHFS+ iMac $main $recovery ;

thanks

4 REPLIES 4

mvught
Contributor

Hello AdvancedNoob,

Does it work if you run this in the terminal? Step by step?

AdvancedNoob
New Contributor III

hi @mvught , yes it does. I ran it from netboot and on local machine without any problem. Not too sure why it doesn't work when set to 'after' on imaging.

mvught
Contributor

Ok, what do you use for imaging? What is your work process.
Do you still use casper imaging or how do you run it?

AdvancedNoob
New Contributor III

yes, I use casper/jamf imaging,

create dmg with autodmg, add admin with createuserpkg
wack the result in Jamf admin

usual stuff really it seems

as I say it works when set on 'reboot' which is rather odd