#!/bin/sh

ROOTSTON="/usr/bin/rootston"
ROOTSTON_INI="/usr/share/phosh/rootston.ini"

if [ -x /usr/lib/wlroots/rootston ]; then
  ROOTSTON=/usr/lib/wlroots/rootston
elif [ -x /usr/bin/rootston ]; then
  ROOTSTON=/usr/bin/rootston
elif [ -x /usr/lib/wlroots/rootston ]; then
  ROOTSTON=/usr/lib/wlroots/rootston
fi

if [ -f "/etc/phosh/rootston.ini" ]; then
  ROOTSTON_INI=/etc/phosh/rootston.ini
fi

# Run gnome-session through a login shell so it picks
# variables from /etc/profile.d (XDG_*)
exec "${ROOTSTON}" -C "${ROOTSTON_INI}" -E "bash -lc 'gnome-session --disable-acceleration-check --session=phosh'"
