diff --git a/.github/workflows/validate-library-downloads.yml b/.github/workflows/validate-library-downloads.yml index 42ab6804e40..a1b44193b1b 100644 --- a/.github/workflows/validate-library-downloads.yml +++ b/.github/workflows/validate-library-downloads.yml @@ -15,3 +15,5 @@ jobs: - run: bash -n scripts/dev/download_libs.sh scripts/dev/downloader.sh scripts/dev/sha_verify.sh - run: bash scripts/dev/tests/test-download-validation.sh - run: bash scripts/dev/tests/test-download-vs-switch.sh + - run: bash -n scripts/dev/download_pg.sh scripts/linux/download_projectGenerator.sh scripts/osx/download_projectGenerator.sh scripts/vs/download_projectGenerator.sh scripts/of.sh + - run: python3 scripts/dev/tests/test-download-pg.py diff --git a/docs/linux.md b/docs/linux.md index dfd84a2b631..dc7d33f66a9 100644 --- a/docs/linux.md +++ b/docs/linux.md @@ -44,6 +44,13 @@ cd OF/scripts/linux which will compile the command line version of the project generator and install it in your system so you can create projects from anywhere, it'll also make it possible to use the gui tool which is present in the root of the OF folder. +Prebuilt projectGenerator +------------------------ + +`of update pg` downloads the GUI and its bundled CLI. On x64, Ubuntu 22.04 and Jammy-based derivatives use `projectGenerator-linux-ubuntu22-gui.gz`; other x64 hosts use `projectGenerator-linux-gui.gz`. ARM64 hosts, including 64-bit Raspberry Pi systems, use `projectGenerator-linux-arm64-gui.gz`. + +The GUI is installed at `projectGenerator/projectGenerator` and the CLI at `projectGenerator/projectGeneratorCmd`. The release's `.tar.bz2` archives contain only the standalone CLI and are not needed for this installation. For 32-bit Raspberry Pi targets without prebuilt GUI packages, use `compilePG.sh` to build the CLI. + Linking prebuilt libraries: "recompile with -fPIE" --------------------------------------------------- diff --git a/scripts/dev/download_pg.sh b/scripts/dev/download_pg.sh index f7cd4dc4950..796223fdeeb 100755 --- a/scripts/dev/download_pg.sh +++ b/scripts/dev/download_pg.sh @@ -16,7 +16,7 @@ cat << EOF Options: -v, --version VERSION OF version to download the libraries for. Defaults to master - -p, --platform PLATFORM Platform among: android, emscripten, ios, linux, linux64, linuxarmv6l, linuxarmv7l, msys2, osx, tvos, vs + -p, --platform PLATFORM Platform among: linux, msys2, osx, macos, vs If not specified tries to autodetect the platform -s, --silent Silent download progress -h, --help Shows this message @@ -44,26 +44,26 @@ download(){ } -# trap any script errors and exit -trap 'trapError ${LINENO}' ERR -trap "trapError" SIGINT SIGTERM - -trapError() { - local parent_lineno="$1" - if [[ "$#" = "3" ]] ; then - local message="$2" - local code="${3:-1}" - echo "Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}" - else - local code="${2:-1}" - echo "Error on or near line ${parent_lineno}; exiting with status ${code}" +linuxPGVariant() ( + local ID="" VERSION_ID="" VERSION_CODENAME="" UBUNTU_CODENAME="" + local root="${OF_PG_PROBE_ROOT:-}" + [[ -r "$root/etc/os-release" ]] || return 0 + . "$root/etc/os-release" + if [[ "$UBUNTU_CODENAME" == "jammy" || "$VERSION_CODENAME" == "jammy" || ( "$ID" == "ubuntu" && "$VERSION_ID" == 22.04* ) ]]; then + printf '%s' '-ubuntu22' fi +) - if [ -e openFrameworksLibs* ]; then - echo "removing packages" - rm openFrameworksLibs* - fi - exit "${code}" +trap 'trapError "$LINENO" "$?"' ERR +trap 'trapError "$LINENO" 130' SIGINT +trap 'trapError "$LINENO" 143' SIGTERM + +trapError() { + local parent_lineno="${1:-unknown}" + local code="${2:-1}" + trap - ERR SIGINT SIGTERM + echo "Error on or near line ${parent_lineno}; exiting with status ${code}" >&2 + exit "$code" } @@ -161,86 +161,70 @@ cd "$SCRIPT_DIR" OUTDIR=../../ -ZIP="zip" -if [[ $BLEEDING_EDGE = 1 ]] ; then - VER=latest -fi - -if [[ $TAG != "" ]] ; then - VER="$TAG" -fi - -if [ "$PLATFORM" == "linux" ]; then - ZIP="tar.bz2" -fi -if [ "$PLATFORM" == "vs" ]; then - EXT=".exe" -else - EXT=".app" -fi - OUTPUT=projectGenerator -if [ "$PLATFORM" == "msys2" ] || [ "$PLATFORM" == "vs" ]; then - GUI="-gui" -else - GUI="" -fi -PKG="projectGenerator-${PLATFORM}${GUI}.${ZIP}" -echo " openFrameworks download_pg.sh" +case "$PLATFORM" in + linux) + case "$ARCH" in + x86_64|amd64|64) PKG="projectGenerator-linux$(linuxPGVariant)-gui.gz" ;; + aarch64|arm64) PKG="projectGenerator-linux-arm64-gui.gz" ;; + *) echo "No Linux projectGenerator GUI release for architecture: $ARCH" >&2; exit 1 ;; + esac + ;; + vs|msys2) PKG="projectGenerator-vs-gui.zip" ;; + osx|macos) PKG="projectGenerator-osx.zip" ;; + *) echo "Unsupported projectGenerator platform: $PLATFORM" >&2; exit 1 ;; +esac +echo " openFrameworks download_pg.sh" cd ../../ -mkdir -p libs -cd libs - -mkdir -p download -cd download - -download $PKG - -if [ -d "${OUTDIR}/${OUTPUT}" ] || [ -f "${OUTDIR}/${OUTPUT}" ]; then - rm -rf "${OUTDIR}/${OUTPUT}" -fi - -echo " Uncompressing Project Generator for [$PLATFORM] from [$PKG] to [${OUTDIR}/${OUTPUT}]" -if [ "$PLATFORM" == "msys2" ] || [ "$PLATFORM" == "vs" ]; then - unzip -q "$PKG" -d "${OUTDIR}/${OUTPUT}" - #rm $PKG -else - mkdir -p "${OUTDIR}${OUTPUT}" - tar xjf "$PKG" -C "${OUTDIR}${OUTPUT}" - if [ "$PLATFORM" == "osx" ]; then - mv "${OUTDIR}/${OUTPUT}/projectGenerator-osx/projectGenerator$EXT" "${OUTDIR}/${OUTPUT}/projectGenerator$EXT" - rm -rf "${OUTDIR}/${OUTPUT}/projectGenerator-osx/" - fi -fi +mkdir -p libs/download +cd libs/download + +download "$PKG" + +PG_STAGE=$(mktemp -d "${OUTDIR}/${OUTPUT}.XXXXXX") +trap 'rm -rf "$PG_STAGE"' EXIT +echo " Uncompressing Project Generator for [$PLATFORM] from [$PKG]" +case "$PLATFORM" in + linux) + tar -xzf "$PKG" --strip-components=1 -C "$PG_STAGE" + RESOURCES="$PG_STAGE/resources" + GUI_BIN="$PG_STAGE/projectGenerator" + CLI_NAME=projectGenerator + CLI_DEST="$PG_STAGE/projectGeneratorCmd" + ;; + vs|msys2) + unzip -q "$PKG" -d "$PG_STAGE" + RESOURCES="$PG_STAGE/resources" + GUI_BIN="$PG_STAGE/projectGenerator.exe" + CLI_NAME=projectGenerator.exe + CLI_DEST="$PG_STAGE/projectGeneratorCmd.exe" + ;; + osx|macos) + unzip -q "$PKG" -d "$PG_STAGE" + if [ -d "$PG_STAGE/projectGenerator-osx/projectGenerator.app" ]; then + mv "$PG_STAGE/projectGenerator-osx/projectGenerator.app" "$PG_STAGE/projectGenerator.app" + rm -rf "$PG_STAGE/projectGenerator-osx" + fi + RESOURCES="$PG_STAGE/projectGenerator.app/Contents/Resources" + GUI_BIN="$PG_STAGE/projectGenerator.app/Contents/MacOS/projectGenerator" + CLI_NAME=projectGenerator + CLI_DEST="$PG_STAGE/projectGenerator" + ;; +esac -if [ "$PLATFORM" == "msys2" ] || [ "$PLATFORM" == "vs" ]; then - if ! command -v rsync &> /dev/null; then - cp -ar "${OUTDIR}/${OUTPUT}/resources/app/app/projectGenerator.exe" "${OUTDIR}/${OUTPUT}/projectGeneratorCmd.exe" - else - rsync -avzp "${OUTDIR}/${OUTPUT}/resources/app/app/projectGenerator.exe" "${OUTDIR}/${OUTPUT}/projectGeneratorCmd.exe" - fi - # if command -v chmod &> /dev/null; then - chmod +x "${OUTDIR}/${OUTPUT}/projectGeneratorCmd.exe" - chmod +x "${OUTDIR}/${OUTPUT}/resources/app/app/projectGenerator.exe" - # else - # echo "Warning: chmod command not found, skipping permission adjustment." - # fi -elif [ "$PLATFORM" == "linux" ]; then - chmod +x "${OUTDIR}/${OUTPUT}/projectGenerator" -else - if ! command -v rsync &> /dev/null; then - cp -arX "${OUTDIR}/${OUTPUT}/projectGenerator$EXT/Contents/Resources/app/app/projectGenerator" "${OUTDIR}/${OUTPUT}/projectGenerator" - else - rsync -avzp "${OUTDIR}/${OUTPUT}/projectGenerator$EXT/Contents/Resources/app/app/projectGenerator" "${OUTDIR}/${OUTPUT}/projectGenerator" - fi - # if command -v chmod &> /dev/null; then - chmod +x "${OUTDIR}/${OUTPUT}/projectGenerator" - chmod +x "${OUTDIR}/${OUTPUT}/projectGenerator$EXT/Contents/MacOS/projectGenerator" - # else - # echo "Warning: chmod command not found, skipping permission adjustment." - # fi +CLI="" +for candidate in \ + "$RESOURCES/app.asar.unpacked/app/$CLI_NAME" \ + "$RESOURCES/app/app/$CLI_NAME"; do + if [ -f "$candidate" ]; then CLI="$candidate"; break; fi +done +if [[ ! -f "$GUI_BIN" || -z "$CLI" ]]; then + echo "ProjectGenerator package for $PLATFORM is missing the GUI or bundled CLI" >&2 + exit 1 fi - -echo " ------ " +cp "$CLI" "$CLI_DEST" +chmod +x "$GUI_BIN" "$CLI_DEST" "$CLI" +rm -rf "${OUTDIR}/${OUTPUT}" +mv "$PG_STAGE" "${OUTDIR}/${OUTPUT}" echo " openFrameworks download projectGenerator and install complete!" diff --git a/scripts/dev/tests/test-download-pg.py b/scripts/dev/tests/test-download-pg.py new file mode 100644 index 00000000000..7f2d4d2488f --- /dev/null +++ b/scripts/dev/tests/test-download-pg.py @@ -0,0 +1,224 @@ +#!/usr/bin/env python3 +"""Exercise desktop GUI installation and menu discovery without network downloads.""" +import json +import os +from pathlib import Path +import shutil +import subprocess +import tarfile +import tempfile +import zipfile + + +ROOT = Path(__file__).resolve().parents[3] + + +def main(): + with tempfile.TemporaryDirectory(prefix="of pg ") as temporary: + temp = Path(temporary) + tree = temp / "of with spaces" + shutil.copytree(ROOT / "scripts", tree / "scripts") + wrapper = tree / "scripts/linux/download_projectGenerator.sh" + wrapper.chmod(0o755) + requests = temp / "requests" + gui_marker = temp / "gui-ran" + probe = temp / "host-root" + (probe / "etc").mkdir(parents=True) + os_release = probe / "etc/os-release" + os_release.write_text('ID=ubuntu\nVERSION_ID="24.04"\nVERSION_CODENAME=noble\n') + env = dict(os.environ, PLATFORM="linux", BITS="64", OF_ANIM="0", + OF_NONINTERACTIVE="1", REQUESTS=str(requests), + OF_PG_PROBE_ROOT=str(probe), + GUI_EXEC_MARKER=str(gui_marker)) + env.pop("OF_LANG", None) + env.pop("OF_I18N_DIR", None) + (tree / "scripts/dev/downloader.sh").write_text( + 'downloader() { printf "%s\\n" "$1" >> "$REQUESTS"; ' + 'if [ -n "${PG_DOWNLOAD_SIGNAL:-}" ]; then kill -TERM $$; fi; ' + 'if [ -n "${PG_DOWNLOAD_FAIL:-}" ]; then return "$PG_DOWNLOAD_FAIL"; fi; ' + 'cp "$PG_FIXTURE" "${1##*/}"; }\n') + installed = tree / "projectGenerator" + cli_source = '#!/usr/bin/env bash\necho \'{"openFrameworks projectGenerator":"fixture-cli"}\'\n' + + def run(args, success=True): + result = subprocess.run(args, env=env, text=True, capture_output=True, + stdin=subprocess.DEVNULL, timeout=30) + assert (result.returncode == 0) == success, result.stdout + result.stderr + return result + + def fixture(layout="asar", with_cli=True, platform="linux", flat_mac=False): + source = temp / "bundle" + shutil.rmtree(source, ignore_errors=True) + source.mkdir() + if platform in ("osx", "macos"): + resources = source / "projectGenerator.app/Contents/Resources" + gui = source / "projectGenerator.app/Contents/MacOS/projectGenerator" + else: + resources = source / "resources" + gui = source / ("projectGenerator" if platform == "linux" else "projectGenerator.exe") + gui.parent.mkdir(parents=True, exist_ok=True) + gui.write_text( + '#!/usr/bin/env bash\necho ran > "$GUI_EXEC_MARKER"\nexit 99\n') + cli_name = "projectGenerator.exe" if platform in ("vs", "msys2") else "projectGenerator" + if layout == "asar": + resources.mkdir(parents=True, exist_ok=True) + (resources / "app.asar").write_text("archive") + cli = resources / "app.asar.unpacked/app" / cli_name + else: + cli = resources / "app/app" / cli_name + cli.parent.mkdir(parents=True, exist_ok=True) + if with_cli: + cli.write_text(cli_source) + archive = temp / ("fixture.gz" if platform == "linux" else "fixture.zip") + if platform == "linux": + with tarfile.open(archive, "w:gz") as bundle: + bundle.add(source, arcname="projectGenerator-0.122.0-linux") + else: + prefix = Path("projectGenerator-osx") if platform in ("osx", "macos") and not flat_mac else Path() + with zipfile.ZipFile(archive, "w", zipfile.ZIP_DEFLATED) as bundle: + for entry in source.rglob("*"): + bundle.write(entry, str(prefix / entry.relative_to(source))) + env["PG_FIXTURE"] = str(archive) + + def version(): + result = run(["bash", str(tree / "scripts/of.sh"), "version", "pg", "--json"]) + assert not gui_marker.exists(), "Status/version launched the GUI" + return json.loads(result.stdout)["data"] + + fixture() + for arch, package in [("x86_64", "projectGenerator-linux-gui.gz"), + ("64", "projectGenerator-linux-gui.gz"), + ("arm64", "projectGenerator-linux-arm64-gui.gz"), + ("aarch64", "projectGenerator-linux-arm64-gui.gz")]: + run(["bash", str(tree / "scripts/dev/download_pg.sh"), + "-p", "linux", "-a", arch, "-t", "fixture-tag"]) + assert requests.read_text().splitlines()[-1].endswith("/fixture-tag/" + package) + for binary in ["projectGenerator", "projectGeneratorCmd", + "resources/app.asar.unpacked/app/projectGenerator"]: + assert os.access(installed / binary, os.X_OK), binary + assert version()["version"] == "fixture-cli" + print("PASS x64/ARM64 GUI packages, architecture aliases, executables and CLI version") + + for release, ubuntu22 in [ + ('ID=ubuntu\nVERSION_ID="22.04"\nVERSION_CODENAME=jammy\n', True), + ('ID=ubuntu\nVERSION_ID="22.04"\n', True), + ('ID=linuxmint\nVERSION_ID="21.3"\nUBUNTU_CODENAME=jammy\nVERSION_CODENAME=virginia\n', True), + ('ID=pop\nVERSION_ID="22.04"\nVERSION_CODENAME=jammy\n', True), + ('ID=ubuntu\nVERSION_ID="24.04"\nVERSION_CODENAME=noble\n', False), + ('ID=debian\nVERSION_ID="12"\nVERSION_CODENAME=bookworm\n', False), + ]: + os_release.write_text(release) + run(["bash", str(wrapper)]) + package = "projectGenerator-linux-ubuntu22-gui.gz" if ubuntu22 else "projectGenerator-linux-gui.gz" + assert requests.read_text().splitlines()[-1].endswith("/" + package) + assert version()["version"] == "fixture-cli" + os_release.write_text('ID=ubuntu\nVERSION_ID="22.04"\nVERSION_CODENAME=jammy\n') + run(["bash", str(tree / "scripts/dev/download_pg.sh"), "-p", "linux", "-a", "arm64"]) + assert requests.read_text().splitlines()[-1].endswith("/projectGenerator-linux-arm64-gui.gz") + os_release.unlink() + run(["bash", str(wrapper)]) + assert requests.read_text().splitlines()[-1].endswith("/projectGenerator-linux-gui.gz") + os_release.write_text('ID=ubuntu\nVERSION_ID="24.04"\nVERSION_CODENAME=noble\n') + print("PASS Ubuntu 22.04/Jammy derivatives select Ubuntu22 GUI; other x64 hosts and ARM64 retain their packages") + + (installed / "projectGeneratorCmd").unlink() + assert version()["path"].endswith("resources/app.asar.unpacked/app/projectGenerator") + (installed / "resources/app.asar.unpacked/app/projectGenerator").unlink() + assert version()["installed"] is False + print("PASS bundled ASAR CLI discovery; GUI-only install never runs as CLI") + + fixture("legacy") + run(["bash", str(wrapper), "-t", "legacy-tag"]) + (installed / "projectGeneratorCmd").unlink() + assert version()["path"].endswith("resources/app/app/projectGenerator") + print("PASS older unpacked GUI layout and wrapper arguments with spaces in checkout path") + + sentinel = installed / "preserve" + sentinel.write_text("existing install") + fixture(with_cli=False) + args = ["bash", str(tree / "scripts/dev/download_pg.sh"), "-p", "linux", "-a", "64"] + run(args, success=False) + assert sentinel.read_text() == "existing install" + (temp / "fixture.gz").write_text("invalid archive") + run(args, success=False) + assert sentinel.exists() + assert not list(tree.glob("projectGenerator.*")), "Staging directory leaked" + before = requests.read_text() + run(args[:-1] + ["armv7l"], success=False) + assert requests.read_text() == before and sentinel.exists() + print("PASS incomplete/corrupt packages and unsupported CPUs preserve the installed generator") + + fixture() + shutil.rmtree(installed) + installed.mkdir() + cli = installed / "projectGenerator" + cli.write_text(cli_source) + cli.chmod(0o755) + before = requests.read_text() + command = ["bash", str(tree / "scripts/of.sh"), "update", "pg"] + run(command) + assert requests.read_text() != before, "Menu skipped the CLI-only install" + assert (installed / "resources/app.asar").exists() + assert version()["version"] == "fixture-cli" + before = requests.read_text() + run(command) + assert requests.read_text() == before, "Complete install downloaded again" + result = run(["bash", str(tree / "scripts/of.sh"), "version", "--json"]) + assert json.loads(result.stdout)["data"]["cli"] == "0.7.1" + print("PASS of update pg upgrades CLI-only installs, skips complete installs, reports 0.7.1") + + for platform in ("osx", "vs", "msys2", "macos"): + env["PLATFORM"] = "osx" if platform == "macos" else platform + args = ["bash", str(tree / "scripts/dev/download_pg.sh"), "-p", platform, "-a", "64"] + for layout in ("asar", "legacy"): + fixture(layout, platform=platform) + if platform in ("osx", "vs"): + run(["bash", str(tree / "scripts" / platform / "download_projectGenerator.sh")]) + else: + run(args) + is_mac = platform in ("osx", "macos") + package = "projectGenerator-osx.zip" if is_mac else "projectGenerator-vs-gui.zip" + assert requests.read_text().splitlines()[-1].endswith("/" + package) + copy = installed / ("projectGenerator" if is_mac else "projectGeneratorCmd.exe") + assert os.access(copy, os.X_OK) + assert version()["version"] == "fixture-cli" + copy.unlink() + nested = "Contents/Resources/" if is_mac else "resources/" + assert nested in version()["path"] + assert version()["version"] == "fixture-cli" + sentinel = installed / "preserve" + sentinel.write_text("keep") + fixture(with_cli=False, platform=platform) + run(args, success=False) + assert sentinel.read_text() == "keep" + Path(env["PG_FIXTURE"]).write_text("corrupt ZIP") + run(args, success=False) + assert sentinel.exists() + assert not list(tree.glob("projectGenerator.*")) + print("PASS macOS/Windows/MSYS2 ASAR and legacy ZIPs, CLI discovery and failed-install preservation") + + fixture(platform="osx", flat_mac=True) + run(["bash", str(tree / "scripts/dev/download_pg.sh"), "-p", "osx"]) + env["PLATFORM"] = "osx" + assert version()["version"] == "fixture-cli" + print("PASS macOS ZIP with app bundle at archive root") + + cache = tree / "libs/download" + libraries = [cache / "openFrameworksLibs_first.tar.bz2", cache / "openFrameworksLibs_second.tar.bz2"] + for library in libraries: + library.write_text("cached library") + env["PG_DOWNLOAD_FAIL"] = "22" + result = run(["bash", str(tree / "scripts/dev/download_pg.sh"), "-p", "osx"], success=False) + assert result.returncode == 22 + assert "too many arguments" not in result.stdout + result.stderr + env.pop("PG_DOWNLOAD_FAIL") + env["PG_DOWNLOAD_SIGNAL"] = "TERM" + result = run(["bash", str(tree / "scripts/dev/download_pg.sh"), "-p", "osx"], success=False) + assert result.returncode == 143 + assert all(library.read_text() == "cached library" for library in libraries) + assert version()["version"] == "fixture-cli" + print("PASS download errors and interrupts preserve exit codes, cached libraries and installed generator") + + +if __name__ == "__main__": + main() diff --git a/scripts/i18n/strings.tsv b/scripts/i18n/strings.tsv index 998a24250d6..03948320162 100644 --- a/scripts/i18n/strings.tsv +++ b/scripts/i18n/strings.tsv @@ -250,6 +250,7 @@ msg.path_required_folder_inside path required (a folder inside %s) msg.path_s_could_not_be_removed %s path(s) could not be removed (permissions, or in use) — see the lines marked ✗ msg.path_s_for_platform_skipped_git %s %s path(s) for platform %s · skipped %s (git-tracked) · %s failed · %s %s msg.pg pg +msg.pg_gui_missing CLI found, GUI missing — re-run: of update pg msg.pg_installed_download_latest_anyway PG installed (%s). Download latest anyway? msg.pg_ok_skip_already PG ok — skip (already %s) msg.pg_path pg path diff --git a/scripts/linux/download_projectGenerator.sh b/scripts/linux/download_projectGenerator.sh index 591d837ce35..09aa2ad6c16 100644 --- a/scripts/linux/download_projectGenerator.sh +++ b/scripts/linux/download_projectGenerator.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $SCRIPT_DIR +cd "$SCRIPT_DIR" if [ ! -z ${BITS+x} ]; then - ../dev/download_pg.sh -p linux -a $BITS -n $@ + ../dev/download_pg.sh -p linux -a "$BITS" -n "$@" else - ../dev/download_pg.sh -p linux $@ + ../dev/download_pg.sh -p linux "$@" fi diff --git a/scripts/of.sh b/scripts/of.sh index aa42a55d3a8..6efab4f7aa4 100755 --- a/scripts/of.sh +++ b/scripts/of.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # of.sh - openFrameworks CLI | Dan Rosser 2025 -OF_SCRIPT_VERSION=0.7.0 +OF_SCRIPT_VERSION=0.7.1 # --json / --api: machine-readable mode. Exactly one JSON document goes to the # original stdout (fd 8); the usual human text goes to stderr; colours, spinners @@ -463,8 +463,11 @@ findPGBinary(){ for p in \ "${root}/projectGeneratorCmd.exe" \ "${root}/projectGeneratorCmd" \ + "${root}/resources/app.asar.unpacked/app/projectGenerator.exe" \ + "${root}/resources/app.asar.unpacked/app/projectGenerator" \ "${root}/resources/app/app/projectGenerator.exe" \ "${root}/resources/app/app/projectGenerator" \ + "${root}/projectGenerator.app/Contents/Resources/app.asar.unpacked/app/projectGenerator" \ "${root}/projectGenerator.app/Contents/Resources/app/app/projectGenerator" \ "${root}/projectGenerator" do @@ -475,8 +478,11 @@ findPGBinary(){ case "$p" in */Contents/MacOS/projectGenerator) continue ;; */projectGenerator.exe) - # root-level .exe is the GUI; only accept under resources/app/app/ - [[ "$p" == */resources/app/app/projectGenerator.exe ]] || continue + # Root-level .exe is the GUI; accept only a bundled CLI. + [[ "$p" == */resources/app/app/projectGenerator.exe || "$p" == */resources/app.asar.unpacked/app/projectGenerator.exe ]] || continue + ;; + "${root}/projectGenerator") + [[ -f "${root}/resources/app.asar" || -d "${root}/resources/app" ]] && continue ;; esac printf '%s' "$p" @@ -499,6 +505,10 @@ findPGGui(){ do [[ -e "$p" ]] && { printf '%s' "$p"; return 0; } done + if [[ -f "${root}/projectGenerator" && ( -f "${root}/resources/app.asar" || -d "${root}/resources/app" ) ]]; then + printf '%s' "${root}/projectGenerator" + return 0 + fi done return 1 } @@ -1349,6 +1359,11 @@ assessPGState(){ fi return 0 fi + if [[ "$OF_PLATFORM" == "linux" ]] && ! findPGGui >/dev/null; then + PG_STATE="missing" + PG_STATE_DETAIL="$(t msg.pg_gui_missing "CLI found, GUI missing — re-run: of update pg")" + return 0 + fi ver=$(readPGVersion) || ver="installed" PG_STATE="ok" PG_STATE_DETAIL="$ver" diff --git a/scripts/osx/download_projectGenerator.sh b/scripts/osx/download_projectGenerator.sh index 8f6125f5ab3..e416066a346 100755 --- a/scripts/osx/download_projectGenerator.sh +++ b/scripts/osx/download_projectGenerator.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $SCRIPT_DIR +cd "$SCRIPT_DIR" if [ ! -z ${BITS+x} ]; then - ../dev/download_pg.sh -p osx -a $BITS -n $@ + ../dev/download_pg.sh -p osx -a "$BITS" -n "$@" else - ../dev/download_pg.sh -p osx $@ + ../dev/download_pg.sh -p osx "$@" fi diff --git a/scripts/vs/download_projectGenerator.sh b/scripts/vs/download_projectGenerator.sh index d632963a8cf..c29cd523228 100755 --- a/scripts/vs/download_projectGenerator.sh +++ b/scripts/vs/download_projectGenerator.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $SCRIPT_DIR +cd "$SCRIPT_DIR" if [ ! -z ${BITS+x} ]; then - ../dev/download_pg.sh -p vs -a $BITS -n $@ + ../dev/download_pg.sh -p vs -a "$BITS" -n "$@" else - ../dev/download_pg.sh -p vs $@ + ../dev/download_pg.sh -p vs "$@" fi