mirror of
https://github.com/srlabs/blue-merle.git
synced 2024-12-22 21:59:25 -05:00
mac-wipe: avoid accumulating mounts
If we mount over and over again we may consume memory unnecessarily.
This commit is contained in:
parent
4beae781a2
commit
4f584b4b6c
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env ash
|
#!/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)"
|
tmpdir="$(mktemp -d)"
|
||||||
# We mount a tmpfs so that the client database will be stored in memory only
|
# 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
|
/etc/init.d/gl-tertf stop
|
||||||
cp -a /etc/oui-tertf/client.db "$tmpdir"
|
cp -a /etc/oui-tertf/client.db "$tmpdir"
|
||||||
shred /etc/oui-tertf/client.db || rm -f /etc/oui-tertf/client.db
|
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
|
mount -t tmpfs / /etc/oui-tertf
|
||||||
cp -a "$tmpdir/client.db" /etc/oui-tertf/client.db
|
cp -a "$tmpdir/client.db" /etc/oui-tertf/client.db
|
||||||
|
Loading…
Reference in New Issue
Block a user