#!/bin/sh # Keep execution inside a function so an incomplete download cannot start setup. revcode_install() ( umask 077 fail() { printf '{"code":"service_installer_launch_failed","category":"validation","message":"RevCode installation could not start.","reason":"%s","hint":"%s","retryable":false,"retry":"after_fix"}\n' "$1" "$2" >&2 exit 1 } [ "$(uname -s)" = Linux ] && [ "$(uname -m)" = x86_64 ] || fail 'This installer supports Linux x64 only.' 'Run this command on a Linux x64 server.' command -v python3 >/dev/null 2>&1 && command -v curl >/dev/null 2>&1 || fail 'Python 3 and curl are required.' 'Install Python 3 and curl, then run the command again.' revcode_tmp=$(mktemp -d /tmp/revcode-install.XXXXXXXXXX) || fail 'A private temporary directory could not be created.' 'Check available space and permissions in /tmp, then try again.' trap 'rm -rf -- "$revcode_tmp"' 0 trap 'exit 129' HUP trap 'exit 130' INT trap 'exit 143' TERM curl --fail --silent --show-error --location --proto '=https' --proto-redir '=https' \ --connect-timeout 15 --max-time 120 --retry 2 \ --output "$revcode_tmp/revcode-install.pyz" \ https://revcode.app/engine/install/stable/x64 || fail 'The installer download did not complete.' 'Check the download diagnostic above and your connection, then try again.' python3 -I "$revcode_tmp/revcode-install.pyz" "$@"