2023-10-17 13:42:22 -04:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
|
|
|
|
# MAC addresses of connected clients are stored in a sqlite database.
|
|
|
|
# Having the database seems to be necessary for the device to be working properly.
|
|
|
|
# We intent to have the device store the database in RAM rather than on flash.
|
|
|
|
# We replace the directory with a memory-backed tmpfs which is as volatile as we can make it.
|
|
|
|
|
2023-10-18 07:24:47 -04:00
|
|
|
# We want to run ahead of "gl-tertf" which, currently, has a prioprity of 60.
|
|
|
|
# We also want to run ahead of "gl_clients" which has 99.
|
2023-10-18 16:37:12 -04:00
|
|
|
START=9
|
2023-10-17 13:42:22 -04:00
|
|
|
STOP=99
|
|
|
|
|
|
|
|
start() {
|
2023-10-18 08:27:55 -04:00
|
|
|
tmpdir="$(mktemp -d)"
|
|
|
|
# We mount a tmpfs so that the client database will be stored in memory only
|
|
|
|
mount -t tmpfs / "$tmpdir"
|
|
|
|
cp -a /etc/oui-tertf/client.db "$tmpdir"
|
2023-10-18 15:06:46 -04:00
|
|
|
shred --force --remove /etc/oui-tertf/client.db || rm -f /etc/oui-tertf/client.db
|
2023-10-18 08:27:55 -04:00
|
|
|
# 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
|
|
|
|
umount -t tmpfs -l "$tmpdir"
|
2023-10-17 13:42:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
shred /etc/oui-tertf/client.db || rm -f /etc/oui-tertf/client.db
|
|
|
|
}
|
|
|
|
|