Testing Auto-Update Script
This guide shows you how to test the auto-update script in a Docker container that simulates the router environment.
Quick Start
Run the automated test script from the router-files directory:
cd router-files
./docker/test-in-docker.sh
This will:
- Build a Docker image with the router environment
- Run the auto-update script inside the container
- Display all the logging output
What's Simulated
The Docker container creates:
/root/scripts/auto-update.sh- The auto-update script/root/supabase_config.env- Supabase configuration/etc/router_imei- Test IMEI:863141055240095/root/scripts/version.txt- Initial version:v2.1.0/var/log/auto-update.log- Log file
Expected Output
The script will:
- Connect to Supabase to check for updates
- Download the update package if a newer version is available
- Verify the checksum
- Extract and install the update
- Test the updated scripts
Manual Testing
To test interactively:
# Build the image
docker build -t router-test -f docker/Dockerfile.test router-files
# Run interactively
docker run --rm -it router-test /bin/sh
# Inside container
cd /root/scripts
./auto-update.sh
Rebuilding
After modifying the script, rebuild:
./docker/test-in-docker.sh
Or manually:
docker build -t router-test -f docker/Dockerfile.test router-files
Debugging
All logs are written to both the console and /var/log/auto-update.log inside the container.
The script includes extensive logging to help identify issues at each step:
- Before curl: Shows URL, IMEI, and API key presence
- After curl: Shows exit code and HTTP status
- Response processing: Shows response length and preview
- JSON parsing: Shows each parsing step
- Update process: Shows download, verify, install, and test status