- Complete Particle-OS rebranding from uBlue-OS - Professional installation system with standardized paths - Self-initialization system with --init and --reset commands - Enhanced error messages and dependency checking - Comprehensive testing infrastructure - All source scriptlets updated with runtime improvements - Clean codebase with redundant files moved to archive - Complete documentation suite
153 lines
No EOL
3.8 KiB
Bash
153 lines
No EOL
3.8 KiB
Bash
#!/bin/bash
|
|
|
|
# Transfer Particle-OS Testing Files to VM
|
|
# This script helps transfer the testing infrastructure to your Ubuntu VM
|
|
|
|
set -euo pipefail
|
|
|
|
# Configuration
|
|
VM_USER="particle-os"
|
|
VM_HOST="particle-os"
|
|
VM_DIR="~/particle-os-tools-test"
|
|
LOCAL_TOOLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# Colors for output
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
log_info() {
|
|
echo -e "${BLUE}[INFO]${NC} $1"
|
|
}
|
|
|
|
log_success() {
|
|
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
|
}
|
|
|
|
log_warning() {
|
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
}
|
|
|
|
# Check if SSH connection works
|
|
check_ssh() {
|
|
log_info "Testing SSH connection to $VM_USER@$VM_HOST..."
|
|
if ssh -o ConnectTimeout=5 -o BatchMode=yes "$VM_USER@$VM_HOST" "echo 'SSH connection successful'" 2>/dev/null; then
|
|
log_success "SSH connection established"
|
|
return 0
|
|
else
|
|
log_warning "SSH connection failed. Please ensure:"
|
|
log_warning "1. VM is running and accessible"
|
|
log_warning "2. SSH key authentication is set up"
|
|
log_warning "3. VM hostname/IP is correct"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
# Create remote directory
|
|
create_remote_dir() {
|
|
log_info "Creating remote directory: $VM_DIR"
|
|
ssh "$VM_USER@$VM_HOST" "mkdir -p $VM_DIR"
|
|
log_success "Remote directory created"
|
|
}
|
|
|
|
# Transfer testing files
|
|
transfer_files() {
|
|
log_info "Transferring testing files to VM..."
|
|
|
|
# Files to transfer
|
|
local files=(
|
|
"test-particle-os-complete.sh"
|
|
"TESTING_GUIDE.md"
|
|
"install-particle-os.sh"
|
|
"dev-install.sh"
|
|
"test-particle-os-system.sh"
|
|
"test-all-compiled-scripts.sh"
|
|
"test-installation.sh"
|
|
)
|
|
|
|
for file in "${files[@]}"; do
|
|
if [[ -f "$LOCAL_TOOLS_DIR/$file" ]]; then
|
|
log_info "Transferring: $file"
|
|
scp "$LOCAL_TOOLS_DIR/$file" "$VM_USER@$VM_HOST:$VM_DIR/"
|
|
log_success "Transferred: $file"
|
|
else
|
|
log_warning "File not found: $file"
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Set permissions on remote files
|
|
set_permissions() {
|
|
log_info "Setting permissions on remote files..."
|
|
ssh "$VM_USER@$VM_HOST" "chmod +x $VM_DIR/*.sh"
|
|
log_success "Permissions set"
|
|
}
|
|
|
|
# Test remote files
|
|
test_remote_files() {
|
|
log_info "Testing remote files..."
|
|
|
|
# Test if files exist
|
|
ssh "$VM_USER@$VM_HOST" "ls -la $VM_DIR/"
|
|
|
|
# Test if main test script is executable
|
|
if ssh "$VM_USER@$VM_HOST" "test -x $VM_DIR/test-particle-os-complete.sh"; then
|
|
log_success "Main test script is executable"
|
|
else
|
|
log_warning "Main test script is not executable"
|
|
fi
|
|
}
|
|
|
|
# Show next steps
|
|
show_next_steps() {
|
|
echo
|
|
log_success "=== Transfer Complete ==="
|
|
echo
|
|
log_info "Next steps on your VM:"
|
|
echo
|
|
echo "1. Navigate to the test directory:"
|
|
echo " cd $VM_DIR"
|
|
echo
|
|
echo "2. Run the complete test suite:"
|
|
echo " sudo ./test-particle-os-complete.sh"
|
|
echo
|
|
echo "3. Or follow the testing guide:"
|
|
echo " cat TESTING_GUIDE.md"
|
|
echo
|
|
echo "4. If tools aren't installed yet:"
|
|
echo " sudo ./install-particle-os.sh"
|
|
echo
|
|
log_info "The testing guide contains detailed instructions for all testing phases."
|
|
}
|
|
|
|
# Main function
|
|
main() {
|
|
log_info "Starting Particle-OS Testing Files Transfer"
|
|
log_info "VM: $VM_USER@$VM_HOST"
|
|
log_info "Remote Directory: $VM_DIR"
|
|
|
|
# Check SSH connection
|
|
if ! check_ssh; then
|
|
log_warning "Please fix SSH connection and run this script again"
|
|
exit 1
|
|
fi
|
|
|
|
# Create remote directory
|
|
create_remote_dir
|
|
|
|
# Transfer files
|
|
transfer_files
|
|
|
|
# Set permissions
|
|
set_permissions
|
|
|
|
# Test remote files
|
|
test_remote_files
|
|
|
|
# Show next steps
|
|
show_next_steps
|
|
}
|
|
|
|
# Run main function
|
|
main "$@" |