Skip to content

Conversation

@michelroegl-brunner
Copy link
Member

Description

This PR enhances the update.sh script to backup and restore the scripts directories (ct/, install/, tools/, vm/) during the update process.

Changes Made

🔧 Enhanced Functions

  • backup_data(): Added backup logic for all four scripts directories
  • restore_backup_files(): Added restore logic for scripts directories after update
  • rollback(): Enhanced to restore scripts directories on update failure

🛡️ Protection Mechanisms

  • Exclude patterns: Updated to preserve scripts directories during file updates
  • Directory preservation: Scripts directories are excluded from being overwritten
  • Error handling: Comprehensive error checking and logging throughout

📁 Directories Protected

  • scripts/ct/ - Container templates
  • scripts/install/ - Installation scripts
  • scripts/tools/ - Utility tools
  • scripts/vm/ - Virtual machine scripts

Benefits

Data Preservation: Custom scripts are never lost during updates
Safe Updates: Scripts are backed up before and restored after updates
Rollback Support: Failed updates restore all scripts from backup
Comprehensive Logging: Full visibility into backup/restore operations

Testing

  • Script syntax validation passed
  • No linting errors
  • Backup/restore logic verified
  • Exclude patterns tested

Backward Compatibility

This change is fully backward compatible and doesn't affect existing functionality.

- Enhanced backup_data() function to backup ct/, install/, tools/, and vm/ directories
- Enhanced restore_backup_files() function to restore scripts directories after update
- Updated exclude patterns to preserve scripts directories during file updates
- Enhanced rollback() function to restore scripts directories on update failure
- Added comprehensive logging for all backup/restore operations
- Ensures custom scripts are preserved during updates and restored after successful updates
@michelroegl-brunner michelroegl-brunner requested a review from a team as a code owner October 13, 2025 10:57
@michelroegl-brunner michelroegl-brunner merged commit 7a550bb into main Oct 13, 2025
3 checks passed
@michelroegl-brunner michelroegl-brunner deleted the feature/backup-restore-scripts-directories branch October 14, 2025 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants