fix: windows check added to vagrant config
This commit is contained in:
parent
698e67d8c0
commit
f39f98b319
1 changed files with 21 additions and 7 deletions
|
|
@ -10,10 +10,15 @@ if ! command -v vagrant &> /dev/null; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Check if VirtualBox is installed
|
||||
if ! command -v VBoxManage &> /dev/null; then
|
||||
# Check if running on Windows
|
||||
if [[ "$(uname -s)" == *"MINGW"* || "$(uname -s)" == *"CYGWIN"* || "$OSTYPE" == "msys" ]]; then
|
||||
echo "Detected Windows environment. Skipping VBoxManage check as Vagrant will handle VirtualBox interactions."
|
||||
else
|
||||
# Check if VirtualBox is installed (for non-Windows systems)
|
||||
if ! command -v VBoxManage &> /dev/null; then
|
||||
echo "VirtualBox is not installed. Please install VirtualBox to proceed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
|
@ -72,6 +77,17 @@ echo "Network information gathered successfully."
|
|||
echo "Gathering Vagrant port information..."
|
||||
|
||||
|
||||
# Ensure unique ports are added to the vagrant_ports array
|
||||
add_unique_port() {
|
||||
local port=$1
|
||||
for existing_port in "${vagrant_ports[@]}"; do
|
||||
if [ "$existing_port" == "$port" ]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
vagrant_ports+=("$port")
|
||||
}
|
||||
|
||||
while read -r line; do
|
||||
echo "Processing line: $line"
|
||||
|
||||
|
|
@ -81,15 +97,13 @@ while read -r line; do
|
|||
vagrant_ports+=("$port")
|
||||
done < <(vagrant ssh-config | grep Port)
|
||||
|
||||
|
||||
|
||||
while read -r line; do
|
||||
echo "Processing line: $line"
|
||||
|
||||
# Extract the port number
|
||||
port=$(echo "$line" | awk '{print $2}')
|
||||
echo "Extracted port: $port"
|
||||
vagrant_ports+=("$port")
|
||||
add_unique_port "$port"
|
||||
done < <(vagrant ssh-config | grep Port)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue