if ! grep -q "tee /var/log/rc.local.log" /etc/rc.d/rc.local;then
# Insert logging line after the shebang/header
sed -i '/^#.*Local system/a\\n# Log all boot output to file while still showing on console\nexec > >(tee /var/log/rc.local.log) 2>&1' /etc/rc.d/rc.local
echo"added boot logging to rc.local"
else
echo"rc.local already has boot logging, skipping"
fi
# Add tailscale, autofs, mpd to rc.local if not present
if ! grep -q "rc.tailscale" /etc/rc.d/rc.local;then
cat >> /etc/rc.d/rc.local << 'RCEOF'
# Start tailscale daemon
if[ -x /etc/rc.d/rc.tailscale ];then
/etc/rc.d/rc.tailscale start
fi
# Start autofs (handles NFS mounts on demand)
if[ -x /etc/rc.d/rc.autofs ];then
/etc/rc.d/rc.autofs start
fi
# Start MPD (autofs will mount /mnt/media on first access)
if[ -x /etc/rc.d/rc.mpd ];then
/etc/rc.d/rc.mpd start
fi
RCEOF
echo"added tailscale/autofs/mpd to rc.local"
else
echo"rc.local already has tailscale entry, skipping"