https://github.com/ftao1/update-vagrant-win64
Script to update vagrant on Windows
https://github.com/ftao1/update-vagrant-win64
shell vagrant windows wsl
Last synced: 3 months ago
JSON representation
Script to update vagrant on Windows
- Host: GitHub
- URL: https://github.com/ftao1/update-vagrant-win64
- Owner: ftao1
- License: mit
- Created: 2024-06-09T17:41:11.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-07T21:21:26.000Z (12 months ago)
- Last Synced: 2025-07-07T23:25:43.813Z (12 months ago)
- Topics: shell, vagrant, windows, wsl
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# update-vagrant-win64
A robust, production-ready bash script for downloading and verifying HashiCorp Vagrant for Windows systems.
## Features
- **Secure Downloads**: HTTPS downloads with SHA256 checksum verification
- **Retry Logic**: Automatic retry on network failures with exponential backoff
- **Input Validation**: Semantic version validation and command injection prevention
- **Backup Management**: Automatic backup creation with timestamp
- **Error Handling**: Comprehensive error handling with logging and rollback
- **Signal Handling**: Graceful cleanup on interruption
- **API Integration**: Uses HashiCorp API for version discovery
## Requirements
- `curl` - for downloading files
- `sha256sum` - for checksum verification
- Bash 4.0+ with `set -euo pipefail` support
## Usage
### Download a specific version
```bash
./update-vagrant-win64.sh 2.2.19
```
### Show available versions
```bash
./update-vagrant-win64.sh
```
### Show help
```bash
./update-vagrant-win64.sh --help
```
### Beta versions
```bash
./update-vagrant-win64.sh 2.3.0-beta1
```
## How it works
1. **Validation**: Validates version format and checks if version exists
2. **Download**: Downloads MSI and SHA256SUMS files from HashiCorp releases
3. **Verification**: Verifies SHA256 checksum for integrity
4. **Backup**: Creates timestamped backup of existing `vagrant.msi`
5. **Installation**: Copies verified MSI to `vagrant.msi` for manual installation
## Output Files
- `vagrant.msi` - The downloaded Vagrant MSI installer
- `vagrant.msi.backup.YYYYMMDD_HHMMSS` - Backup of previous MSI (if exists)
- `/tmp/vagrant-update.log` - Detailed operation log
## Security
- Uses HTTPS with proper certificate verification
- Sanitizes input to prevent command injection
- Verifies SHA256 checksums before installation
- Creates backups with automatic rollback on failure
## Manual Installation
After the script completes successfully, manually install the MSI file on your Windows system:
1. Transfer `vagrant.msi` to your Windows machine
2. Run the MSI installer as Administrator
3. Verify installation with `vagrant --version`
## Error Recovery
If the script fails or is interrupted:
- Temporary files are automatically cleaned up
- Backups are restored if available
- Detailed error information is logged to `/tmp/vagrant-update.log`
## License
MIT License - See LICENSE file for details.