diff --git a/.github/workflows/pr-posix-script-versions-tests.yml b/.github/workflows/pr-posix-script-versions-tests.yml index 61dc7ba..ba32fe6 100644 --- a/.github/workflows/pr-posix-script-versions-tests.yml +++ b/.github/workflows/pr-posix-script-versions-tests.yml @@ -13,6 +13,9 @@ jobs: matrix: os: - ubuntu-24.04 + - macos-14 + node-version: + - '20' fat: - --fat - '' @@ -28,30 +31,26 @@ jobs: - 'edge' - 'latest' - 'dev' - - 'skip' + - 'bin/lando' + - 'set-with-envvar' steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Install node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm - name: Setup Lando version ${{ matrix.success-version }} shell: bash run: | - if [[ "${{ matrix.success-version }}" == "skip" ]]; then + if [[ "${{ matrix.success-version }}" == "set-with-envvar" ]]; then LANDO_VERSION=v3.22.0 ./setup-lando.sh --no-setup ${{ matrix.fat }} else ./setup-lando.sh --version=${{ matrix.success-version }} --no-setup ${{ matrix.fat }} fi lando version --all - - # test slim|fat on lando 3 - if lando version | grep "v3."; then - if [[ "${{ matrix.fat }}" == "--fat" ]]; then - lando config --path cli.slim | grep false - else - lando config --path cli.slim | grep true - fi - fi - diff --git a/CHANGELOG.md b/CHANGELOG.md index 6da901e..1f0a22e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) +* Added `path` based installation to POSIX `setup-lando.sh` script + ## v3.4.5 - [November 10, 2024](https://github.com/lando/setup-lando/releases/tag/v3.4.5) * Updated to [@lando/vitepress-theme-default-plus@v1.1.0-beta.19](https://github.com/lando/vitepress-theme-default-plus/releases/tag/v1.1.0-beta.19) diff --git a/setup-lando.sh b/setup-lando.sh index 4ede7d2..0515b73 100755 --- a/setup-lando.sh +++ b/setup-lando.sh @@ -507,11 +507,18 @@ elif [[ "${VERSION}" == "3-dev" ]] || [[ "${VERSION}" == "3-latest" ]]; then URL="https://files.lando.dev/core/lando-${OS}-${ARCH}-dev" VERSION_DEV=1 -# CUSTOM -else - if [[ $VERSION != v* ]]; then - VERSION="v${VERSION}" +# CUSTOM VERSION +elif [[ ! -f "$VERSION" ]] && [[ $VERSION != v* ]]; then + VERSION="v${VERSION}" + +# PATH VERSION +elif [[ -f "${VERSION}" ]]; then + if [[ "${VERSION}" == /* ]]; then + URL=file://$VERSION + else + URL=file://$(pwd)/$VERSION fi + VERSION="$($VERSION version)" fi # Set some helper things @@ -525,24 +532,30 @@ else HRV="$VERSION" fi -# set url depending on non-dev LMVs -if [[ $LMV == '3' ]] && [[ -z "${VERSION_DEV-}" ]]; then - URL="https://github.com/lando/core/releases/download/${VERSION}/lando-${OS}-${ARCH}-${VERSION}" -elif [[ $LMV == '4' ]] && [[ -z "${VERSION_DEV-}" ]]; then - URL="https://github.com/lando/core-next/releases/download/${VERSION}/lando-${OS}-${ARCH}-${VERSION}" +# if URL is still not set at this point we assume its a github version download +if [[ -z "${URL-}" ]]; then + if [[ $LMV == '3' ]] && [[ -z "${VERSION_DEV-}" ]]; then + URL="https://github.com/lando/core/releases/download/${VERSION}/lando-${OS}-${ARCH}-${VERSION}" + elif [[ $LMV == '4' ]] && [[ -z "${VERSION_DEV-}" ]]; then + URL="https://github.com/lando/core-next/releases/download/${VERSION}/lando-${OS}-${ARCH}-${VERSION}" + fi +fi + +# abort if we have no URL at this point +if [[ -z "${URL-}" ]]; then + abort "could not resolve '${ORIGINAL_VERSION}' to a file or URL!" +else + debug "resolved v${LMV} version '${ORIGINAL_VERSION}' to ${VERSION} (${URL})" fi # autoslim all v3 urls by default -# @TODO: --fat flag to stop this? -if [[ $LMV == '3' ]] && [[ $FAT != '1' ]]; then +# @TODO: restrict this to 3 < 3.24.0 at some point? +if [[ $URL != file://* ]] && [[ $LMV == '3' ]] && [[ $FAT != '1' ]]; then URL="${URL}-slim" HRV="$VERSION-slim" debug "autoslimin url for lando 3" fi -# debug version resolution -debug "resolved v${LMV} version '${ORIGINAL_VERSION}' to ${VERSION} (${URL})" - # force setup to 0 if lando 4 if [[ $SETUP == '1' ]] && [[ $LMV == '4' ]]; then SETUP=0 @@ -767,14 +780,21 @@ cd "/usr" || exit 1 if [[ -z "${NONINTERACTIVE-}" ]]; then log "${tty_bold}this script is about to:${tty_reset}" log + # sudo prompt if needs_sudo; then log "- ${tty_green}prompt${tty_reset} for ${tty_bold}sudo${tty_reset} password"; fi + # download - log "- ${tty_magenta}download${tty_reset} lando ${tty_bold}${HRV}${tty_reset} to ${tty_bold}${DEST}${tty_reset}" + if [[ $URL != file://* ]]; then log "- ${tty_magenta}download${tty_reset} lando ${tty_bold}${HRV}${tty_reset} to ${tty_bold}${DEST}${tty_reset}" + # or move + else log "- ${tty_magenta}move${tty_reset} lando ${tty_bold}${ORIGINAL_VERSION}${tty_reset} to ${tty_bold}${DEST}${tty_reset}"; fi + # setup if [[ "$SETUP" == "1" ]]; then log "- ${tty_blue}run${tty_reset} ${tty_bold}lando setup${tty_reset}"; fi + # shellenv log "- ${tty_blue}run${tty_reset} ${tty_bold}lando shellenv --add${tty_reset}" + # block for user wait_for_user fi