#!/bin/sh

if [ "$(id -u)" -ne 0 ]; then
	echo 'live-installer must be run with sudo.' >&2
	exit 1
fi

# Inject eject message within plymouth theme
msg="SubTitle=Remove the installation media and press ENTER to continue..."
theme_file=/usr/share/plymouth/themes/mint-logo/mint-logo.plymouth
sed -i -e "/${msg}/d" ${theme_file}
sed -i -e "/\[reboot\]/a ${msg}" ${theme_file}
sed -i -e "/\[shutdown\]/a ${msg}" ${theme_file}

optimize='OO'; case "$*" in *--debug*) unset optimize; esac

# Slideshow is broken in virtualbox without this.
export WEBKIT_DISABLE_COMPOSITING_MODE=1

python3 -tt${optimize} //usr/lib/live-installer/main.py "$@"
