Without backup, cp -a root.x86_64 root.x86_64/var/lib/machines/workspace creates incomplete containers (only var/ directory). Solution: Backup before creating /var/lib/machines directory, then copy the clean backup to workspace and restore-img.
28 lines
753 B
Bash
28 lines
753 B
Bash
#!/bin/bash
|
|
# Create child containers inside aios for ai user
|
|
# Backup aios before creating /var/lib/machines to avoid recursion
|
|
|
|
ROOTFS="root.x86_64"
|
|
|
|
echo "=== Creating child containers ==="
|
|
|
|
# Backup current aios to temp location (before creating /var/lib/machines)
|
|
echo "Backing up aios..."
|
|
cp -a $ROOTFS /tmp/aios-backup-$$
|
|
|
|
# Create directory for child containers
|
|
mkdir -p $ROOTFS/var/lib/machines
|
|
|
|
# Copy backup as workspace
|
|
echo "Creating workspace container..."
|
|
cp -a /tmp/aios-backup-$$ $ROOTFS/var/lib/machines/workspace
|
|
|
|
# Copy backup as restore-img
|
|
echo "Creating restore-img container..."
|
|
cp -a /tmp/aios-backup-$$ $ROOTFS/var/lib/machines/restore-img
|
|
|
|
# Cleanup temp backup
|
|
rm -rf /tmp/aios-backup-$$
|
|
|
|
echo "✓ Child containers created"
|