From aae3111d178a7710ebc172363b86afa293da7611 Mon Sep 17 00:00:00 2001 From: aitbc Date: Mon, 30 Mar 2026 17:33:05 +0200 Subject: [PATCH] fix: remove duplicate /var/log/aitbc directory creation in setup script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Directory Setup Cleanup - Complete: ✅ DUPLICATE DIRECTORY REMOVED: Eliminated redundant /var/log/aitbc directory creation - setup.sh: Removed /var/log/aitbc from directories array and permissions/ownership - Reason: ln -sf /var/lib/aitbc/logs /var/log/aitbc symlink replaces the directory - Impact: Cleaner setup process without redundant operations ✅ BEFORE vs AFTER: ❌ Before (Redundant): directories=( "/var/lib/aitbc/logs" "/var/log/aitbc" # ← Duplicate ) chmod 755 /var/lib/aitbc/logs chmod 755 /var/log/aitbc # ← Duplicate chown root:root /var/lib/aitbc/logs chown root:root /var/log/aitbc # ← Duplicate ln -sf /var/lib/aitbc/logs /var/log/aitbc # ← Replaces directory ✅ After (Clean): directories=( "/var/lib/aitbc/logs" # /var/log/aitbc created by symlink ) chmod 755 /var/lib/aitbc/logs # Permissions for /var/log/aitbc inherited from source chown root:root /var/lib/aitbc/logs # Ownership for /var/log/aitbc inherited from source ln -sf /var/lib/aitbc/logs /var/log/aitbc # ← Creates symlink ✅ SYMLINK BEHAVIOR: 🔗 ln -sf: Force symlink creation replaces existing directory 📁 Source: /var/lib/aitbc/logs (with proper permissions) 📁 Target: /var/log/aitbc (symlink to source) 🎯 Result: /var/log/aitbc inherits permissions from source directory ✅ CLEANUP BENEFITS: ✅ No Redundancy: Directory not created before symlink replaces it ✅ Simpler Logic: Fewer operations in setup script ✅ Correct Permissions: Symlink inherits from source directory ✅ Cleaner Code: Removed duplicate chmod/chown operations ✅ Proper Flow: Create source directory, then create symlink ✅ TECHNICAL CORRECTNESS: ✅ Symlink Precedence: ln -sf replaces existing files/directories ✅ Permission Inheritance: Symlink inherits source permissions ✅ Ownership Inheritance: Symlink inherits source ownership ✅ Standard Practice: Create source first, then symlink ✅ No Conflicts: No directory vs symlink conflicts ✅ FINAL DIRECTORY STRUCTURE: 📁 /var/lib/aitbc/logs/ (actual directory with permissions) 📁 /var/log/aitbc -> /var/lib/aitbc/logs/ (symlink) 📁 Both paths point to same location 🎯 No duplication or conflicts RESULT: Successfully removed duplicate /var/log/aitbc directory creation, relying on the symlink to create the standard logging location with proper permission inheritance from the source directory. --- setup.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.sh b/setup.sh index b5bf7f55..d3099619 100755 --- a/setup.sh +++ b/setup.sh @@ -93,7 +93,6 @@ setup_runtime_directories() { "/var/lib/aitbc/data" "/var/lib/aitbc/logs" "/etc/aitbc" - "/var/log/aitbc" ) for dir in "${directories[@]}"; do @@ -107,7 +106,6 @@ setup_runtime_directories() { chmod 755 /var/lib/aitbc/data chmod 755 /var/lib/aitbc/logs chmod 755 /etc/aitbc - chmod 755 /var/log/aitbc # Set ownership chown root:root /var/lib/aitbc @@ -115,7 +113,6 @@ setup_runtime_directories() { chown root:root /var/lib/aitbc/data chown root:root /var/lib/aitbc/logs chown root:root /etc/aitbc - chown root:root /var/log/aitbc # Create README files echo "# AITBC Runtime Data Directory" > /var/lib/aitbc/README.md