Skip to content

Commit

Permalink
win98: auto-restart x11vnc
Browse files Browse the repository at this point in the history
  • Loading branch information
io12 committed Dec 20, 2023
1 parent f968fd7 commit efca8ee
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions makeWin98Image/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ let
hash = "sha256-47M3azg2ikc7VlFTEJA7elPGovAtSmhOtZqq8j2TJmU=";
};
dosboxConf = writeText "dosbox.conf" ''
[cpu]
turbo=on
stop turbo on key = false
[autoexec]
if exist win98.img (
imgmount c win98.img
Expand Down Expand Up @@ -113,7 +117,7 @@ let
}
}
send_user "\n### OPENING SHUT DOWN PROMPT ###\n"
exec ${vncdoWrapper} key up key enter
exec ${vncdoWrapper} key u
send_user "\n### TRIGGERING SHUTDOWN ###\n"
exec ${vncdoWrapper} key enter
send_user "\n### OMG DID IT WORK???!!!! ###\n"
Expand All @@ -136,19 +140,24 @@ let
} ''
echo "iso src: ${iso}"
cp --no-preserve=mode ${iso} win98.iso
runDosboxVnc() {
(
while true; do
DISPLAY=:99 XAUTHORITY=/tmp/xvfb.auth x11vnc -many -shared -display :99 >/dev/null 2>&1 || true
echo RESTARTING VNC
done
) &
runDosbox() {
xvfb-run -l -s ":99 -auth /tmp/xvfb.auth -ac -screen 0 800x600x24" dosbox-x -conf ${dosboxConf} || true &
dosboxPID=$!
DISPLAY=:99 XAUTHORITY=/tmp/xvfb.auth x11vnc -many -shared -display :99 >/dev/null 2>&1 &
}
echo STAGE 1
runDosboxVnc
runDosbox
${expectScript} &
expectScriptPID=$!
wait $dosboxPID
# Run dosbox-x a second time since it exits during the install
echo STAGE 2
runDosboxVnc
runDosbox
wait $dosboxPID
echo DOSBOX EXITED
wait $expectScriptPID
Expand Down

0 comments on commit efca8ee

Please sign in to comment.