#!/bin/dash
if test -x "$1"; then
	unset OPTIONS
	unset LD_LIBRARY_PATH

	# Some additional options for root
	if test $(id -u) -eq 0; then
		case "$1" in
			*'lmms-'*)	OPTIONS='--allowroot'					;;	# LMMS requires this custom option
			*)			export QTWEBENGINE_DISABLE_SANDBOX=1	;;	# Some newer AppImages may need it (Kiwix)
		esac
	fi

	exec "$@" $OPTIONS
else
	Xdialog --title "Warning" --msgbox "Please enable executable bit to run this AppImage." 0 0 10000
fi
