Advertisement
Guest User

Untitled

a guest
Jun 7th, 2025
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. # overlay/etc/rc.local
  2. #!/bin/sh
  3. echo "=== RC.LOCAL DEBUG START ===" >> /tmp/rc-local.log
  4. date >> /tmp/rc-local.log
  5.  
  6. if [ -b /dev/sda3 ]; then
  7. echo "Found /dev/sda3" >> /tmp/rc-local.log
  8. echo "Setting up persistent home with RAM caching..."
  9.  
  10. # Mount persistent partition temporarily
  11. mkdir -p /mnt/persistent
  12. mount /dev/sda3 /mnt/persistent
  13. echo "Mount result: $?" >> /tmp/rc-local.log
  14.  
  15. # Check what's in the persistent partition
  16. echo "Persistent partition contents:" >> /tmp/rc-local.log
  17. ls -la /mnt/persistent >> /tmp/rc-local.log
  18.  
  19. # Fix ownership of the mounted partition
  20. chown -R anon:anon /mnt/persistent
  21.  
  22. # Replace the copy section with:
  23. if [ -d "/mnt/persistent" ] && [ "$(ls -A /mnt/persistent)" ]; then
  24. echo "Copying files..." >> /tmp/rc-local.log
  25. rsync -av /mnt/persistent/ /home/anon/ --exclude='persistent' 2>>/tmp/rc-local.log || true
  26. echo "Copy completed" >> /tmp/rc-local.log
  27. fi
  28. # Fix ownership
  29. chown -R anon:anon /home/anon
  30.  
  31. # Keep persistent mount available for syncing
  32. mkdir -p /home/anon/.persistent-sync
  33. mount --bind /mnt/persistent /home/anon/.persistent-sync
  34. chown -R anon:anon /home/anon/.persistent-sync
  35.  
  36. echo "Home loaded from persistent storage. Use 'sync-home' to save changes."
  37. echo "Setup complete" >> /tmp/rc-local.log
  38. else
  39. echo "/dev/sda3 not found" >> /tmp/rc-local.log
  40. fi
  41.  
  42. echo "=== RC.LOCAL DEBUG END ===" >> /tmp/rc-local.log
  43.  
  44. # Start background sync daemon
  45. (
  46. while true; do
  47. sleep 300 # Sync every 5 minutes
  48. if [ -d "/home/anon/.persistent-sync" ]; then
  49. rsync -av --delete /home/anon/ /home/anon/.persistent-sync/ \
  50. --exclude='.persistent-sync' \
  51. --exclude='.cache' >/dev/null 2>&1
  52. fi
  53. done
  54. ) &
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement