+def shrink(session):
+ d = session['dialog']
+ dev = session['device']
+
+ shrinked = 'shrinked' in session and session['shrinked'] == True
+
+ if shrinked:
+ d.msgbox("You have already shrinked your image!")
+ return
+
+ msg = "This operation will shrink the last partition of the image to " \
+ "reduce the total image size. If the last partition is a swap " \
+ "partition, then this partition is removed and the partition " \
+ "before that is shrinked. The removed swap partition will be " \
+ "recreated during image deployment."
+
+ if not d.yesno("%s\n\nDo you want to continue?" % msg, width=70,
+ height=12, title="Image Shrinking"):
+ dev.out = InfoBoxOutput(d, "Image Shrinking", height=3)
+ session['metadata']['SIZE'] = str(dev.shrink())
+ session['shrinked'] = True
+ update_background_title(session)
+ dev.out.finalize()
+
+
+def customization_menu(session):