summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-09-10 15:27:04 +0200
committerSimon Rettberg2019-09-10 15:27:04 +0200
commit4a477fb2b60faeb075bc83dabfbc57c4a85b1fc1 (patch)
tree066721cbd1b8531bb0b7068951062807389c8834
parent[rootfs-stage31] Add more brain damage to setup_network_retry (diff)
downloadmltk-4a477fb2b60faeb075bc83dabfbc57c4a85b1fc1.tar.gz
mltk-4a477fb2b60faeb075bc83dabfbc57c4a85b1fc1.tar.xz
mltk-4a477fb2b60faeb075bc83dabfbc57c4a85b1fc1.zip
[run-virt] Add window manager respawn loop
Apparently on certain hw combinations openbox might crash while VMware is initializing. Try to restart it right away...
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc49
1 files changed, 37 insertions, 12 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc
index 749991bb..85b4a96a 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc
@@ -23,21 +23,46 @@ start_wm() {
# start RUNVIRT_DM determined above
writelog "Starting ${RUNVIRT_DM}."
- if [ "${RUNVIRT_DM}" = "fvwm2" ]; then
+ declare -a OPTS=
+ case "$RUNVIRT_DM" in
+ openbox|kwin|xfwm4|metacity)
+ OPTS+=( "--replace" )
+ ;;
+ fvwm2)
# fvwm2 is not even in the minilinux, so this might be obsolete...
- echo "EdgeScroll 0 0" > ${TMPDIR}/fvwm
- fvwm2 -f ${TMPDIR}/fvwm >/dev/null 2>&1 &
- else
- ${RUNVIRT_DM} >/dev/null 2>&1 &
- fi
- local RUNVIRT_DM_PID="$$"
- if ! kill -0 ${RUNVIRT_DM_PID} ; then
- # not fatal, just warn user
- notify_user "$RUNVIRT_VM stoppte unerwartet."
- return 1
- fi
+ echo "EdgeScroll 0 0" > "${TMPDIR}/fvwm"
+ OPTS+=( "-replace" "-f" "${TMPDIR}/fvwm" )
+ ;;
+ esac
+ {
+ dc=0
+ while true; do
+ s="$( date +%s )"
+ "${RUNVIRT_DM}" "${OPTS[@]}" &> /dev/null
+ ret="$?"
+ e="$( date +%s )"
+ duration="$(( e - s ))"
+ case "$ret" in
+ 0|129|130|143) exit 0 ;;
+ esac
+ if [ "$duration" -ge 3 ]; then
+ dc=0
+ elif [ "$(( dc++ ))" -gt 5 ]; then
+ notify_user "$RUNVIRT_DM crasht immer wieder."
+ exit 1
+ fi
+ done
+ } &
+ declare -rg RUNVIRT_DM_PID="$!"
+ add_cleanup stop_wm
return 0
}
+stop_wm() {
+ kill "$RUNVIRT_DM_PID"
+ usleep 500000
+ kill -9 "$RUNVIRT_DM_PID"
+}
+
## MAIN ##
call_post_source start_wm