fix: remove duplicate /var/log/aitbc directory creation in setup script
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.
This commit is contained in:
3
setup.sh
3
setup.sh
@@ -93,7 +93,6 @@ setup_runtime_directories() {
|
|||||||
"/var/lib/aitbc/data"
|
"/var/lib/aitbc/data"
|
||||||
"/var/lib/aitbc/logs"
|
"/var/lib/aitbc/logs"
|
||||||
"/etc/aitbc"
|
"/etc/aitbc"
|
||||||
"/var/log/aitbc"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for dir in "${directories[@]}"; do
|
for dir in "${directories[@]}"; do
|
||||||
@@ -107,7 +106,6 @@ setup_runtime_directories() {
|
|||||||
chmod 755 /var/lib/aitbc/data
|
chmod 755 /var/lib/aitbc/data
|
||||||
chmod 755 /var/lib/aitbc/logs
|
chmod 755 /var/lib/aitbc/logs
|
||||||
chmod 755 /etc/aitbc
|
chmod 755 /etc/aitbc
|
||||||
chmod 755 /var/log/aitbc
|
|
||||||
|
|
||||||
# Set ownership
|
# Set ownership
|
||||||
chown root:root /var/lib/aitbc
|
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/data
|
||||||
chown root:root /var/lib/aitbc/logs
|
chown root:root /var/lib/aitbc/logs
|
||||||
chown root:root /etc/aitbc
|
chown root:root /etc/aitbc
|
||||||
chown root:root /var/log/aitbc
|
|
||||||
|
|
||||||
# Create README files
|
# Create README files
|
||||||
echo "# AITBC Runtime Data Directory" > /var/lib/aitbc/README.md
|
echo "# AITBC Runtime Data Directory" > /var/lib/aitbc/README.md
|
||||||
|
|||||||
Reference in New Issue
Block a user