24 lines
688 B
Bash
24 lines
688 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
|
||
|
|
set -euo pipefail # exit on error
|
||
|
|
|
||
|
|
# check for `fuse-overlayfs` executable
|
||
|
|
if ! command -v fuse-overlayfs &>/dev/null; then
|
||
|
|
echo "fuse-overlayfs could not be found"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# check if already mounted; im /tmp so it's ephemeral
|
||
|
|
if [ -d /tmp/media-for-rave ]; then exit 0; fi
|
||
|
|
|
||
|
|
# mount the music directory; assumes a fstab entry like:
|
||
|
|
# /dev/sda1 /mnt/Media ext4 defaults 0 0
|
||
|
|
# or equivalent; as long as it mounts to /mnt/Media
|
||
|
|
sudo mount /mnt/Media
|
||
|
|
|
||
|
|
# create the overlayfs
|
||
|
|
mkdir -p /tmp/overlay /tmp/work /tmp/media-for-rave
|
||
|
|
|
||
|
|
# mount the overlayfs
|
||
|
|
fuse-overlayfs -o lowerdir=/mnt/Media/Music -o upperdir=/tmp/overlay -o workdir=/tmp/work /tmp/media-for-rave
|