Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New installation scripts: specify version as parameter #395

Closed
Vonng opened this issue Apr 26, 2024 · 1 comment
Closed

New installation scripts: specify version as parameter #395

Vonng opened this issue Apr 26, 2024 · 1 comment
Assignees
Labels
RELEASE Release related
Milestone

Comments

@Vonng
Copy link
Owner

Vonng commented Apr 26, 2024

I'd like to modifiy the install script to add a version parameter, and print hint about operating systems.

For example, we can check version from Environment or args by:

#--------------------------------------------------------------#
# Version
#--------------------------------------------------------------#
DEFAULT_VERSION=v2.6.0
VALID_VERSIONS="\
v1.0.0 v1.1.1 v1.2.0 v1.3.0 v1.4.0 v1.4.1 v1.5.0 v1.5.1 v2.0.0 \
v2.0.1 v2.0.2 v2.1.0 v2.2.0 v2.3.0 v2.3.1 v2.4.0 v2.4.1 v2.5.0 v2.5.1 v2.6.0"
VERSION=${DEFAULT_VERSION}
VERSION_FROM="default"
KERNEL=$(uname)
ARCH=$(uname -m)

# arg1 > env > default
if [[ -n "$1" ]]; then
    VERSION=$1
    VERSION_FROM="arg"
fi

function check_version(){
    local found=false

    # validate version format
    if [[ ! ${VERSION} =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+[0-9]+)?$ ]]; then
        log_error "invalid version string from ${VERSION_FROM}: ${VERSION}"
        exit 1
    fi

    # check version in table
    for ver in ${VALID_VERSIONS}; do
        if [ "${ver}" = "${VERSION}" ]; then
            found="true"
            break
        fi
    done

    # print version string if valid
    if [[ "${found}" != "true" ]]; then
        log_error "invalid version from ${VERSION_FROM}: ${VERSION}"
        log_hint "valid pigsty versions:"
        for ver in ${VALID_VERSIONS}; do
            log_hint "  - ${ver}"
        done
        exit 1
    fi
}

check_version
@Vonng Vonng added the RELEASE Release related label Apr 26, 2024
@Vonng Vonng self-assigned this Apr 26, 2024
@Vonng Vonng added this to the v2.7 milestone Apr 26, 2024
@Vonng
Copy link
Owner Author

Vonng commented May 16, 2024

Resolve by 00e7f0c

Now you can download pigsty with:

bash -c "$(curl -fsSL https://get.pigsty.cc/i)"
bash -c "$(curl -fsSL https://get.pigsty.cc/install)"
bash -c "$(curl -fsSL https://get.pigsty.cc/latest)"

# To install a specific version of pigsty (e.g. v2.6.0)
bash -c "$(curl -fsSL https://get.pigsty.cc/i)" -- v2.6.0
curl -fsSL https://get.pigsty.cc/i | bash -s v2.6.0

@Vonng Vonng closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RELEASE Release related
Projects
Status: Done
Development

No branches or pull requests

1 participant