#!/bin/sh

# Check for correct number of arguments
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <action> <mount-point>"
    exit 1
fi

# Define pipe path
PIPE="/tmp/g4-udev-usb-mount-pipe"

# Get absolute path for the mount point
PATH=$(readlink -f $2)

# Check if pipe exists
if [ ! -p "$PIPE" ]; then
    mkfifo "$PIPE"
fi

echo "$1 $PATH" > "$PIPE"