export recovery_interface="/proc/$$/fd/$2"

ui_print() {
	# tabs are bad for Twrp output
	for string in "${@//	/ }"; do
		echo "ui_print $string " > $recovery_interface
		echo "ui_print " > $recovery_interface
	done
}

ui_print "########################################"
ui_print "#     Legacy To Dynamic Converter      #"
ui_print "#           By @raphael_alpha          #"
ui_print "########################################"
ui_print " "

ui_print "Converting Legacy To Retrofit Dynamic"
simg2img $INSTALLER/cache/super_cust.img  /dev/block/by-name/cust 
simg2img $INSTALLER/cache/super_system.img /dev/block/by-name/system  
simg2img $INSTALLER/cache/super_vendor.img /dev/block/by-name/system  

ui_print " "
ui_print "Done Converting From Legacy to Retrofit Dynamic"
ui_print "*** NOTE: Now system and vendor partitions are empty. DO NOT BOOT TO SYSTEM! ***"