This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
Jessist/Builds/AllBuilds.sh
2022-06-18 13:05:48 +02:00

118 lines
3.7 KiB
Bash
Executable file

#!/usr/bin/bash
echo "" &> AllBuilds.log
function log(){
if [ ! "$1" == "" ]; then
if [ "$1" == "echo" ]; then
echo -e "$2" &>> AllBuilds.log
elif [ "$1" == "exec" ]; then
echo "EXEC> $2" &>> AllBuilds.log
$2 &>> AllBuilds.log
fi
fi
}
echo "Jessist Build Tool (JBT)"
log "echo" "Jessist Build Tool (JBT)"
echo "=> Removing files"
log "echo" "=> Removing files"
log "exec" "rm -rf AllBuilds/*"
if [ ! "$1" == "regenerate" ]; then
log "exec" "rm -rf Linux/*"
log "exec" "rm -rf Windows/*"
log "exec" "rm -rf HTML/*"
log "exec" "rm -rf macOS/*"
echo "=> Waiting for Godot exports"
fi
while true;do
if [ -f "Linux/Jessist.x86_64" ] && [ -f "Windows/Jessist.exe" ] && [ -f "HTML/Jessist.html" ] && [ -f "macOS/Jessist.macOS.zip" ];then
break
fi
done
echo "=> Creating directory structure"
log "echo" "=> Creating directory structure"
log "exec" "mkdir AllBuilds/downloads -p"
echo "=> Creating zip packages"
log "echo" "=> Creating zip packages"
echo "==> Creating Linux zip package"
log "echo" "==> Creating Linux zip package"
log "exec" "cd Linux"
log "exec" "zip -r -v Linux.zip *"
echo "==> Creating Windows zip package"
log "echo" "==> Creating Windows zip package"
log "exec" "cd ../Windows"
log "exec" "zip -r -v Windows.zip *"
echo "=> Creating USB zip"
log "echo" "=> Creating USB zip"
log "exec" "mkdir ../.tmp -p"
log "exec" "cd ../.tmp"
log "exec" "mkdir lin win mac html -p"
echo "==> Copying files"
log "echo" "==> Copying files"
log "exec" "cp ../Linux/* lin/"
log "exec" "cp ../Windows/* win/"
log "exec" "cp ../macOS/Jessist.macOS.zip mac/Jessist.app"
log "exec" "cp ../../Images/icon.png icon.png"
log "exec" "cp ../../Images/icon.ico icon.ico"
echo "==> Creating autorun"
log "echo" "==> Creating autorun"
echo "
[AutoRun]
open=win/Jessist.exe
icon=icon.ico
label=Jessist
" &> autorun.inf
echo "
#!/usr/bin/bash
clear
echo \"-------\"
echo \"Jessist\"
echo \"-------\"
echo \"Please select your operating system\"
echo \"ID | Operating system\"
echo \"01 | Linux\"
echo \"02 | macOS\"
read \"-r\" \"osid\"
if [ \"\$osid\" == \"01\" ]; then
echo \"Starting Jessist for Linux\"
lin/Jessist.x86_64
elif [ \"\$osid\" == \"02\" ]; then
echo \"Starting Jessist for macOS\"
mac/Jessist.app
else
echo \"Invalid operating system.\"
sleep \"3s\"
exit
fi
" &> starter.sh
echo "==> Creating zip"
log "exec" "zip -r -v USB.zip *"
log "exec" "cd ../"
echo "=> Copying files"
log "echo" "=> Copying files"
echo "==> Copying HTML files"
log "echo" "==> Copying HTML files"
log "exec" "cp HTML/* AllBuilds/ -r"
echo "===> Renaming Jessist.html to index.php"
log "echo" "===> Renaming Jessist.html to index.php"
log "exec" "mv AllBuilds/Jessist.html AllBuilds/index.php"
echo "==> Copying macOS zip package"
log "echo" "==> Copying macOS zip package"
log "exec" "cp macOS/Jessist.macOS.zip AllBuilds/downloads/macos.zip"
echo "==> Copying Linux zip package"
log "echo" "==> Copying Linux zip package"
log "exec" "cp Linux/Linux.zip AllBuilds/downloads/linux.zip"
echo "==> Copying Windows zip package"
log "echo" "==> Copying Windows zip package"
log "exec" "cp Windows/Windows.zip AllBuilds/downloads/windows.zip"
echo "==> Copying USB zip package"
log "echo" "==> Copying USB zip package"
log "exec" "cp .tmp/USB.zip AllBuilds/downloads/usb.zip"
echo "=> Creating zip package"
log "echo" "=> Creating zip package"
log "exec" "cd AllBuilds"
log "exec" "zip -r -v Jessist.zip *"
log "exec" "cd .."
echo "=> Removing temporary files"
log "echo" "=> Removing temporary files"
log "exec" "rm -rf .tmp"
log "echo" "=> Jessist Build Tool (JBT) is done\n You can now find the complete zip file in AllBuilds/Jessist.zip"
echo "-e" "=> Jessist Build Tool (JBT) is done\n You can now find the complete zip file in AllBuilds/Jessist.zip"