NEW
  PREFIX
AUTO 4,1
#!/BIN/SH
#
#  This script creates Bootable A2osX Disks.
#
#  This script will prompt the user for any needed information
#  such as version of PRODOS to include and then will verify that 
#  it has the right media and files available.
#
#  Note this is the first version of the script so it may not 
#  include the finished/polished UI that is planned.
#
#  Media Types: RELEASE, RC, STABLE, and BLEED.
#  Media Formats: 140K, 800K, and 32MB.
#
#  First we define the functions this script uses.
#
#FUNC ECHOAT
#  ECHO -N "\e[${1};${2}H${3}"
#END

ECHO "\f                A2osX Make Discs Utility"
ECHO
READ -P "Which Build Number is the Source: " BUILD
SET SOURCE = "/MAKE/BUILDS/BUILD${BUILD}"
ECHO
ECHO "\nSOURCE IS :${SOURCE}"
IF [ -Z $SOURCE ]
  ECHO "You pressed return with no choice, bad idea"
  EXIT
FI
IF [ -D $SOURCE ]
ELSE
  ECHO "Invalid Build - Exiting"
  EXIT
FI
ECHO "\nTypes: RELEASE, RC, STABLE, and BLEED\n"
READ -P "Which Type to you want to make: " TYPE
ECHO
IF [ -Z $TYPE ]
  ECHO "You pressed return with no choice, bad idea"
  EXIT
FI
SWITCH $TYPE
  CASE "release"
  CASE "Release"
  CASE "RELEASE"
    SET TYPE = "RELEASE"
    BREAK
  CASE "rc"
  CASE "Rc"
  CASE "RC"
    SET TYPE = "RC"
    BREAK
  CASE "stable"
  CASE "Stable"
  CASE "STABLE"
    SET TYPE = "STABLE"
    BREAK
  CASE "bleed"
  CASE "Bleed"
  CASE "BLEED"
    SET TYPE = "BLEED"
    BREAK
  DEFAULT
    ECHO "You entered an invalid choice"
    EXIT
END
ECHO "\nMedia: 140K, 800K and 32MB (1, 8 or 32)\n"
READ -P "Which Media to you want to make: " MEDIA
ECHO
IF [ -Z $MEDIA ]
  ECHO "You pressed return with no choice, bad idea"
  EXIT
FI
SWITCH $MEDIA
  CASE "1"
  CASE "140"
  CASE "140K"
  CASE "140k"
    SET MEDIA = "140"
    BREAK
  CASE "8"
  CASE "800"
  CASE "800K"
  CASE "800k"
    SET MEDIA = "800"
    BREAK
  CASE "32"
  CASE "32MB"
  CASE "32mb"
  CASE "32Mb"
    SET MEDIA = "32"
    BREAK
  DEFAULT
    ECHO "You entered an invalid choice"
    EXIT
END
ECHO "\nProDOS version: 2.03 or 2.42 (3 or 42)\n"
READ -P "Which ProDOS version to want installed: " PRODOS
ECHO
IF [ -Z $PRODOS ]
  ECHO "You pressed return with no choice, bad idea"
  EXIT
FI
SWITCH $PRODOS
  CASE "3"
  CASE "03"
  CASE "2.03"
    SET PRODOS = "2.03"
    BREAK
  CASE "42"
  CASE "2.42"
    SET PRODOS = "2.42"
    BREAK
  DEFAULT
    ECHO "You entered an invalid choice"
    EXIT
END
ECHO "\nPlease make sure that the ${TYPE} ${MEDIA} is online\n"
READ -P "Ready to make your disk (Y/N): " GO
ECHO
IF [ -Z $GO ]
  ECHO "You pressed return with no choice, bad idea"
  EXIT
FI
IF [ $GO = "y" ]
  SET GO = "Y"
FI
IF [ $GO = "Y" ]
ELSE
  ECHO "\nOK, Well you have a nice day. Bye!"
  EXIT
FI
SET DEST = "/${TYPE}${MEDIA}/"
# Verify that DESTINATION is ONLINE
IF [ -D $DEST ]
  ECHO "\nValid Destination Volume found"
ELSE
  ECHO "\nCould not find Valid Destination Volume - Exiting"
  EXIT
FI  
# At least check that a2osx.system is on disk.
IF [ -F ${SOURCE}/A2OSX.SYSTEM ]
ELSE
  ECHO "\nSource Directory missing SYSTEM files - Exiting"
  EXIT
FI  
#
# Lets check that there is 1 and only 1 DEST volume on line
# and get its DEV id so we can format it.
#


# Verify that ProDOS is on DEST DISK
IF [ -F ${DEST}/PRODOS ]
ELSE
  ECHO "\nDestination Volume missing ProDOS - Exiting"
  EXIT
FI  

#CP ${SOURCE} ${DEST}

MAN
TEXT /MAKE/USR/SHARE/MAKE/MAKEDISKS
