#!/bin/sh

DEVICEUSER=ceres

# Manually ensure that the /dev/mtp entries are owned by the `mtp` group so that the `ceres` user can control mtp.
systemctl start dev-mtp.mount

case $1 in
    "start")
        [ -n "$DEVICEUSER" ] && exec su -l $DEVICEUSER -c "systemctl --user start buteo-mtp.service"
        exit 1
        ;;
    "stop")
        [ -n "$DEVICEUSER" ] && exec su -l $DEVICEUSER -c "systemctl --user stop buteo-mtp.service"
        exit 1
        ;;
    *)
        echo "Usage: $0 start|stop"
        exit 1
        ;;
esac
