#!/bin/bash -e # --- COLLECT AND CHECK COMMAND LINE ARGUMENTS usage() { echo "Usage: $0 [-o PathToORCA.iso] [-i PathForInstall]" exit 1 } while getopts ":o:i:" OPT; do case ${OPT} in o ) ORCA=${OPTARG} ;; i ) INSTALL=${OPTARG} ;; \? ) echo "Invalid option: ${OPTARG}" usage ;; : ) echo "Invalid option: ${OPTARG} requires an argument" usage ;; * ) usage ;; esac done shift $((OPTIND -1)) if [ -z "${ORCA}" ] || [ -z "${INSTALL}" ]; then usage fi if [ -z "${ORCA}" ]; then echo "Must specify the location of the ORCA ISO." exit 1 fi if [ ! -e "${ORCA}" ]; then echo "Unable to locate the ORCA ISO at \"${ORCA}\"." exit 1 fi ORCA=`realpath "${ORCA}"` if [ -z "${INSTALL}" ]; then echo "Must specify the location to install the JoeyLib SDK." exit 1 fi INSTALL=`realpath "${INSTALL}"` if [ -e "${INSTALL}" ]; then echo "The specified installation path, \"${INSTALL}\" already exists." exit 1 fi # --- INSTALL NEEDED PACKAGES getPackages() { sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get -y install cmake ragel hfsplus hfsutils hfsprogs libreadline-dev libedit-dev sudo apt-get -y install build-essential git mercurial texinfo libtool autoconf automake sudo apt-get -y install gcc-multilib g++-multilib mingw-w64 gdb-mingw-w64 clang llvm-dev libxml2-dev sudo apt-get -y install uuid-dev libssl-dev bash patch make tar xz-utils bzip2 gzip sed cpio sudo apt-get -y install libpulse-dev{,:i386} libasound-dev{,:i386} } # --- INSTALL GOLDENGATE installGG() { #git clone git@gitlab.com:GoldenGate/GoldenGate.git if [ ! -d GoldenGate ]; then echo "Unable to clone the GoldenGate repository!" echo "Must be a paying member of the GoldenGate project!" echo "See: https://goldengate.gitlab.io/about/" exit 1 fi pushd GoldenGate git submodule init git submodule update PREFIX=`pwd`/installed mkdir build cd build #cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} .. | tee make.out #make | tee -a make.out if [ ! -e bin/iix ]; then echo "Failed to build GoldenGate." exit 1 fi cp -f bin/{iix,dumpobj,opus-extractor} "${IIGS}/." popd } # --- INSTALL ORCA SUITE ON HFS VOLUME updateOrca() { COMPONENT=$1 URL=`curl -s https://api.github.com/repos/byteworksinc/${COMPONENT}/releases \ | grep "browser_download_url.*2mg" \ | cut -d : -f 2,3 \ | tr -d \" \ | head -n 1` FILE=${URL##*/} wget ${URL} ${IIGS}/opus-extractor -v -s / ${FILE} ${IIGS}/ORCA } installOrca() { fallocate -l 32M "${IIGS}/hfsDrive.img" mkfs.hfs -v IIgs "${IIGS}/hfsDrive.img" IIGSDISK=$(sudo losetup --partscan --find --show "${IIGS}/hfsDrive.img") mkdir -p "${IIGS}/ORCA" sudo mount ${IIGSDISK} "${IIGS}/ORCA" sudo chown -R `id -ru`:`id -rg` "${IIGS}/ORCA" isoinfo -i "${ORCA}" -x /FOR_EMUL/BYTEWORK.S\;1 > BYTEWORK.S ${IIGS}/opus-extractor -v BYTEWORK.S ${IIGS}/ORCA updateOrca ORCA-C sudo umount "${IIGS}/ORCA" sudo losetup -d ${IIGSDISK} } # --- MAIN mkdir -p installerWork pushd installerWork IIGS=${INSTALL}/sdks/IIgs mkdir -p "${IIGS}" #getPackages installGG installOrca popd