forked from freeleaps/freeleaps-pub
Update for redis cleanup when deinit
This commit is contained in:
parent
3d483a3b99
commit
86226130b6
@ -853,46 +853,46 @@ devbox_init_command() {
|
|||||||
|
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if ! echo "$USE_CUSTOM_REPOSITORY" | grep -Eq '^(https:\/\/|git@|git:\/\/|file:\/\/\/)[^ ]+\.git$'; then
|
if ! echo "$USE_CUSTOM_REPOSITORY" | grep -Eq '^(https:\/\/|git@|git:\/\/|file:\/\/\/)[^ ]+\.git$'; then
|
||||||
echo "ERROR: Invalid custom repository URL. Please provide a valid URL."
|
echo "ERROR: Invalid custom repository URL. Please provide a valid URL."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the custom repository is a git repository
|
||||||
|
# Test if the user can access the custom repository
|
||||||
|
echo "==> Testing access to custom repository..."
|
||||||
|
if ! git ls-remote "$USE_CUSTOM_REPOSITORY" &>/dev/null; then
|
||||||
|
echo "ERROR: Failed to access custom repository. Please check the repository URL."
|
||||||
|
echo "==> [INIT] DevBox environment initialization completed successfully, but access to the custom repository failed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CUSTOM_FOLDER_NAME=$(basename "$USE_CUSTOM_REPOSITORY" .git)
|
||||||
|
CUSTOM_DIR="$WORKING_HOME/$CUSTOM_FOLDER_NAME"
|
||||||
|
if [ ! -d "$CUSTOM_DIR" ]; then
|
||||||
|
pushd "$WORKING_HOME" > /dev/null
|
||||||
|
echo "Git cloning custom repository: $USE_CUSTOM_REPOSITORY"
|
||||||
|
git clone --depth 5 "$USE_CUSTOM_REPOSITORY"
|
||||||
|
else
|
||||||
|
pushd "$CUSTOM_DIR" > /dev/null
|
||||||
|
# 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
|
||||||
|
popd > /dev/null # Exit from $CUSTOM_DIR
|
||||||
|
rm -rf "$CUSTOM_DIR" # Remove $CUSTOM_DIR
|
||||||
|
rmdir "$CUSTOM_DIR" # Remove $CUSTOM_DIR
|
||||||
|
|
||||||
# Test if the user can access the custom repository
|
# Git clone custom repository
|
||||||
echo "==> Testing access to custom repository..."
|
echo "Cloning repository again: $USE_CUSTOM_REPOSITORY"
|
||||||
if ! git ls-remote "$USE_CUSTOM_REPOSITORY" &>/dev/null; then
|
sudo chown -R "$OWNER_GROUP" "$WORKING_HOME"
|
||||||
echo "ERROR: Failed to access custom repository. Please check the repository URL."
|
git clone --depth 5 "$USE_CUSTOM_REPOSITORY"
|
||||||
echo "==> [INIT] DevBox environment initialization completed successfully, but access to the custom repository failed."
|
else
|
||||||
exit 1
|
echo "Git pulling custom repository"
|
||||||
fi
|
git pull
|
||||||
|
fi
|
||||||
|
|
||||||
CUSTOM_FOLDER_NAME=$(basename "$USE_CUSTOM_REPOSITORY" .git)
|
popd > /dev/null
|
||||||
CUSTOM_DIR="$WORKING_HOME/$CUSTOM_FOLDER_NAME"
|
fi
|
||||||
if [ ! -d "$CUSTOM_DIR" ]; then
|
|
||||||
pushd "$WORKING_HOME" > /dev/null
|
|
||||||
echo "Git cloning custom repository: $USE_CUSTOM_REPOSITORY"
|
|
||||||
git clone --depth 5 "$USE_CUSTOM_REPOSITORY"
|
|
||||||
else
|
|
||||||
pushd "$CUSTOM_DIR" > /dev/null
|
|
||||||
# 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
|
|
||||||
popd > /dev/null # Exit from $CUSTOM_DIR
|
|
||||||
rm -rf "$CUSTOM_DIR" # Remove $CUSTOM_DIR
|
|
||||||
rmdir "$CUSTOM_DIR" # Remove $CUSTOM_DIR
|
|
||||||
|
|
||||||
# Git clone custom repository
|
|
||||||
echo "Cloning repository again: $USE_CUSTOM_REPOSITORY"
|
|
||||||
sudo chown -R "$OWNER_GROUP" "$WORKING_HOME"
|
|
||||||
git clone --depth 5 "$USE_CUSTOM_REPOSITORY"
|
|
||||||
else
|
|
||||||
echo "Git pulling custom repository"
|
|
||||||
git pull
|
|
||||||
fi
|
|
||||||
|
|
||||||
popd > /dev/null
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd $DOVBOX_CLI_DIR > /dev/null
|
pushd $DOVBOX_CLI_DIR > /dev/null
|
||||||
@ -1410,6 +1410,15 @@ devbox_deinit_command() {
|
|||||||
rm -f "$WORKING_HOME/.mongodb-instance"
|
rm -f "$WORKING_HOME/.mongodb-instance"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -f "$WORKING_HOME/.redis-instance" ]]; then
|
||||||
|
local redis_container_id
|
||||||
|
redis_container_id=$(cat "$WORKING_HOME/.redis-instance")
|
||||||
|
echo "==> Stopping and removing Redis container: $redis_container_id"
|
||||||
|
docker stop "$redis_container_id" &>/dev/null || true
|
||||||
|
docker rm "$redis_container_id" &>/dev/null || true
|
||||||
|
rm -f "$WORKING_HOME/.redis-instance"
|
||||||
|
fi
|
||||||
|
|
||||||
# Stop and remove RabbitMQ container
|
# Stop and remove RabbitMQ container
|
||||||
if [[ -f "$WORKING_HOME/.rabbitmq-instance" ]]; then
|
if [[ -f "$WORKING_HOME/.rabbitmq-instance" ]]; then
|
||||||
local rabbitmq_container_id
|
local rabbitmq_container_id
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user