#!/sbin/sh

# Script for performing the repartitioning operation on the CF media.
#
# This script will be called by the mdimage-startup script if the 
# repartitioning operation has been specified.
#
# This script assumes that mdimage-prepare script has been executed 
# before this, successfully, and hence the necessary setup is in place.



# Chroot into the Junos image and do a snapshot to our media - 
# that's all we need.
# So effectively repartitioning is following the default partitioning
# of snapshot.
#
# User specified partition sizes can be implemented later if needed.


# Signals are already disabled in mdimage-startup, so we do not disable
# here again.

echo "Starting repartitioning operation"
chroot /mnt/junos /sbin/snapshot -T --boot -p IS_MDIMAGE_BOOT=YES compact-flash

