CollisionAvoidance/scripts/verify_offline_packages.sh

84 lines
2.4 KiB
Bash

#!/bin/bash
# Color definitions for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Logging functions
log_info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
log_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Get script directory and project root
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "${SCRIPT_DIR}")"
PROJECT_NAME="$(basename "${PROJECT_ROOT}")"
# Check if the archive exists
ARCHIVE_PATH="${PROJECT_ROOT}/../${PROJECT_NAME}.tar.gz"
if [ ! -f "${ARCHIVE_PATH}" ]; then
log_error "Archive file not found: ${ARCHIVE_PATH}"
log_error "Please run prepare_offline_packages.sh first"
exit 1
fi
# Create a temporary test directory
TEST_DIR=$(mktemp -d)
log_info "Creating test directory: ${TEST_DIR}"
# Copy archive to test directory
cp "${ARCHIVE_PATH}" "${TEST_DIR}/"
# Print verification steps
echo -e "\n${GREEN}Verification Steps:${NC}"
echo "1. Prepare a clean CentOS 7 system (physical machine or VM)"
echo "2. Copy these files to the test system:"
echo " - ${ARCHIVE_PATH}"
echo ""
echo "3. On the test system, run:"
echo " cd /tmp"
echo " tar xzf ${PROJECT_NAME}.tar.gz"
echo " cd ${PROJECT_NAME}"
echo " sudo ./scripts/deploy.sh"
echo ""
echo "4. Verify the installation:"
echo " - Check if all packages are installed:"
echo " rpm -qa | grep -E 'boost|cmake3|python3'"
echo ""
echo " - Check Python packages:"
echo " pip3 list | grep -E 'flask|werkzeug|click|itsdangerous|Jinja2|MarkupSafe'"
echo ""
echo " - Check if service is running:"
echo " systemctl status collision-avoidance"
echo ""
echo " - Check service logs:"
echo " journalctl -u collision-avoidance"
echo ""
echo " - Check ports:"
echo " ss -tunlp | grep -E '8010|8081'"
echo ""
echo "5. Test the service:"
echo " - Open http://localhost:8010 in browser"
echo " - Check if mock server is running on port 8081"
echo ""
echo "If any step fails, please check:"
echo "1. /var/log/messages for system errors"
echo "2. journalctl -u collision-avoidance for service errors"
echo "3. Check if all required ports are available"
echo "4. Verify system requirements (memory, disk space)"
echo ""
log_info "Verification guide has been created"
echo -e "Follow the steps above to verify the installation in a clean environment"
# Clean up
rm -rf "${TEST_DIR}"