#!/bin/ash # SESSION_TYPE can be either 'VSESSION' or 'XSESSION' if [ "$SESSION_TYPE" = "XSESSION" ]; then # detect session command of the PVS-Manager session by looking at the xsession file # TODO Maybe the vmchooser should just expose the session file's name/path, or we # can define a new X-Property in the .desktop file that stops pvsclient from starting. PVSMGR_SESSION_CMD= PVSMGR_XSESSION_FILE="pvs2mgr.desktop" # the second directory should not be needed, but lets be compatible with the old crap...... for DIR in "/usr/share/xsessions" "/opt/openslx/xsessions"; do if [ -f "${DIR}/${PVSMGR_XSESSION_FILE}" ]; then # extract the exact command string PVSMGR_SESSION_CMD="$(grep -E "^Exec=.*$" "${DIR}/${PVSMGR_XSESSION_FILE}" |cut -c 6-)" break fi done if [ -n "${PVSMGR_SESSION_CMD}" ]; then # do not start pvsclient if we are running the pvs manager session [ "${SESSION_CMD}" == "${PVSMGR_SESSION_CMD}" ] && exit 0 fi fi # Download fresh copy of config file if possible . /opt/openslx/config PVSCONFIG= if [ -n "$SLX_PVS_CONFIG_URL" ]; then [ -z "$UID" ] && UID="$(id -u)" [ -z "$HOME" ] && HOME="$(getent passwd "$UID" | head -n 1 | awk -F ':' '{print $6}')" mkdir -p "$HOME/.tmp" if wget -T 5 -O "$HOME/.tmp/pvs2.ini.tmp" "$SLX_PVS_CONFIG_URL"; then mv -f "$HOME/.tmp/pvs2.ini.tmp" "$HOME/.tmp/pvs2.ini" fi if ! [ -s "$HOME/.tmp/pvs2.ini" ] && [ -s "/opt/openslx/pvs2/pvs2.ini" ]; then cp -f "/opt/openslx/pvs2/pvs2.ini" "$HOME/.tmp/pvs2.ini" fi if [ -s "$HOME/.tmp/pvs2.ini" ]; then PVSCONFIG="--config=$HOME/.tmp/pvs2.ini" fi fi # If the ENV var PVS has been set by vmchooser start pvsclient if [ "$PVS_AUTO_CONNECT" == "TRUE" ]; then pvsstartup $PVSCONFIG --auto & else pvsstartup $PVSCONFIG & fi # Finally, handle hybrid mode where the pvsmgr is launched on the second desktop. if [ "$SLX_PVS_HYBRID" == "yes" ]; then { wt="PVS2 Manager" pvsmgr "$PVSCONFIG" --manager-only & for i in 100 100 200 200 200 300 500 500 1000; do usleep $(( i * 1000 )) || sleep 1 wmctrl -r "$wt" -t 1 done } & fi exit 0