Old validation:
exists = os.path.isdir(check_path) and len(os.listdir(check_path)) > 0
This would:
- ✗ Allow backing up slot 20 (445M leftover data) - WRONG!
- ✗ Allow backing up slot 6 (20K overhead) - WRONG!
- ✗ Try to clone from empty slots - FAIL!
New validation (just applied):
# Check if essential directories exist
has_usr_bin = os.path.isdir(os.path.join(check_path, 'usr', 'bin'))
has_etc = os.path.isdir(os.path.join(check_path, 'etc'))
has_lib = os.path.isdir(os.path.join(check_path, 'lib'))
# If missing essential directories, it's empty
if not (has_usr_bin and has_etc and has_lib):
return False # Reject the operation
Now the Backup/Clone System Will:
✓ Accept Valid Slots:
- Slot 1-4: Internal images
- Slot 10: TNAP 5.1
- Slot 12: OpenSPA 8.4
- Slot 15: Define 7.0
- Slot 16-17: TNAP 6
- Slot 18: OpenPLi 9.1
- Slot 19: OpenViX 6.7
- Slot 21-22: TNAP 6.1 ✓
- Slot 24-25: zukonMOD Hyperion
✗ Reject Empty Slots:
- Slot 5, 6, 7, 8, 9 (20K-45M overhead)
- Slot 11, 13, 14 (filesystem overhead)
- Slot 20 (445M leftover data) ← Previously would have failed mid-backup!
- Slot 23, 26, 27, 28, 29 (empty)
What This Means:
1. Backup ANY installed slot → ✓ Works for slots 1-29 (if installed)
2. Clone FROM any installed slot → ✓ Works correctly
3. Clone TO any empty slot → ✓ Works (empties are valid targets)
4. Prevents backup of empty slots → ✓ Won't waste time/space
5. Extended slots (5-29) → ✓ Fully supported
Example Scenarios:
Scenario 1: Backup Slot 21 ✓
python3 backup_slot.py 21 /media/usb
- Validates slot 21 has complete image ✓
- Backs up kernel + rootfs ✓
- Creates: slot21_TNAP_6.1_20260120.tar.gz ✓
Scenario 2: Try to Backup Slot 20 ✗
python3 backup_slot.py 20 /media/usb
- Checks slot 20 ✗
- Missing /usr/bin, /etc, /lib ✗
- Rejects: "Slot 20 does not contain a valid image" ✓
- Prevents wasted time!
Scenario 3: Clone Slot 21 → Slot 23 ✓
python3 clone_slot.py 21 23
- Validates slot 21 has image ✓
- Validates slot 23 is empty or can be overwritten ✓
- Clones successfully ✓
Files Fixed:
1. ✓ list_slots.py - Display/detection
2. ✓ backup_slot.py - Backup validation (just fixed)
3. ✓ clone_slot.py - Clone validation (just fixed)