#!/bin/bash #rev 2016-01-25-02:31 echo "Thanks to neuroacid, Google.com, AskUbuntu.com, stackoverflow.com" #Loop for entering/exiting recursive directories CDIR=$(pwd) rm $CDIR/01/BIN/RMENU/LIST.INI # Deleting old list.ini # Starting with LIST.INI creation # setting the first line of LIST.INI (RMENU) echo "Creating de RMENU entrace for LIST.INI" T=01.title=RMENU DI=01.disc=1/1 R=01.region=JTUE V=01.version=V0.1.3 DA=01.date=20151205 printf "$T\r\n$DI\r\n$R\r\n$V\r\n$DA\r\n" >> $CDIR/01/BIN/RMENU/LIST.INI # Starting the hard work for i in $(find . -maxdepth 1 -type d | sort | sed -e "1d;2d;3d"); do DIR=${i%:} # Strip ':' cd $DIR BASENAME=`basename $(pwd)` #Folder number if [ "$(ls -A)" ]; then #Extracting values TITLE=`xxd -s 112 -l 35 -ps *.img | xxd -r -p | sed -e "s/\( \)*/\1/g"` DISC=`xxd -s 75 -l 3 -ps *.img | xxd -r -p | sed -e "s/\( \)*/\1/g"` REGION=`xxd -s 80 -l 10 -ps *.img | xxd -r -p | sed -e "s/\( \)*/\1/g"` VERSION=`xxd -s 59 -l 5 -ps *.img | xxd -r -p | sed -e "s/\( \)*/\1/g"` DATE=`xxd -s 64 -l 8 -ps *.img | xxd -r -p` #Feeding vars T=$BASENAME.title=$TITLE DI=$BASENAME.disc=$DISC R=$BASENAME.region=$REGION V=$BASENAME.version=$VERSION DA=$BASENAME.date=$DATE #Printing game directory info printf "$T\r\n$DI\r\n$R\r\n$V\r\n$DA\r\n" >> $CDIR/01/BIN/RMENU/LIST.INI printf "$DIR:$TITLE($DISC)($REGION)\r\n" # read -p "Press [Enter] key to start backup..." else #empty folders T=$BASENAME.title=EMPTY\ FOLDER DI=$BASENAME.disc=1/1 R=$BASENAME.region= V=$BASENAME.version= DA=$BASENAME.date= printf "$T\r\n$DI\r\n$R\r\n$V\r\n$DA\r\n" >> $CDIR/01/BIN/RMENU/LIST.INI # echo $DIR " is empty" fi cd $CDIR done #Creating the iso echo "Ready to make de RMENU ISO" echo "Entering to 01 DIR" cd $CDIR/01/BIN/RMENU echo "Making the ISO" mkisofs -quiet -sysid "SEGA SATURN" -V "RMENU" -volset "RMENU" -publisher "SEGA ENTERPRISES, LTD." -p "SEGA ENTREPRISES, LTD." -A "RMENU" -abstract "ABS.TXT" -copyright "CPY.TXT" -biblio "BIB.TXT" -G IP.BIN -l -input-charset iso8859-1 -o $CDIR/01/RMENU.iso $CDIR/01/BIN/RMENU/ ls -lh $CDIR/01/*.iso