Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # overlay/etc/rc.local
- #!/bin/sh
- echo "=== RC.LOCAL DEBUG START ===" >> /tmp/rc-local.log
- date >> /tmp/rc-local.log
- if [ -b /dev/sda3 ]; then
- echo "Found /dev/sda3" >> /tmp/rc-local.log
- echo "Setting up persistent home with RAM caching..."
- # Mount persistent partition temporarily
- mkdir -p /mnt/persistent
- mount /dev/sda3 /mnt/persistent
- echo "Mount result: $?" >> /tmp/rc-local.log
- # Check what's in the persistent partition
- echo "Persistent partition contents:" >> /tmp/rc-local.log
- ls -la /mnt/persistent >> /tmp/rc-local.log
- # Fix ownership of the mounted partition
- chown -R anon:anon /mnt/persistent
- # Replace the copy section with:
- if [ -d "/mnt/persistent" ] && [ "$(ls -A /mnt/persistent)" ]; then
- echo "Copying files..." >> /tmp/rc-local.log
- rsync -av /mnt/persistent/ /home/anon/ --exclude='persistent' 2>>/tmp/rc-local.log || true
- echo "Copy completed" >> /tmp/rc-local.log
- fi
- # Fix ownership
- chown -R anon:anon /home/anon
- # Keep persistent mount available for syncing
- mkdir -p /home/anon/.persistent-sync
- mount --bind /mnt/persistent /home/anon/.persistent-sync
- chown -R anon:anon /home/anon/.persistent-sync
- echo "Home loaded from persistent storage. Use 'sync-home' to save changes."
- echo "Setup complete" >> /tmp/rc-local.log
- else
- echo "/dev/sda3 not found" >> /tmp/rc-local.log
- fi
- echo "=== RC.LOCAL DEBUG END ===" >> /tmp/rc-local.log
- # Start background sync daemon
- (
- while true; do
- sleep 300 # Sync every 5 minutes
- if [ -d "/home/anon/.persistent-sync" ]; then
- rsync -av --delete /home/anon/ /home/anon/.persistent-sync/ \
- --exclude='.persistent-sync' \
- --exclude='.cache' >/dev/null 2>&1
- fi
- done
- ) &
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement