forked from freeleaps/freeleaps-pub
Merge pull request 'fix(devbox): fix the requirement import' (#2) from devbox_fix into master
Reviewed-on: freeleaps/freeleaps-pub#2
This commit is contained in:
commit
7d48c3442a
@ -52,7 +52,6 @@ exit_with_message() {
|
|||||||
exit $code
|
exit $code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
detect_os() {
|
detect_os() {
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
echo "darwin"
|
echo "darwin"
|
||||||
@ -65,7 +64,6 @@ detect_os() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Add a key-value pair to the args array
|
# Add a key-value pair to the args array
|
||||||
add_arg() {
|
add_arg() {
|
||||||
local key="$1"
|
local key="$1"
|
||||||
@ -91,7 +89,6 @@ get_arg() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
devbox_init_guidance() {
|
devbox_init_guidance() {
|
||||||
printf "Welcome to DevBox CLI!\n\n"
|
printf "Welcome to DevBox CLI!\n\n"
|
||||||
# if $1 is empty, then ask user select a choice or match user input $1 action to be product_id
|
# if $1 is empty, then ask user select a choice or match user input $1 action to be product_id
|
||||||
@ -231,7 +228,6 @@ devbox_usage() {
|
|||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# :command.usage
|
# :command.usage
|
||||||
devbox_init_usage() {
|
devbox_init_usage() {
|
||||||
if [[ -n $long_usage ]]; then
|
if [[ -n $long_usage ]]; then
|
||||||
@ -440,7 +436,7 @@ inspect_args() {
|
|||||||
for key in $sorted_keys; do
|
for key in $sorted_keys; do
|
||||||
value=""
|
value=""
|
||||||
# Find the value based on the key
|
# Find the value based on the key
|
||||||
for i in `seq 0 $((${#args_keys[@]} - 1))`; do
|
for i in $(seq 0 $((${#args_keys[@]} - 1))); do
|
||||||
if [ "${args_keys[$i]}" = "$key" ]; then
|
if [ "${args_keys[$i]}" = "$key" ]; then
|
||||||
value="${args_values[$i]}"
|
value="${args_values[$i]}"
|
||||||
break
|
break
|
||||||
@ -459,7 +455,7 @@ inspect_args() {
|
|||||||
log_info "deps:"
|
log_info "deps:"
|
||||||
for key in $sorted_keys; do
|
for key in $sorted_keys; do
|
||||||
value=""
|
value=""
|
||||||
for i in `seq 0 $((${#deps_keys[@]} - 1))`; do
|
for i in $(seq 0 $((${#deps_keys[@]} - 1))); do
|
||||||
if [ "${deps_keys[$i]}" = "$key" ]; then
|
if [ "${deps_keys[$i]}" = "$key" ]; then
|
||||||
value="${deps_values[$i]}"
|
value="${deps_values[$i]}"
|
||||||
break
|
break
|
||||||
@ -481,7 +477,6 @@ inspect_args() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
install_docker() {
|
install_docker() {
|
||||||
log_info "Installing Docker..."
|
log_info "Installing Docker..."
|
||||||
|
|
||||||
@ -633,21 +628,18 @@ build_local_image() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# used for repository username and password encoding
|
# used for repository username and password encoding
|
||||||
url_encode() {
|
url_encode() {
|
||||||
echo "$1" | sed 's/@/%40/g'
|
echo "$1" | sed 's/@/%40/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###############################################
|
###############################################
|
||||||
# Initialize the development environment
|
# Initialize the development environment
|
||||||
###############################################
|
###############################################
|
||||||
init_compile_env() {
|
init_compile_env() {
|
||||||
|
|
||||||
# Update for export environments []
|
# Update for export environments []
|
||||||
docker exec -i "$DEVBOX_NAME" bash <<EOF
|
docker exec -i "$DEVBOX_NAME" bash <<EOF
|
||||||
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Starting DevBox initialization..."
|
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Starting DevBox initialization..."
|
||||||
|
|
||||||
# Export environment variables
|
# Export environment variables
|
||||||
@ -908,23 +900,22 @@ EOF
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
###############################################
|
###############################################
|
||||||
# Backend compilation and startup logic
|
# Backend compilation and startup logic
|
||||||
###############################################
|
###############################################
|
||||||
compile_backend_service() {
|
compile_backend_service() {
|
||||||
|
|
||||||
echo "[BACKEND] $(date '+%Y-%m-%d %H:%M:%S') Start backend service at home path $WORKING_HOME."
|
echo "[BACKEND] $(date '+%Y-%m-%d %H:%M:%S') Start backend service at home path $WORKING_HOME."
|
||||||
|
|
||||||
devbox_container_id_file_path="${WORKING_HOME}/.devbox-instance"
|
devbox_container_id_file_path="${WORKING_HOME}/.devbox-instance"
|
||||||
DEVBOX_NAME=$(cat "$devbox_container_id_file_path")
|
DEVBOX_NAME=$(cat "$devbox_container_id_file_path")
|
||||||
|
|
||||||
devbox_backend_port_file_path="${WORKING_HOME}/.devbox-backend-port"
|
devbox_backend_port_file_path="${WORKING_HOME}/.devbox-backend-port"
|
||||||
DEVBOX_BACKEND_PORT=$(cat "$devbox_backend_port_file_path")
|
DEVBOX_BACKEND_PORT=$(cat "$devbox_backend_port_file_path")
|
||||||
|
|
||||||
echo "[BACKEND] $(date '+%Y-%m-%d %H:%M:%S') Start backend service from $DEVBOX_NAME."
|
echo "[BACKEND] $(date '+%Y-%m-%d %H:%M:%S') Start backend service from $DEVBOX_NAME."
|
||||||
|
|
||||||
docker exec -i "$DEVBOX_NAME" bash <<EOF
|
docker exec -i "$DEVBOX_NAME" bash <<EOF
|
||||||
# Check if /home/devbox/.backend.pid exits
|
# Check if /home/devbox/.backend.pid exits
|
||||||
if [ -f /home/devbox/.backend.pid ]; then
|
if [ -f /home/devbox/.backend.pid ]; then
|
||||||
backend_pid=\$(cat /home/devbox/.backend.pid)
|
backend_pid=\$(cat /home/devbox/.backend.pid)
|
||||||
@ -997,7 +988,7 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
|
|||||||
# Check if it's the first time by verifying if the backend dependencies have been installed
|
# Check if it's the first time by verifying if the backend dependencies have been installed
|
||||||
if [ ! -f "/home/devbox/.backend_deps_installed" ]; then
|
if [ ! -f "/home/devbox/.backend_deps_installed" ]; then
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Install backend dependencies..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Install backend dependencies..."
|
||||||
pip install -r /home/devbox/freeleaps/apps/requirements.txt
|
pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
if ! pip show async_timeout; then
|
if ! pip show async_timeout; then
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') async_timeout is missing. Installing..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') async_timeout is missing. Installing..."
|
||||||
pip install async_timeout
|
pip install async_timeout
|
||||||
@ -1007,10 +998,10 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
|
|||||||
mkdir -p /home/devbox/tmp
|
mkdir -p /home/devbox/tmp
|
||||||
|
|
||||||
## Backup the requirements.txt file
|
## Backup the requirements.txt file
|
||||||
cp /home/devbox/freeleaps/apps/requirements.txt /home/devbox/tmp/requirements.txt.bak
|
cp /home/devbox/freeleaps/apps/freeleaps/requirements.txt /home/devbox/tmp/requirements.txt.bak
|
||||||
|
|
||||||
|
|
||||||
ORIGINAL_REQ="/home/devbox/freeleaps/apps/requirements.txt"
|
ORIGINAL_REQ="/home/devbox/freeleaps/apps/freeleaps/requirements.txt"
|
||||||
NEW_REQ="/home/devbox/tmp/requirements.txt"
|
NEW_REQ="/home/devbox/tmp/requirements.txt"
|
||||||
|
|
||||||
# Check if /home/devbox/tmp/requirements.txt exists, if yes, remove it
|
# Check if /home/devbox/tmp/requirements.txt exists, if yes, remove it
|
||||||
@ -1043,11 +1034,11 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
|
|||||||
|
|
||||||
if [ \$IS_NEW_REQ_ADDED -eq 1 ]; then
|
if [ \$IS_NEW_REQ_ADDED -eq 1 ]; then
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Reinstalling dependencies..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Reinstalling dependencies..."
|
||||||
pip install -r /home/devbox/freeleaps/apps/requirements.txt
|
pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
fi
|
fi
|
||||||
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
|
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
|
||||||
rm /home/devbox/freeleaps/apps/requirements.txt
|
rm /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
mv /home/devbox/tmp/requirements.txt.bak /home/devbox/freeleaps/apps/requirements.txt
|
mv /home/devbox/tmp/requirements.txt.bak /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
|
|
||||||
touch /home/devbox/.backend_deps_installed
|
touch /home/devbox/.backend_deps_installed
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Run backend service..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Run backend service..."
|
||||||
@ -1057,7 +1048,7 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
|
|||||||
# Check if all dependencies are installed, if not, install them
|
# Check if all dependencies are installed, if not, install them
|
||||||
if ! pip check; then
|
if ! pip check; then
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Some dependencies are missing. Reinstalling..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Some dependencies are missing. Reinstalling..."
|
||||||
pip install -r /home/devbox/freeleaps/apps/requirements.txt
|
pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# pip install async_timeout if not installed
|
# pip install async_timeout if not installed
|
||||||
@ -1071,7 +1062,7 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
|
|||||||
mkdir -p /home/devbox/tmp
|
mkdir -p /home/devbox/tmp
|
||||||
|
|
||||||
## Backup the requirements.txt file
|
## Backup the requirements.txt file
|
||||||
cp /home/devbox/freeleaps/apps/requirements.txt /home/devbox/tmp/requirements.txt.bak
|
cp /home/devbox/freeleaps/apps/freeleaps/requirements.txt /home/devbox/tmp/requirements.txt.bak
|
||||||
|
|
||||||
|
|
||||||
ORIGINAL_REQ="/home/devbox/freeleaps/apps/requirements.txt"
|
ORIGINAL_REQ="/home/devbox/freeleaps/apps/requirements.txt"
|
||||||
@ -1107,8 +1098,8 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
|
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
|
||||||
rm /home/devbox/freeleaps/apps/requirements.txt
|
rm /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
mv /home/devbox/tmp/requirements.txt.bak /home/devbox/freeleaps/apps/requirements.txt
|
mv /home/devbox/tmp/requirements.txt.bak /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
|
|
||||||
# Check if the backend service is already running
|
# Check if the backend service is already running
|
||||||
SERVICE_API_ACCESS_PORT=\$(cat /home/devbox/.devbox-backend-port)
|
SERVICE_API_ACCESS_PORT=\$(cat /home/devbox/.devbox-backend-port)
|
||||||
@ -1179,21 +1170,21 @@ EOF
|
|||||||
# Frontend compilation and startup logic
|
# Frontend compilation and startup logic
|
||||||
###############################################
|
###############################################
|
||||||
compile_frontend_service() {
|
compile_frontend_service() {
|
||||||
echo "[FRONTEND] $(date '+%Y-%m-%d %H:%M:%S') start frontend service at home path $WORKING_HOME."
|
echo "[FRONTEND] $(date '+%Y-%m-%d %H:%M:%S') start frontend service at home path $WORKING_HOME."
|
||||||
|
|
||||||
devbox_container_id_file_path="${WORKING_HOME}/.devbox-instance"
|
devbox_container_id_file_path="${WORKING_HOME}/.devbox-instance"
|
||||||
if [ ! -f "$devbox_container_id_file_path" ]; then
|
if [ ! -f "$devbox_container_id_file_path" ]; then
|
||||||
# Check if devbox container exists by checking the container name of devbox
|
# Check if devbox container exists by checking the container name of devbox
|
||||||
if ! docker ps -a --format "{{.Names}}" | grep -q "devbox"; then
|
if ! docker ps -a --format "{{.Names}}" | grep -q "devbox"; then
|
||||||
exit_with_message "DevBox container is not running. Please start the DevBox container first." 1
|
exit_with_message "DevBox container is not running. Please start the DevBox container first." 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEVBOX_NAME=$(cat "$devbox_container_id_file_path")
|
DEVBOX_NAME=$(cat "$devbox_container_id_file_path")
|
||||||
|
|
||||||
DEVBOX_NGINX_HOST_PORT=$(cat "$WORKING_HOME/.devbox-nginx-port") # Nginx Host Port
|
DEVBOX_NGINX_HOST_PORT=$(cat "$WORKING_HOME/.devbox-nginx-port") # Nginx Host Port
|
||||||
|
|
||||||
docker exec -i "$DEVBOX_NAME" bash <<EOF
|
docker exec -i "$DEVBOX_NAME" bash <<EOF
|
||||||
|
|
||||||
# Check if Nginx or frontend process is already running
|
# Check if Nginx or frontend process is already running
|
||||||
nginx_running=false
|
nginx_running=false
|
||||||
@ -1764,7 +1755,6 @@ devbox_init_command() {
|
|||||||
sudo apt-get install docker-compose -y
|
sudo apt-get install docker-compose -y
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# 3.2 Check disk space
|
# 3.2 Check disk space
|
||||||
local free_space_kb
|
local free_space_kb
|
||||||
free_space_kb="$(df -Pk "$HOME" | awk 'END{print $4}')"
|
free_space_kb="$(df -Pk "$HOME" | awk 'END{print $4}')"
|
||||||
@ -1788,10 +1778,10 @@ devbox_init_command() {
|
|||||||
echo
|
echo
|
||||||
read -p "DevBox instance already exists. Do you want to force remove it? (y/N): " ans
|
read -p "DevBox instance already exists. Do you want to force remove it? (y/N): " ans
|
||||||
case "$ans" in
|
case "$ans" in
|
||||||
[Yy]* )
|
[Yy]*)
|
||||||
FORCE_INIT=true
|
FORCE_INIT=true
|
||||||
;;
|
;;
|
||||||
* )
|
*)
|
||||||
exit_with_message "DevBox instance already exists. Use --force to remove it." 1
|
exit_with_message "DevBox instance already exists. Use --force to remove it." 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -1810,11 +1800,11 @@ devbox_init_command() {
|
|||||||
echo
|
echo
|
||||||
read -p "Container '$comp' is already running. Do you want to force update it? (y/N): " ans
|
read -p "Container '$comp' is already running. Do you want to force update it? (y/N): " ans
|
||||||
case "$ans" in
|
case "$ans" in
|
||||||
[Yy]* )
|
[Yy]*)
|
||||||
FORCE_INIT=true
|
FORCE_INIT=true
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
* )
|
*)
|
||||||
exit_with_message " Container '$comp' is already running. Use --force to override." 1
|
exit_with_message " Container '$comp' is already running. Use --force to override." 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -1870,8 +1860,6 @@ devbox_init_command() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local devbox_full_image="${DEVBOX_REPO}/${DEVBOX_IMAGE}:${DEVBOX_TAG}"
|
local devbox_full_image="${DEVBOX_REPO}/${DEVBOX_IMAGE}:${DEVBOX_TAG}"
|
||||||
|
|
||||||
# Check local and remote version. User doesn't need to rebuild devbox if local version is consistent with remote version
|
# Check local and remote version. User doesn't need to rebuild devbox if local version is consistent with remote version
|
||||||
@ -1988,10 +1976,10 @@ devbox_init_command() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# record container id, DEVBOX_FRONTEND_PORT, DEVBOX_BACKEND_PORT
|
# record container id, DEVBOX_FRONTEND_PORT, DEVBOX_BACKEND_PORT
|
||||||
echo "$container_id" > "$WORKING_HOME/.devbox-instance"
|
echo "$container_id" >"$WORKING_HOME/.devbox-instance"
|
||||||
echo "$DEVBOX_FRONTEND_PORT" > "$WORKING_HOME/.devbox-frontend-port"
|
echo "$DEVBOX_FRONTEND_PORT" >"$WORKING_HOME/.devbox-frontend-port"
|
||||||
echo "$DEVBOX_BACKEND_PORT" > "$WORKING_HOME/.devbox-backend-port"
|
echo "$DEVBOX_BACKEND_PORT" >"$WORKING_HOME/.devbox-backend-port"
|
||||||
echo "$DEVBOX_NGINX_PORT" > "$WORKING_HOME/.devbox-nginx-port"
|
echo "$DEVBOX_NGINX_PORT" >"$WORKING_HOME/.devbox-nginx-port"
|
||||||
|
|
||||||
DOVBOX_CLI_DIR=$(pwd)
|
DOVBOX_CLI_DIR=$(pwd)
|
||||||
|
|
||||||
@ -2011,25 +1999,25 @@ devbox_init_command() {
|
|||||||
FRONTEND_GIT_URL="https://$ENCODEING_FREELEAPS_USERNAME:$ENCODEING_FREELEAPS_PASSWORD@gitea.freeleaps.mathmast.com/products/freeleaps.git"
|
FRONTEND_GIT_URL="https://$ENCODEING_FREELEAPS_USERNAME:$ENCODEING_FREELEAPS_PASSWORD@gitea.freeleaps.mathmast.com/products/freeleaps.git"
|
||||||
# Check if freeleaps2-frontend exists, if not git clone it
|
# Check if freeleaps2-frontend exists, if not git clone it
|
||||||
if [ ! -d "$FREELEAPS_DIR" ]; then
|
if [ ! -d "$FREELEAPS_DIR" ]; then
|
||||||
pushd "$WORKING_HOME" > /dev/null
|
pushd "$WORKING_HOME" >/dev/null
|
||||||
log_info "Git cloning gitea.freeleaps.mathmast.com/products/freeleaps.git to $FREELEAPS_DIR"
|
log_info "Git cloning gitea.freeleaps.mathmast.com/products/freeleaps.git to $FREELEAPS_DIR"
|
||||||
git clone --depth 5 $FRONTEND_GIT_URL
|
git clone --depth 5 $FRONTEND_GIT_URL
|
||||||
|
|
||||||
# Checkout the specified branch
|
# Checkout the specified branch
|
||||||
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
|
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
|
||||||
pushd "$FREELEAPS_DIR" > /dev/null
|
pushd "$FREELEAPS_DIR" >/dev/null
|
||||||
log_info "Checking out branch: $GIT_BRANCH"
|
log_info "Checking out branch: $GIT_BRANCH"
|
||||||
if ! git checkout $GIT_BRANCH; then
|
if ! git checkout $GIT_BRANCH; then
|
||||||
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
|
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
|
||||||
git checkout main
|
git checkout main
|
||||||
fi
|
fi
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
pushd "$FREELEAPS_DIR" > /dev/null
|
pushd "$FREELEAPS_DIR" >/dev/null
|
||||||
# Check $WORKING_HOME/freeleaps exists and it is a git repository, if not git clone it
|
# Check $WORKING_HOME/freeleaps exists and it is a git repository, if not git clone it
|
||||||
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||||
popd > /dev/null # Exit from $FREELEAPS_DIR
|
popd >/dev/null # Exit from $FREELEAPS_DIR
|
||||||
rm -rf "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
|
rm -rf "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
|
||||||
rmdir "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
|
rmdir "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
|
||||||
|
|
||||||
@ -2043,13 +2031,13 @@ devbox_init_command() {
|
|||||||
|
|
||||||
# Checkout the specified branch
|
# Checkout the specified branch
|
||||||
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
|
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
|
||||||
pushd "$FREELEAPS_DIR" > /dev/null
|
pushd "$FREELEAPS_DIR" >/dev/null
|
||||||
log_info "Checking out branch: $GIT_BRANCH"
|
log_info "Checking out branch: $GIT_BRANCH"
|
||||||
if ! git checkout $GIT_BRANCH; then
|
if ! git checkout $GIT_BRANCH; then
|
||||||
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
|
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
|
||||||
git checkout main
|
git checkout main
|
||||||
fi
|
fi
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log_info "Git pulling gitea.freeleaps.mathmast.com/products/freeleaps.git"
|
log_info "Git pulling gitea.freeleaps.mathmast.com/products/freeleaps.git"
|
||||||
@ -2074,7 +2062,7 @@ devbox_init_command() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -2094,25 +2082,25 @@ devbox_init_command() {
|
|||||||
CUSTOM_FOLDER_NAME=$(basename "$USE_CUSTOM_REPOSITORY" .git)
|
CUSTOM_FOLDER_NAME=$(basename "$USE_CUSTOM_REPOSITORY" .git)
|
||||||
CUSTOM_DIR="$WORKING_HOME/$CUSTOM_FOLDER_NAME"
|
CUSTOM_DIR="$WORKING_HOME/$CUSTOM_FOLDER_NAME"
|
||||||
if [ ! -d "$CUSTOM_DIR" ]; then
|
if [ ! -d "$CUSTOM_DIR" ]; then
|
||||||
pushd "$WORKING_HOME" > /dev/null
|
pushd "$WORKING_HOME" >/dev/null
|
||||||
log_info "Git cloning custom repository: $ECHO_USE_CUSTOM_REPOSITORY"
|
log_info "Git cloning custom repository: $ECHO_USE_CUSTOM_REPOSITORY"
|
||||||
git clone --depth 5 "$USE_CUSTOM_REPOSITORY"
|
git clone --depth 5 "$USE_CUSTOM_REPOSITORY"
|
||||||
|
|
||||||
# Checkout the specified branch
|
# Checkout the specified branch
|
||||||
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
|
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
|
||||||
pushd "$CUSTOM_DIR" > /dev/null
|
pushd "$CUSTOM_DIR" >/dev/null
|
||||||
log_info "Checking out branch: $GIT_BRANCH"
|
log_info "Checking out branch: $GIT_BRANCH"
|
||||||
if ! git checkout $GIT_BRANCH; then
|
if ! git checkout $GIT_BRANCH; then
|
||||||
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
|
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
|
||||||
git checkout main
|
git checkout main
|
||||||
fi
|
fi
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
pushd "$CUSTOM_DIR" > /dev/null
|
pushd "$CUSTOM_DIR" >/dev/null
|
||||||
# Check $WORKING_HOME/custom exists and it is a git repository, if not git clone it
|
# Check $WORKING_HOME/custom exists and it is a git repository, if not git clone it
|
||||||
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||||
popd > /dev/null # Exit from $CUSTOM_DIR
|
popd >/dev/null # Exit from $CUSTOM_DIR
|
||||||
rm -rf "$CUSTOM_DIR" # Remove $CUSTOM_DIR
|
rm -rf "$CUSTOM_DIR" # Remove $CUSTOM_DIR
|
||||||
rmdir "$CUSTOM_DIR" # Remove $CUSTOM_DIR
|
rmdir "$CUSTOM_DIR" # Remove $CUSTOM_DIR
|
||||||
|
|
||||||
@ -2126,13 +2114,13 @@ devbox_init_command() {
|
|||||||
|
|
||||||
# Checkout the specified branch
|
# Checkout the specified branch
|
||||||
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
|
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
|
||||||
pushd "$CUSTOM_DIR" > /dev/null
|
pushd "$CUSTOM_DIR" >/dev/null
|
||||||
log_info "Checking out branch: $GIT_BRANCH"
|
log_info "Checking out branch: $GIT_BRANCH"
|
||||||
if ! git checkout $GIT_BRANCH; then
|
if ! git checkout $GIT_BRANCH; then
|
||||||
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
|
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
|
||||||
git checkout main
|
git checkout main
|
||||||
fi
|
fi
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log_info "Git pulling custom repository"
|
log_info "Git pulling custom repository"
|
||||||
@ -2152,30 +2140,28 @@ devbox_init_command() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd $DOVBOX_CLI_DIR > /dev/null
|
pushd $DOVBOX_CLI_DIR >/dev/null
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# 6. linbwang: pull and start other components
|
# 6. linbwang: pull and start other components
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
|
|
||||||
log_info "[INIT] Starting Freeleaps services... Use Local component $USE_LOCAL_COMPONENT_VAL"
|
log_info "[INIT] Starting Freeleaps services... Use Local component $USE_LOCAL_COMPONENT_VAL"
|
||||||
|
|
||||||
export ARCH="$ARCH"
|
export ARCH="$ARCH"
|
||||||
export WORKING_HOME="$WORKING_HOME"
|
export WORKING_HOME="$WORKING_HOME"
|
||||||
|
|
||||||
# Save $USE_CUSTOM_REPOSITORY url to .custom-repository file
|
# Save $USE_CUSTOM_REPOSITORY url to .custom-repository file
|
||||||
echo "$USE_CUSTOM_REPOSITORY" > "$WORKING_HOME/.custom-repository"
|
echo "$USE_CUSTOM_REPOSITORY" >"$WORKING_HOME/.custom-repository"
|
||||||
|
|
||||||
|
# If USE_CUSTOM_REPOSITORY is not empty, initialize the custom repository completed
|
||||||
# If USE_CUSTOM_REPOSITORY is not empty, initialize the custom repository completed
|
if [[ -n "$USE_CUSTOM_REPOSITORY" ]]; then
|
||||||
if [[ -n "$USE_CUSTOM_REPOSITORY" ]]; then
|
|
||||||
# Remove the ':' and password from USE_CUSTOM_REPOSITORY
|
# Remove the ':' and password from USE_CUSTOM_REPOSITORY
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "==========================================================="
|
echo "==========================================================="
|
||||||
echo
|
echo
|
||||||
@ -2188,27 +2174,27 @@ if [[ -n "$USE_CUSTOM_REPOSITORY" ]]; then
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if docker-compose command exists
|
# Check if docker-compose command exists
|
||||||
log_info "Cehck if docker-compose command exists"
|
log_info "Cehck if docker-compose command exists"
|
||||||
# Check if docker-compose is installed
|
# Check if docker-compose is installed
|
||||||
local DC_CMD
|
local DC_CMD
|
||||||
if command -v docker-compose >/dev/null 2>&1; then
|
if command -v docker-compose >/dev/null 2>&1; then
|
||||||
DC_CMD="docker-compose"
|
DC_CMD="docker-compose"
|
||||||
# 如果没有找到 docker-compose,再检查 docker compose(v2 插件)
|
# 如果没有找到 docker-compose,再检查 docker compose(v2 插件)
|
||||||
elif docker compose version >/dev/null 2>&1; then
|
elif docker compose version >/dev/null 2>&1; then
|
||||||
DC_CMD="docker compose"
|
DC_CMD="docker compose"
|
||||||
else
|
else
|
||||||
DC_CMD=""
|
DC_CMD=""
|
||||||
log_error "docker-compose is not installed."
|
log_error "docker-compose is not installed."
|
||||||
fi
|
fi
|
||||||
if [[ "$DC_CMD" == "" ]]; then
|
if [[ "$DC_CMD" == "" ]]; then
|
||||||
exit_with_message "Please install docker-compose or docker compose (v2) and try again." 1
|
exit_with_message "Please install docker-compose or docker compose (v2) and try again." 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If USE_LOCAL_COMPONENT is true, then use local components
|
# If USE_LOCAL_COMPONENT is true, then use local components
|
||||||
if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
|
if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
|
||||||
log_info ' = Using local components for Freeleaps services.'
|
log_info ' = Using local components for Freeleaps services.'
|
||||||
|
|
||||||
export DEVSVC_IMAGE_TAG="$component_tag"
|
export DEVSVC_IMAGE_TAG="$component_tag"
|
||||||
@ -2231,7 +2217,6 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
|
|||||||
exit_with_message " Failed to extract gitea data backup, please check the backup file." 1
|
exit_with_message " Failed to extract gitea data backup, please check the backup file." 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Copy gitea data to the gitea container
|
# Copy gitea data to the gitea container
|
||||||
GITEA_HOST_DIR="${WORKING_HOME}/freeleaps2-gitea"
|
GITEA_HOST_DIR="${WORKING_HOME}/freeleaps2-gitea"
|
||||||
|
|
||||||
@ -2256,7 +2241,6 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
|
|||||||
exit_with_message " Failed to copy gitea data, please check the data directories." 1
|
exit_with_message " Failed to copy gitea data, please check the data directories." 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
mkdir -p ${WORKING_HOME}/logs
|
mkdir -p ${WORKING_HOME}/logs
|
||||||
|
|
||||||
# for each component create log directory
|
# for each component create log directory
|
||||||
@ -2267,7 +2251,6 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
|
|||||||
done
|
done
|
||||||
# Check if FORCE_INIT is set, if not just docker compose up or docker-compose up --force
|
# Check if FORCE_INIT is set, if not just docker compose up or docker-compose up --force
|
||||||
|
|
||||||
|
|
||||||
# Start Gitea, MongoDB, RabbitMQ and other components containers
|
# Start Gitea, MongoDB, RabbitMQ and other components containers
|
||||||
log_info "start Gitea, MongoDB, RabbitMQ and other components containers"
|
log_info "start Gitea, MongoDB, RabbitMQ and other components containers"
|
||||||
|
|
||||||
@ -2280,22 +2263,21 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
gitea_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-gitea$" --format "{{.ID}}")
|
gitea_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-gitea$" --format "{{.ID}}")
|
||||||
echo "$gitea_container_id" > "$WORKING_HOME/.gitea-instance"
|
echo "$gitea_container_id" >"$WORKING_HOME/.gitea-instance"
|
||||||
|
|
||||||
mongo_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-mongodb$" --format "{{.ID}}")
|
mongo_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-mongodb$" --format "{{.ID}}")
|
||||||
echo "$mongo_container_id" > "$WORKING_HOME/.mongodb-instance"
|
echo "$mongo_container_id" >"$WORKING_HOME/.mongodb-instance"
|
||||||
|
|
||||||
rabbitmq_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-rabbitmq$" --format "{{.ID}}")
|
rabbitmq_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-rabbitmq$" --format "{{.ID}}")
|
||||||
echo "$rabbitmq_container_id" > "$WORKING_HOME/.rabbitmq-instance"
|
echo "$rabbitmq_container_id" >"$WORKING_HOME/.rabbitmq-instance"
|
||||||
|
|
||||||
redis_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-redis$" --format "{{.ID}}")
|
redis_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-redis$" --format "{{.ID}}")
|
||||||
echo "$redis_container_id" > "$WORKING_HOME/.redis-instance"
|
echo "$redis_container_id" >"$WORKING_HOME/.redis-instance"
|
||||||
|
|
||||||
|
|
||||||
# Get all components container ids and save to .component-instance file
|
# Get all components container ids and save to .component-instance file
|
||||||
for component in "${start_components[@]}"; do
|
for component in "${start_components[@]}"; do
|
||||||
tmp_container_id=$(docker ps --no-trunc -a --filter "name=^$component$" --format "{{.ID}}")
|
tmp_container_id=$(docker ps --no-trunc -a --filter "name=^$component$" --format "{{.ID}}")
|
||||||
echo "$tmp_container_id" > "$WORKING_HOME/.${component}-instance"
|
echo "$tmp_container_id" >"$WORKING_HOME/.${component}-instance"
|
||||||
done
|
done
|
||||||
|
|
||||||
log_info "${component} container created: $component_container_id"
|
log_info "${component} container created: $component_container_id"
|
||||||
@ -2306,7 +2288,7 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
|
|||||||
exit_with_message " Failed to start $component container. Please check the logs for more information." 1
|
exit_with_message " Failed to start $component container. Please check the logs for more information." 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo '============================================================'
|
echo '============================================================'
|
||||||
log_info 'Using online components for Freeleaps services.'
|
log_info 'Using online components for Freeleaps services.'
|
||||||
echo '============================================================'
|
echo '============================================================'
|
||||||
@ -2321,33 +2303,31 @@ else
|
|||||||
|
|
||||||
# Save MongoDB and RabbitMQ container ids to .mongodb-instance and .rabbitmq-instance
|
# Save MongoDB and RabbitMQ container ids to .mongodb-instance and .rabbitmq-instance
|
||||||
mongo_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-mongodb\$")
|
mongo_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-mongodb\$")
|
||||||
echo "$mongo_container_id" > "$WORKING_HOME/.mongodb-instance"
|
echo "$mongo_container_id" >"$WORKING_HOME/.mongodb-instance"
|
||||||
|
|
||||||
rabbitmq_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-rabbitmq\$")
|
rabbitmq_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-rabbitmq\$")
|
||||||
echo "$rabbitmq_container_id" > "$WORKING_HOME/.rabbitmq-instance"
|
echo "$rabbitmq_container_id" >"$WORKING_HOME/.rabbitmq-instance"
|
||||||
|
|
||||||
redis_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-redis\$")
|
redis_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-redis\$")
|
||||||
echo "$redis_container_id" > "$WORKING_HOME/.redis-instance"
|
echo "$redis_container_id" >"$WORKING_HOME/.redis-instance"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Save $USE_LOCAL_COMPONENT false/true to $WORKING_HOME/.use-local-component
|
# Save $USE_LOCAL_COMPONENT false/true to $WORKING_HOME/.use-local-component
|
||||||
echo "$USE_LOCAL_COMPONENT" > "$WORKING_HOME/.use-local-component"
|
echo "$USE_LOCAL_COMPONENT" >"$WORKING_HOME/.use-local-component"
|
||||||
|
|
||||||
pushd $WORKING_HOME
|
pushd $WORKING_HOME
|
||||||
|
|
||||||
IS_START_FRONTEND=false
|
IS_START_FRONTEND=false
|
||||||
|
|
||||||
|
# Make a user input (Y/N) to continue pull freeleaps.com code and start if N then exit
|
||||||
|
echo
|
||||||
|
read -p "Do you want to continue to pull freeleaps.com code and start the services? (Y/N): " user_input
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Initialize the compile environment
|
||||||
|
init_compile_env
|
||||||
|
|
||||||
# Make a user input (Y/N) to continue pull freeleaps.com code and start if N then exit
|
if [[ "$user_input" == "N" || "$user_input" == "n" ]]; then
|
||||||
echo
|
|
||||||
read -p "Do you want to continue to pull freeleaps.com code and start the services? (Y/N): " user_input
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Initialize the compile environment
|
|
||||||
init_compile_env
|
|
||||||
|
|
||||||
if [[ "$user_input" == "N" || "$user_input" == "n" ]]; then
|
|
||||||
|
|
||||||
# Echo as init job completed and exit
|
# Echo as init job completed and exit
|
||||||
reset_freeleaps_repo
|
reset_freeleaps_repo
|
||||||
@ -2360,16 +2340,15 @@ if [[ "$user_input" == "N" || "$user_input" == "n" ]]; then
|
|||||||
echo "==========================================================="
|
echo "==========================================================="
|
||||||
echo
|
echo
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IS_START_FRONTEND=true
|
IS_START_FRONTEND=true
|
||||||
|
|
||||||
|
# Run banckend service and frontend service in the container
|
||||||
|
compile_backend_service
|
||||||
|
compile_frontend_service
|
||||||
|
|
||||||
# Run banckend service and frontend service in the container
|
reset_freeleaps_repo
|
||||||
compile_backend_service
|
|
||||||
compile_frontend_service
|
|
||||||
|
|
||||||
reset_freeleaps_repo
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# 10. Final notification
|
# 10. Final notification
|
||||||
@ -2393,7 +2372,7 @@ reset_freeleaps_repo
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
# Save $GIT_BRANCH to .git-branch file
|
# Save $GIT_BRANCH to .git-branch file
|
||||||
echo "$GIT_BRANCH" > "$WORKING_HOME/.git-branch"
|
echo "$GIT_BRANCH" >"$WORKING_HOME/.git-branch"
|
||||||
}
|
}
|
||||||
|
|
||||||
# :command.function
|
# :command.function
|
||||||
@ -2591,7 +2570,6 @@ devbox_deinit_command() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# Clear the DevBox container logs
|
# Clear the DevBox container logs
|
||||||
if [[ "$CLEAR_LOGS" == "true" ]]; then
|
if [[ "$CLEAR_LOGS" == "true" ]]; then
|
||||||
log_info "Clearing logs in $WORKING_HOME/logs..."
|
log_info "Clearing logs in $WORKING_HOME/logs..."
|
||||||
@ -2787,8 +2765,6 @@ devbox_start_command() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check if $FREELEAPS_ENDPOINT is not empty and start the frontend and backend services
|
# Check if $FREELEAPS_ENDPOINT is not empty and start the frontend and backend services
|
||||||
if [[ "$FREELEAPS_ENDPOINT" != "" ]]; then
|
if [[ "$FREELEAPS_ENDPOINT" != "" ]]; then
|
||||||
# Sleep for 10 seconds to allow the services to start and echo 10 seconds increase from 1 to 10 in each second
|
# Sleep for 10 seconds to allow the services to start and echo 10 seconds increase from 1 to 10 in each second
|
||||||
@ -2892,7 +2868,6 @@ devbox_stop_command() {
|
|||||||
stoped_freeleaps_service_names+=("backend")
|
stoped_freeleaps_service_names+=("backend")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Combine the stoped_freeleaps_service_names array to a string with "and" if there are more than one service
|
# Combine the stoped_freeleaps_service_names array to a string with "and" if there are more than one service
|
||||||
if [[ "${#stoped_freeleaps_service_names[@]}" -gt 1 ]]; then
|
if [[ "${#stoped_freeleaps_service_names[@]}" -gt 1 ]]; then
|
||||||
stoped_freeleaps_service_names="frontend and backend"
|
stoped_freeleaps_service_names="frontend and backend"
|
||||||
@ -2900,12 +2875,10 @@ devbox_stop_command() {
|
|||||||
stoped_freeleaps_service_names="${stoped_freeleaps_service_names[0]}"
|
stoped_freeleaps_service_names="${stoped_freeleaps_service_names[0]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
exit_message="Stopped Freeleaps $stoped_freeleaps_service_names services successfully."
|
exit_message="Stopped Freeleaps $stoped_freeleaps_service_names services successfully."
|
||||||
exit_with_message "$exit_message" 0
|
exit_with_message "$exit_message" 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# If the DevBox container is not running, exit
|
# If the DevBox container is not running, exit
|
||||||
if [[ -z "$COMPONENT" ]]; then
|
if [[ -z "$COMPONENT" ]]; then
|
||||||
COMPONENTS=("mongodb" "rabbitmq" "gitea" "redis" "devbox")
|
COMPONENTS=("mongodb" "rabbitmq" "gitea" "redis" "devbox")
|
||||||
@ -2972,7 +2945,6 @@ devbox_stop_command() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
exit_with_message "Stopped Freeleaps services successfully. " 0
|
exit_with_message "Stopped Freeleaps services successfully. " 0
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3204,7 +3176,6 @@ devbox_restart_command() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
exit_with_message " DevBox services restarted successfully." 0
|
exit_with_message " DevBox services restarted successfully." 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3327,7 +3298,6 @@ parse_requirements() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# :command.parse_requirements
|
# :command.parse_requirements
|
||||||
devbox_init_parse_requirements() {
|
devbox_init_parse_requirements() {
|
||||||
# :command.fixed_flags_filter
|
# :command.fixed_flags_filter
|
||||||
@ -3564,7 +3534,7 @@ devbox_init_parse_requirements() {
|
|||||||
detected_arch=$(uname -m)
|
detected_arch=$(uname -m)
|
||||||
if [ "$detected_arch" = "x86_64" ]; then
|
if [ "$detected_arch" = "x86_64" ]; then
|
||||||
current_arch="amd64"
|
current_arch="amd64"
|
||||||
elif [ "$detected_arch" = "aarch64" ] || [ "$detected_arch" = "arm64" ] ; then
|
elif [ "$detected_arch" = "aarch64" ] || [ "$detected_arch" = "arm64" ]; then
|
||||||
current_arch="arm64"
|
current_arch="arm64"
|
||||||
else
|
else
|
||||||
echo "ERROR: Unsupported architecture detected: $detected_arch"
|
echo "ERROR: Unsupported architecture detected: $detected_arch"
|
||||||
@ -3574,7 +3544,6 @@ devbox_init_parse_requirements() {
|
|||||||
add_arg '--arch' "$current_arch"
|
add_arg '--arch' "$current_arch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$(get_arg '--devbox-container-name')" ]; then
|
if [ -z "$(get_arg '--devbox-container-name')" ]; then
|
||||||
add_arg '--devbox-container-name' "devbox"
|
add_arg '--devbox-container-name' "devbox"
|
||||||
fi
|
fi
|
||||||
@ -3623,7 +3592,6 @@ devbox_init_parse_requirements() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# :command.parse_requirements
|
# :command.parse_requirements
|
||||||
devbox_deinit_parse_requirements() {
|
devbox_deinit_parse_requirements() {
|
||||||
# :command.fixed_flags_filter
|
# :command.fixed_flags_filter
|
||||||
@ -3748,7 +3716,6 @@ devbox_start_parse_requirements() {
|
|||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@ -3924,7 +3891,6 @@ devbox_status_parse_requirements() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
-?*)
|
-?*)
|
||||||
printf "invalid option: %s\n" "$key" >&2
|
printf "invalid option: %s\n" "$key" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user