#!/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} sudo apt-get -y install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libfreetype6-dev libpcap0.8-dev sudo apt-get -y install php-cli } # --- INSTALL GOLDENGATE installGoldenGate() { #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 -p 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() { O=${IIGS}/mountORCA.sh echo "#!/bin/bash" > "${O}" echo "IIX=${IIGS}" >> "${O}" echo "fsck.hfsplus \${IIX}/hfsDrive.img" >> "${O}" echo "IIGSDISK=\$(sudo losetup --partscan --find --show \${IIX}/hfsDrive.img)" >> "${O}" echo "sudo mount \${IIGSDISK} \${IIX}/ORCA" >> "${O}" echo "echo LOOP=\${IIGSDISK} > \${IIX}/lastMount.cfg" >> "${O}" echo "echo MOUNT=\${IIX}/ORCA >> \${IIX}/lastMount.cfg" >> "${O}" chmod +x ${O} O=${IIGS}/unmountORCA.sh echo "#!/bin/bash" > "${O}" echo "IIX=${IIGS}" >> "${O}" echo "source \${IIX}/lastMount.cfg" >> "${O}" echo "sudo umount \${MOUNT}" >> "${O}" echo "sudo losetup -d \${LOOP}" >> "${O}" echo "sudo rm \${IIX}/lastMount.cfg" >> "${O}" chmod +x ${O} fallocate -l 32M "${IIGS}/hfsDrive.img" mkfs.hfs -v IIgs "${IIGS}/hfsDrive.img" mkdir -p "${IIGS}/ORCA" ${IIGS}/mountORCA.sh sudo chown -R `id -ru`:`id -rg` "${IIGS}/ORCA" isoinfo -i "${ORCA}" -x /FOR_EMUL/BYTEWORK.S\;1 > BYTEWORKS ${IIGS}/opus-extractor -v BYTEWORKS ${IIGS}/ORCA updateOrca ORCA-C ${IIGS}/unmountORCA.sh } # --- INSTALL GSPLUS installGsPlus() { #git clone https://github.com/digarok/gsplus.git pushd gsplus/src ln -sf vars_x86linux_sdl2 vars #make if [ ! -e gsplus ]; then echo "Failed to build GSplus." exit 1 fi mkdir -p "${IIGS}/gsplus" cp -f gsplus "${IIGS}/gsplus/." popd #wget http://www.whatisthe2gs.apple2.org.za/files/rom3.zip unzip rom3.zip mv -f APPLE2GS.ROM2 "${IIGS}/gsplus/ROM.03" #wget http://www.whatisthe2gs.apple2.org.za/files/harddrive_image.zip unzip harddrive_image.zip mv -f "System 6 and Free Games.hdv" "${IIGS}/gsplus/System601.po" echo "s7d1 = System601.po\n\ng_limit_speed = 0\n" > "${IIGS}/gsplus/config.txt" } # --- MAIN mkdir -p installerWork pushd installerWork IIGS=${INSTALL}/sdks/IIgs mkdir -p "${IIGS}" #getPackages installGoldenGate installOrca installGsPlus popd