This relates to settings for using dosemu to run certain parts of the WWIV BBS. The main thing that requires DOS emulation is running old door programs. There are a number of things, however, that apply to all cases when using dosemu. If you haven’t installed WWIV for linux yet, please check out WWIV Install on Linux.
###Overview
Configuring dosemu is generally pretty straightforward. Most linux distributions have it in their package repository in one form or another. This page won’t cover getting it installed; what it covers is specific configuration items related to how to use it with WWIV.
The fundamental components of dosemu are:
Component | Comments
——— | ——–
dosemu | is actually a wrapper for the binary file dosemu.bin
dosemu.bin | the main binary
.dosemurc | a config file that’s called when dosemu is invoked
dosdebug | a binary that allows for inspecting running dosemu processes. It
can be handy to use for killing a dosemu that has hung for some reason.
.dosemu directory | typically, the .dosemu directory will be created under
the home directory of the user running it.
dosemu.users | typically in /etc/dosemu. Defines user permissions
dosemu typically comes with FreeDOS; a DOS implementation that works pretty well. The only downside I’ve seen is that it’s a bit wordy. You get a lot of startup info when it’s first called that can expose a bit more about your setup than you might want, but it does work. If you have it available, it’s also possible to use MS-DOS instead of FreeDOS. I highly recommend reviewing the man pages for dosemu and dosemu.bin.
Your wwiv user should be restricted in its access while running dosemu. This is found in the dosemu.users file (usually in /etc/dosemu). Just add a single line to the end of the file:
wwiv restricted
the .dosemurc file sets up the basic operating environment your dosemu session will be running under. There isn’t much you need to do with this; a fairly simple config will get you what you need. You should create a default .dosemurc in your ${WWIV_DIR}. One that will work for most things will look like this:
ifdef u_virtual
serial { virtual com 1 }
endif
$_sound = (0)
$_cpu = "80586"
$_hogthreshold = (10)
$_dpmi_base = (0x10000000)
$_external_char_set = "cp437"
$_internal_char_set = "cp437"
$_layout = "us"
This will take all the default settings for drive locations. That’s usually under the .dosemu directory (drive_c, drives, etc). If you use the same setup for everything or don’t run any doors, that will be sufficient to run most things.
If you have never run dosemu manually, please do it now as your bbs userid (e.g., wwiv). That sets up the shell drive info (typically under ~/.dosemu) that will be referenced in the rest of this page.
When dealing with dosemu, you have to be able to pass information from WWIV to dosemu. This is usually handled by calling a shell script in the linux directory that runs a DOS batch file under dosemu. A typical script will look something like this:
#!/bin/bash
#
# Trade Wars 2002 chain
#
trap "echo" SIGHUP SIGINT SIGTERM
source ~/.wwivrc
NODE=$1
# we need to convert the chain.txt file to DOS format. TW doesn't like unix files
unix2dos ~/temp${NODE}/chain.txt > /dev/null 2>&1
dosemu -f ~/.dosemurc -I "dosbanner 0" -E "tw2002.bat ${NODE}" 2>/dev/null
You will notice a few things in this script
That last line:
dosemu -f ~/.dosemurc -I "dosbanner 0" -E "tw2002.bat ${NODE}" 2>/dev/null
has a lot of stuff going on. Here is a breakdown of all the bits:
The main thing that you will be messing with the most is the -E parameter. Most everything else will “just work” and pretty much stay static once you get it dialed in.
and now the corresponding batch file
@echo off
break=off
f:
cd \tw2002
TW2002 TWNODE=%1 > ERR%1.LOG
exitemu
This is all pretty typical. The important item is the last line: exitemu. That closes the dosemu session and returns to the linux environment. Without it, your users will either become hung, or the process will drop into a DOS shell. Dropping into a shell is VERY bad; that gives full access to all your files and will likely let someone run rampant on your system.
The core files in the DOS environment are still the config.sys and autoexec.bat files. Minimal files that will work for most things look like this:
config.sys
SWITCHES=/F/N
DOS=UMB,HIGH
dosdata=umb
lastdrive=Z
files=40
stacks=0
buffers=10
device=d:\dosemu\ems.sys
install=d:\dosemu\lredir.com z: linux\fs\${DOSEMU_LIB_DIR}/drive_z ro
shellhigh=z:\command.com /e:1024 /p
The one interesting line is the install statement that establishes the Z: drive as the base location for the dosemu tools. This is a little weird, as they start out on the D: drive. This is the stock behavior, but you can disable that if you want. The main advantage to this is setting that drive read-only. It does add one extra line of output that you may not want to see.
*autoexec.bat*
@echo off
break=off
path z:\bin;z:\gnu;z:\dosemu
set HELPPATH=z:\help
set TEMP=c:\tmp
prompt $P$G
REM The following needs to be the LAST line in autoexec.bat
unix -e
About the only thing that is really new here is the unix command at the end of the autoexec.bat file. That tells dosemu to run the command that you passed with the -E argument to dosemu in your shell script. The break=off is related to the trap security issue I mentioned above, but this one is at the DOS level. You don’t want people using ctrl-C to break out of batch files and gaining access to all your files.
Now that we have covered the basics of setting up dosemu, we have a couple advanced details regarding dosemu for our system scripts and WWIVnet and using dosemu for DOORs.
You may not want the same configuration for all instances of dosemu. Maybe you want a different set of DOS disks, maybe you want to run MS-DOS 5 for one door, or MS-DOS 6.22 for another, or the default FreeDOS for something else. The key to running different configurations lies in using a different .dosemurc file to point to different drives.
In order to accomplish this, all you need to do is copy the standard .dosemurc to something else (e.g., .dosemurc_doors) and add a line that points to that directory.
$_hdimage = "/bbs/wwiv/.dosemu/drive_c_doors drives/d"
The $_hdimage variable in the .rc file determines what “drives” the instance of dosemu will see, with the DOS drive letters being defined in order. The above example will end up with two drives:
C: = /bbs/wwiv/.dosemu/drive_c_doors
D: = drives/d
dosemu will typically put the C: drive in .dosemu/drive_c by default. That references the FreeDOS startup files, but will use the D: drive to load command.com and all the utility binaries. If you want a separate C: drive, just copy the drive_c directory to another location (e.g., drive_c_doors) and edit the config.sys, autoexec.bat and any other batch files as you see fit.
NOTE: There really shouldn’t be a need to do this unless you have a case where a specific DOS application needs different startup parameters or a specific OS that conflicts with your defaults, but it is possible to do it. config.sys and autoexec.bat are usually generic enough and just hand off to your batch file for the specific invocation.
To set up real MS-DOS, all you need to do is a few steps
To use it, just reference it in your dosemu call in your linux scripts:
dosemu -f ~/.dosemurc622 -I "dosbanner 0" -E "tw2002.bat ${NODE}" 2>/dev/null
The main gotcha doing this is you still need the FreeDOS tools that will exit dosemu, so make sure you have access to the D: drive like usual.