Skip to content

Commit 0f1e79a

Browse files
committed
Fix surrealdb installation scripts to correctly provide the version number
1 parent e8e08d3 commit 0f1e79a

2 files changed

Lines changed: 36 additions & 32 deletions

File tree

.devcontainer/surrealdb/install.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,32 @@ check_packages() {
2121

2222
check_packages curl ca-certificates
2323

24-
# This script will set the appropriate environment variable for the
24+
# This script will pass the appropriate command-line flags to the
2525
# SurrealDB installation script based on the version option.
2626
#
27-
# The SurrealDB installation script takes different environment variables:
28-
# - ALPHA=true
29-
# - BETA=true
30-
# - NIGHTLY=true
31-
# - VERSION=x.y.z
27+
# The SurrealDB installation script takes command-line flags:
28+
# - --alpha (or -a)
29+
# - --beta (or -b)
30+
# - --nightly (or -n)
31+
# - --version x.y.z (or -v x.y.z)
3232
# depending on what release channel you want to install from.
33-
# The developer of this devcontainer feature thinks having to specify different
34-
# feature options for different release channels is not ideal.
33+
34+
# Determine the appropriate flag to pass to the install script
35+
INSTALL_ARGS=""
3536

3637
if [ "$VERSION" = "alpha" ]; then
37-
export ALPHA="true"
38+
INSTALL_ARGS="--alpha"
3839
elif [ "$VERSION" = "beta" ]; then
39-
export BETA="true"
40+
INSTALL_ARGS="--beta"
4041
elif [ "$VERSION" = "nightly" ]; then
41-
export NIGHTLY="true"
42+
INSTALL_ARGS="--nightly"
4243
elif [ "$VERSION" = "latest" ]; then
43-
# For latest, don't set VERSION - let the script use the default
44-
unset VERSION
44+
# For latest, don't pass any version flags - let the script use the default
45+
INSTALL_ARGS=""
4546
else
46-
# For specific versions, remove the "v" prefix if present
47-
export VERSION="${VERSION#v}"
47+
# For specific versions, remove the "v" prefix if present and pass --version flag
48+
VERSION_CLEAN="${VERSION#v}"
49+
INSTALL_ARGS="--version $VERSION_CLEAN"
4850
fi
4951

50-
curl -sSf https://install.surrealdb.com | sh
52+
curl -sSf https://install.surrealdb.com | sh -s -- $INSTALL_ARGS

destination-surrealdb/.devcontainer/surrealdb/install.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,32 @@ check_packages() {
2121

2222
check_packages curl ca-certificates
2323

24-
# This script will set the appropriate environment variable for the
24+
# This script will pass the appropriate command-line flags to the
2525
# SurrealDB installation script based on the version option.
2626
#
27-
# The SurrealDB installation script takes different environment variables:
28-
# - ALPHA=true
29-
# - BETA=true
30-
# - NIGHTLY=true
31-
# - VERSION=x.y.z
27+
# The SurrealDB installation script takes command-line flags:
28+
# - --alpha (or -a)
29+
# - --beta (or -b)
30+
# - --nightly (or -n)
31+
# - --version x.y.z (or -v x.y.z)
3232
# depending on what release channel you want to install from.
33-
# The developer of this devcontainer feature thinks having to specify different
34-
# feature options for different release channels is not ideal.
33+
34+
# Determine the appropriate flag to pass to the install script
35+
INSTALL_ARGS=""
3536

3637
if [ "$VERSION" = "alpha" ]; then
37-
export ALPHA="true"
38+
INSTALL_ARGS="--alpha"
3839
elif [ "$VERSION" = "beta" ]; then
39-
export BETA="true"
40+
INSTALL_ARGS="--beta"
4041
elif [ "$VERSION" = "nightly" ]; then
41-
export NIGHTLY="true"
42+
INSTALL_ARGS="--nightly"
4243
elif [ "$VERSION" = "latest" ]; then
43-
# For latest, don't set VERSION - let the script use the default
44-
unset VERSION
44+
# For latest, don't pass any version flags - let the script use the default
45+
INSTALL_ARGS=""
4546
else
46-
# For specific versions, remove the "v" prefix if present
47-
export VERSION="${VERSION#v}"
47+
# For specific versions, remove the "v" prefix if present and pass --version flag
48+
VERSION_CLEAN="${VERSION#v}"
49+
INSTALL_ARGS="--version $VERSION_CLEAN"
4850
fi
4951

50-
curl -sSf https://install.surrealdb.com | sh
52+
curl -sSf https://install.surrealdb.com | sh -s -- $INSTALL_ARGS

0 commit comments

Comments
 (0)