website/home/scripts/tmpfs_dirs.sh
corentin e3ddda951f jimmy/events (#6)
Co-authored-by: Jimmy Vargo <james@ayo.tokyo>
Reviewed-on: ayo/website#6
2024-04-09 17:12:41 +09:00

17 lines
No EOL
350 B
Bash
Executable file

#! /bin/bash
if [[ $(uname) != "Linux" ]]; then
echo "Not on Linux : no tmpfs"
exit
fi
CWD=$(cd -P . && pwd)
readarray -t TMPFS_DIRS < <(df -lt tmpfs --output=target | tail -n +2)
if [[ " ${TMPFS_DIRS[*]} " =~ " ${CWD}/public " ]]; then
echo "public alread a tmpfs"
else
echo "Mounting public as tmpfs"
sudo mount -m -t tmpfs tmpfs public
fi