diff --git a/scripts/automatedTest.sh b/scripts/automatedTest.sh new file mode 100755 index 0000000..16c89a9 --- /dev/null +++ b/scripts/automatedTest.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +./unJoey.sh + +env time ./installer.sh \ + AUTOMATED \ + "$(pwd)/Opus ][ The Software.iso" \ + "$(pwd)/Golden Gate.msi" \ + "$(pwd)/Xcode_9.4.1.xip" diff --git a/scripts/installer.sh b/scripts/installer.sh index e5cc800..fc3e52a 100755 --- a/scripts/installer.sh +++ b/scripts/installer.sh @@ -32,6 +32,10 @@ G_SCRIPT= G_UID=$(id -ru) G_GID=$(id -rg) G_IS_INSTALLED=() +G_AUTOMATED= +G_ORCA_FILE= +G_GOLDEN_GATE_FILE= +G_XCODE_FILE= G_OSX_MIN=10.6 G_OSX_DARWIN=17 G_IIGS=0 @@ -58,15 +62,19 @@ function buildMacOSXSDK() { configWrite configRead - if [[ ! -e "${OSX}/SDK" ]]; then - tFileBrowser XCODE "Please locate your 'XCode 9.4.1' XIP" .xip .. - if [[ -z ${XCODE} || "${XCODE}" == "" ]]; then - return 0 + if [[ ! -z ${G_AUTOMATED} ]]; then + XCODE=${G_XCODE_FILE} + else + if [[ ! -e "${OSX}/SDK" ]]; then + tFileBrowser XCODE "Please locate your 'XCode 9.4.1' XIP" .xip .. + if [[ -z ${XCODE} || "${XCODE}" == "" ]]; then + return 0 + fi fi fi if [[ ! -d osxcross ]]; then - purple "Building macOS SDK - This takes FOREVER!" + purple "Building macOS SDK" git clone https://github.com/tpoechtrager/osxcross.git pushd osxcross &> /dev/null ./tools/gen_sdk_package_pbzx.sh "${XCODE}" @@ -387,16 +395,24 @@ function installIIgs() { doSudo chown ${G_UID}:${G_GID} "${IIGS}/ORCA/." if [[ ! -e "${IIGS}/ORCA/Languages/cc" ]]; then - tFileBrowser ORCA "Please locate your 'OPUS ][ The Software' ISO" .iso .. - if [[ -z ${ORCA} || "${ORCA}" == "" ]]; then - return 0 + if [[ ! -z ${G_AUTOMATED} ]]; then + ORCA=${G_ORCA_FILE} + else + tFileBrowser ORCA "Please locate your 'OPUS ][ The Software' ISO" .iso .. + if [[ -z ${ORCA} || "${ORCA}" == "" ]]; then + return 0 + fi fi fi if [[ ! -d GoldenGate ]]; then - tFileBrowser GGATE "Please locate your 'Golden Gate' MSI" .msi .. - if [[ -z ${GGATE} || "${GGATE}" == "" ]]; then - return 0 + if [[ ! -z ${G_AUTOMATED} ]]; then + GGATE=${G_GOLDEN_GATE_FILE} + else + tFileBrowser GGATE "Please locate your 'Golden Gate' MSI" .msi .. + if [[ -z ${GGATE} || "${GGATE}" == "" ]]; then + return 0 + fi fi purple "Building GoldenGate" git clone git@gitlab.com:GoldenGate/GoldenGate.git @@ -434,7 +450,7 @@ function installIIgs() { purple "Upgrading ORCA/C" fetchGitHubRelease RESULT byteworksinc ORCA-C 2mg #***TODO*** This fails with a mmap error sometimes - no idea why - "${IIGS}/opus-extractor" -v -s / ${RESULT} "${IIGS}/ORCA" + env "${IIGS}/opus-extractor" -v -s / ${RESULT} "${IIGS}/ORCA" pushd ${GOLDEN_GATE} &> /dev/null #find . -type d -exec chmod 755 {} \; @@ -753,32 +769,41 @@ function mainMenu() { # 0 ) - while [[ "${CHOICE}" != "" ]]; do - MENU=() + if [[ ! -z ${G_AUTOMATED} ]]; then for (( X=0; X<=$(( ${TOTAL}-1 )); X++ )); do - MENU+=( "${ITEMS[$X]}" ) - if [[ -e "${G_PARENT}/dist/${CHECK[$X]}" ]]; then - WHAT="Rebuild" - G_IS_INSTALLED[$X]=1 - else - WHAT="Install" - G_IS_INSTALLED[$X]=0 - fi - MENU+=( "${WHAT} ${DESC[$X]} Bit JoeyLib Library" ) - done - CHOICE=$( - set e+ - whiptail --title "${G_TITLE}" --cancel-button "Exit" --menu "" $(( ${TOTAL}+7 )) 65 ${TOTAL} "${MENU[@]}" 3>&2 2>&1 1>&3 - set e- - ) - if [[ "${CHOICE}" != "" ]]; then - doSudo - CHOICE="install${CHOICE}" + CHOICE="install${ITEMS[$X]}" echo "" tBoldBox tCYAN "NOTE: If an error is encountered, installer will exit!" ${CHOICE} - fi - done + done + else + while [[ "${CHOICE}" != "" ]]; do + MENU=() + for (( X=0; X<=$(( ${TOTAL}-1 )); X++ )); do + MENU+=( "${ITEMS[$X]}" ) + if [[ -e "${G_PARENT}/dist/${CHECK[$X]}" ]]; then + WHAT="Rebuild" + G_IS_INSTALLED[$X]=1 + else + WHAT="Install" + G_IS_INSTALLED[$X]=0 + fi + MENU+=( "${WHAT} ${DESC[$X]} Bit JoeyLib Library" ) + done + CHOICE=$( + set e+ + whiptail --title "${G_TITLE}" --cancel-button "Exit" --menu "" $(( ${TOTAL}+7 )) 65 ${TOTAL} "${MENU[@]}" 3>&2 2>&1 1>&3 + set e- + ) + if [[ "${CHOICE}" != "" ]]; then + doSudo + CHOICE="install${CHOICE}" + echo "" + tBoldBox tCYAN "NOTE: If an error is encountered, installer will exit!" + ${CHOICE} + fi + done + fi } @@ -792,6 +817,7 @@ function purple() { # --- START function start() { + local DOINSTALL=0 # This has to exist before doSudo is called mkdir -p "${G_WORK}" @@ -876,8 +902,14 @@ function start() { wget \ xcftools \ xz-utils + if [[ ! -z ${G_AUTOMATED} ]]; then + DOINSTALL=1 + fi if [[ "${MISSING}" != "" ]]; then if (whiptail --title "${G_TITLE}" --yesno "Some required packages are missing.\n\nInstall them now?" 9 40); then + DOINSTALL=1 + fi + if [[ "${DOINSTALL}" == "1" ]]; then TEMP=" ${MISSING//[^ ]}" TOTAL=${#TEMP} COUNT=0 @@ -929,5 +961,13 @@ if [[ "$1" == "ASKPASS" ]]; then doSudoAskPass fi +# Are we doing a totally automated install? +if [[ "$1" == "AUTOMATED" ]]; then + G_AUTOMATED=1 + G_ORCA_FILE=$2 + G_GOLDEN_GATE_FILE=$3 + G_XCODE_FILE=$4 +fi + # At the very end so we can stream this script from a web server. start diff --git a/scripts/unJoey.sh b/scripts/unJoey.sh new file mode 100755 index 0000000..2aae1ee --- /dev/null +++ b/scripts/unJoey.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +if [[ -e joeyDev.sh ]]; then + source joeyDev.sh +fi + +if [[ -e "${JOEY}/sdks/IIgs/lastMount.cfg" ]]; then + sudo "${JOEY}/sdks/IIgs/unmountORCA.sh" +fi + +export PATH=${HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games +export JOEY= +export JOEYPATH= +export GOLDEN_GATE= +export MACOSX_DEPLOYMENT_TARGET= +export MACOSX_DARWIN=