diff --git a/files/lib/blue-merle/mac-wipe.sh b/files/lib/blue-merle/mac-wipe.sh index b32ce58..29a3fba 100644 --- a/files/lib/blue-merle/mac-wipe.sh +++ b/files/lib/blue-merle/mac-wipe.sh @@ -1,6 +1,6 @@ #!/usr/bin/env ash -# This script wipes all MAC address data from the device and is called upon boot +# This script ensures that MAC addresses are stored on volatile memory rather than flash tmpdir="$(mktemp -d)" # We mount a tmpfs so that the client database will be stored in memory only @@ -8,6 +8,8 @@ mount -t tmpfs / "$tmpdir" /etc/init.d/gl-tertf stop cp -a /etc/oui-tertf/client.db "$tmpdir" shred /etc/oui-tertf/client.db || rm -f /etc/oui-tertf/client.db +# If this script runs multiple times, we accumulate mounts; we try to avoid having mounts over mounts, so we unmount any existing tmpfs +umount -t tmpfs -l /etc/oui-tertf mount -t tmpfs / /etc/oui-tertf cp -a "$tmpdir/client.db" /etc/oui-tertf/client.db