#!/bin/bash -x

SCRIPT_DIR=$(dirname "$BASH_SOURCE")
slot=${SCRIPT_DIR%????????}
if [ $slot = "/sdcard" ]; then DEVICE=mmcblk0p1; fi
if [ $slot = "/sdcard2" ]; then DEVICE=mmcblk1p1; fi

if [ "$(cat /etc/rootfs_version | grep -i VS)" ]; then
  killall -9 evercade_menu_cobalt
elif [ $(grep -c "Evercade RootFS" /etc/rootfs_version) -gt 0 ]; then
  killItWithFire
fi

umount -l /mnt$slot
mount $slot/ /mnt$slot

if [ "$(cat /etc/rootfs_version | grep -i VS)" ]; then
  cd "/opt/menu/menu2.0/"
  ./evercade_menu_cobalt
elif [ $(grep -c "Evercade RootFS" /etc/rootfs_version) -gt 0 ]; then
  gameOn
fi
