Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: binarydemon on January 29, 2018, 10:04:12 AM
-
Hi,
Some quick background, I'm trying to create a DOSBox distro - a LIVEUSB where TinyCore starts up and loads a FullScreen DOSBox. I'm largely following the setup described here: http://forum.tinycorelinux.net/index.php?topic=17948 I'm still very new to Linux, but when I'm motivated I'm a quick learner.
Now the question, while booting directly to Full Screen DOSBox was easy enough, I became concerned there might be issues with incorrect shutdown - especially since it's a usb device.
What I want to do is: dosbox && sudo poweroff
When I boot into X, and type this in the terminal manually it works perfectly: DosBox runs, when the user types the dos command 'exit', dosbox closes, poweroff executes, and the machine shuts down.
When I run 'dosbox && sudo poweroff &' from a file in /.X.d/ tinycore loads and immediately powers off. Amusing and frustrating. Basically both commands run concurrently there.
I attempted to put 'dosbox && sudo poweroff &' in /opt/bootsync.sh but it seemed to be ignored (not sure if thats because of my install type or a scripting error).
Is there another way to autorun this after X has loaded, or see a mistake?
-BinaryDemon
-
Hi binarydemon
If it were me I'd create a file in /home/tc/.local/bin called StartDosbox containing:
dosbox
sudo poweroff
and place the command:
StartDosbox &
in a file in .X.d.
-
I'll test in a few hours and report back. Thanks!
-
Sorry to report, same behavior.
When I execute StartDosBox.sh from terminal it works perfect. When the same script is called from .X.d. both dosbox and sudo poweroff execute at the same time.
Another thing puzzling me that is likely unrelated, any reason why the boot code 'noicons' would be ignored? Everything else on my append line is executing correctly, but the wbar stubbornly remains.
-
Hi binarydemon
If it were me I'd create a file in /home/tc/.local/bin called StartDosbox containing:
dosbox
sudo poweroff
I think that should have been:
#!/bin/sh
dosbox
sudo poweroff
-
Yeah I did that. And chmod +x StartDosBox.sh
I think I need another way to launch it, maybe use a scheduler like cron.
-
I thought for sure if in .X.d. that I did something like this:
xterm -e StartDosBox.sh
that surely it would behave normally since I'm launching a whole new instance of the terminal, BUT IT STILL started DosBox then immediately shutdown.
-
Hi binarydemon
OK, one last idea:
#!/bin/sh
exec /usr/local/bin/dosbox
sudo poweroff
-
Please double-check that there's no stray shutdown command somewhere, the separate file should work (without exec, that replaces the script). It would be very weird behavior from dosbox to daemonize automatically.
edit: or perhaps dosbox quits for some reason? Replace shutdown with some benign command, like editor, and redirect dosbox errors to some file.
-
Curaga,
You are on to something. When I replace DosBox with Editor, the script behaves properly. DosBox doesnt appear to be crashing tho -
I did:
dosbox
sleep 5
sudo poweroff
as a test, and I can see DosBox completely loads, then poweroff shuts everything down.
I guess I might have to use a script that constantly checks if DosBox process is running, it just seems like an ugly solution tho.
* On a sidenote, thank you for suggesting testing with Editor - I didnt know tinycore had that packaged with it, I was installing nano each time i needed it. :)
-
Rich - I tried exec, and wait, but the result was the same everytime. Crontab @reboot looked interesting but cause other issues.
Just wanted to follow up with my ugly workaround, incase anyone else is experiencing similar issues.
Now in .X.d - I start two scripts:
StartDosBox (which is just a 5 second sleep then dosbox)
and
MonitorDosBox: (which I run with nice -n 19 since I hate having a while loop constantly running)
#!/bin/sh
# DOSBOX starts with a 5 second delay to allow alsasound to initialize
# this script needs to delay longer.
sleep 7
while :
do
pidof dosbox >/dev/null
if [[ $? -ne 0 ]] ; then
sudo poweroff
break
else
sleep 1
fi
done