Cleaning up on factory reset

I have a script that automatically does some configuration (like http redirect to https) that I run on my GL-AR705S fleet whenever I need to add a new one. I've noticed that anything saved to /root remains after a factory reset. So, I have 2 questions:

  1. Are the files remaining in /root expected behavior?

  2. Is there a directory that is routinely wiped that I can use as an install directory to ensure that I'm installing onto a true clean install?

I'm currently running OpenWrt 18.06.1, r7258-5eb055306f

https://openwrt.org/docs/guide-user/troubleshooting/backup_restore#customize_and_verify

Thanks for the link.

This really doesn't help my use case, though. The functionality that I really need is for a user to be able to hold down the reset button for ~10 seconds and get a complete factory reset. Currently, scripts and files installed in the /root directory are not removed.

End users are a mixed group, technologically, and I need the reset to be as close to a 1-button solution as possible. a backup-> restore regime through LuCi isn't feasible for my use case.

sed -i -e "/^\/root/d" /etc/sysupgrade.conf
sysupgrade -l | grep -e ^/root