TIP: Click on subject to list as thread! ANSI
echo: elebbs_support
to: All
from: Drew Baker
date: 2006-06-07 17:31:38
subject: EleBBS: Linux Execute Script

* EleBBS Support List

Here is the script that I use to manage doors, in dosbox, linux, and
multi bbs doors.

-- 
Beware the jaws that bite, for they belong to my evil attack penguin.

Open Source Software, Not only a way of life, but a tasty desert as
well.  http://www.fosug.org

Bring back the days of the BBS:  Telnet/SSH2:/doteltech.com

EXECUTE.SH
-----------------------

#!/bin/sh
#Define the locations of your files DO NOT INCLUDE TRAILING SLASH /
#NODEDIR = LOCATION OF YOUR NODE TEMP FILE
#BBSDIR = LOCATION OF BBS EXECUTION FILES
#SCRIPTDIR = APPLICATION STARTUP SCRIPTS
#DOSEMUDIR = LOCATION YOUR DOS C DRIVE ROOT IS STORED
#SUBDIR = LOCATION WHERE YOU WILL STORE TEMP USER DATA FOR NON-MULTIPLAYER DOORS


NODEDIR=/home/bbs/node
BBSDIR=/home/bbs
SCRIPTDIR=/home/bbs/dos_scripts
DOSEMUDIR=/home/bbs/dosemu/freedos
SUBDIR=/home/bbs/subhome

clear

if [ "$4" == "" ]
	then
	echo "Configured as"
	echo "nodedir="$NODEDIR
	echo "bbsdir="$BBSDIR
	echo "scriptdir="$SCRIPTDIR
	echo "dosemudir="$DOSEMUDIR
	echo "subdir="$SUBDIR
	echo ""
	echo "No commands passed to execute.sh. Please read Required Variables"
	echo ""
	echo "format   execute.sh node% user% execute% mode%"
	echo "example  execute.sh 1 drewbaker TW2002 DOSEMU"
	echo ""
	echo "Will run script TW2002 in DOSEMU as user drewbaker on node 1"
	sleep 3
	exit

fi

#Sets Terminal display to be compatable with industry standards
stty columns 80 line 25


#VARIABLES REQUIRED TO BE PASSED
#execute.sh NODE% USER% EXECUTE% MODE%
# NODE = BBS NODE Number If not needed place a '1' here
# USER = USER, this is the full account name on BBS. Used in handling
home directory and drop file creation. USE *F*L IN ELEBBS TO AVOID
DUPLICATE FIRST NAME ACCOUNTS
# EXECUTE = Bash script to execute after script converts users. OR
DOSLAUNCH Variable to pass onto emulator
# MODE = What mode to operate in. Valid modes
#	NATIVE = No special changes needed. Linux file may be launched
without specifying home
#	HOMDIR = Creates, manages and uses virtual home directory
#	TARDIR = Same as HOMDIR, only stores files in compress tarball,
Usefull for large homedir's
#	DOSEMU = Pass and launch clasic dos application.
#	DOSSRV = Pass and launch clasic dos application as background
service (tradeware alien AI engine).
#	DOSDUM = Pass and launch in dumb terminal dos. (linux shell remains
loaded while dos executes in background)
#	DOSPAS = Pass and launch in dos. (no door,node, user info is passed)
All scripts and batch files much be handled internaly in dosemu,
example would be to run nightly events like tradewars extern

echo "Launcher for Non-Multi-Node Doors Version 1.10 By Andrew Baker"
echo "Loading Personalized Home Directory for $2 on Node $1 running $3"
echo ""
echo ""

##CHECKS TO VERIFY SUBHOME DIRECTORY EXISTS, IF NOT CREATES IT

if [ -d "$SUBDIR/$2" ]
	then
		echo "The Sub home directory $2 Exists"

	else
		echo "The Sub home directory $2 does not exist. Either this is your
first visit, or you have not visited the doors within 90 days. A New
account may be created for you."
					echo "Creating your home"
					mkdir $SUBDIR/$2
					sleep 2
fi	

##RESTORES ANY USER DATA TO TEMPROARY NODE DIRECTORY. REMOVES ANY OLD
DROPFILES THAT WILL CAUSE PROBLEMS NEXT TIME USER ATTEMPTS TO LOG INTO
DOOR

if [ "$4" == "HOMDIR" ]
	then
	HOME=$SUBDIR/$2
	echo "Restoring Files"
	cp $SUBDIR/$2/* $NODEDIR$1/
	$SCRIPTDIR/$3
	echo "Backing up your files"
	cp $NODEDIR$1/* $SUBDIR/$2/
	rm $SUBDIR/$2/*.sys
	rm $SUBDIR/$2/*.def
	rm $SUBDIR/$2/*.bbs
	rm $SUBDIR/$2/*.jdt
	rm $SUBDIR/$2/*.jdx
	rm $SUBDIR/$2/*.jhr
	rm $SUBDIR/$2/*.jlr
	rm $SUBDIR/$2/*.jir
	HOME=$BBSDIR
fi



##NOT YET FINISHED
if [ "$4" == "TARDIR" ]
	then
	echo "NOT DEVELOPED YET, USE HOMDIR FOR NOW"
fi


##SIMPLY PASSES INFO ONTO LINUX SYSTEM.
if [ "$4" == "NATIVE" ]	
	then
	$SCRIPTDIR/$3
fi


##RUNS THE STANDARD DOSEMU APPLICATION SCRIPTS

if [ "$4" == "DOSEMU" ]
	then

	stty columns 80 line 25

	#Display a wait screen for user. When bbs us under high load, dosemu may take
	#20-30 seconds to load
	echo "Please Wait.  System is loading Legacy emulators. This may take
a minute"

	#copies node information to the dosemu enviornment. The C drive in dos
	cp $NODEDIR$1/ $DOSEMUDIR/ -R

	#This creates a files that will be excecuted in the autoexec within
the dos box enviornment
	#I know it says tradewars that was just my first program to get
running. The variables
	#apply to all programs. REMEMBER TO ADD CALL LOVAR.BAT TO YOUR AUTOEXEC.BAT

	echo "Rem TradeWars 2002 Operating Transfer Config" >
$DOSEMUDIR/lovar.bat
	echo "SET NODE="$1 >> $DOSEMUDIR/lovar.bat
	echo "SET TWUSER="$2 >> $DOSEMUDIR/lovar.bat
	echo "SET DOOR="$3 >> $DOSEMUDIR/lovar.bat

	#launches dosemu. Notice that there are no variables passed directly to dos emu
	#all variables needed are stored in the above echo.
	dosemu

	#Cleans up temporary files used durring door usage
	rm $DOSEMUDIR/node$1 -R

	#Resets display THIS MAY CAUSE DISPLAY PROBLEMS IN ELEBBS.
	#reset -m network:vt100

fi


##THIS PASSES ON DOS EMU IN STUPID DOS MODE RUNNING AS SERVICE.
if [ "$4" == "DOSDUM" ]
	then
	echo "Rem TradeWars 2002 Operating Transfer Config" >
$DOSEMUDIR/lovar.bat
	echo "Rem SET TWNODE="$1 >> $DOSEMUDIR/lovar.bat
	echo "SET TWUSER="$2 >> $DOSEMUDIR/lovar.bat
	echo "SET DOOR="$3 >> $DOSEMUDIR/lovar.bat
	dosemu -d $3 &
fi


##DUMB DUMB DOS MODE, USED FOR NIGHTLY EVENTS, SUCH AS EXTERN
if [ "$4" == "DOSPAS" ]
	then
	dosemu $3
fi




---------
end file



example script to load zork1 userhome. each user can have their own
saved files in zork.

ele menu script:
"/home/bbs/dos_scripts/execute.sh *N *F*L zork1.sh HOMDIR"
/home/bbs/dos_scripts/execute.sh is the location and executer that
runs all doors/apps/events
*N tells elebbs to pass the bbs node to the execute scripts
*F*L tell elebbs to pass the first and last name to script (with no
spaces, you may wish to pass handle instead if you user handles) Avoid
using just *F this will confuse home directorys, Chris Anthony and
Chris Markus will get the SAME user folder. which is bad
zork1.sh is the executeable script to call to launch actuall program
HOMDIR (yes this always has to be in UPPERCASE) tell script what mode it's in

zork1.sh example script
------------------------
#!/bin/bash
/usr/games/bin/frotz /home/bbs/shared/ZORK1.DAT


---------------
end zork example



example to pass user off to multi-BBS telnet game.

5 kingdoms example.  All node/user/password/etc are handled directly
by the party we connect to. However we pass the information to script
because it requires all infomation to parse accounts if needed.

ele menu command:
"/home/bbs/dos_scripts/execute.sh *N *F*L 5king.sh NATIVE"
same as above, however this time we use NATIVE. This tells script to
skip processing home directories or bbs drop files,

example scripts
5king.sh
--------------------
#!/bin/bash
plink -telnet -P 2411 mercator.mudhaven.com

-------------------
end example
Note I use plink as a telnet client. This is a slightly better version
of telnet. you can get plink from the putty home page.  or simply
replace plink -telnet  with telnet.


DOS scripts are stored in your emulated C: drive.
you will need a fairly complecated autoexec.bat.  I will paste mine
here for example

autoexec.bat
----------------------------


{at}echo off
cls

path c:\bin;c:\gnu;c:\dosemu
set HELPPATH=c:\help
set TEMP=c:\tmp
rem set BLASTER=A220 I5 D1 H5 T6
prompt $P$G
unix -s DOSDRIVE_D
if "%DOSDRIVE_D%" == "" goto nodrived
lredir d: linux\fs%DOSDRIVE_D%
:nodrived
unix -e
call lovar.bat
fossil
set
rem Rebuild config files to dos LFCR this is a cheap way to fix
carrage return problems with rem the way elebbs writes its drop files
in linux
cd\node%node%\
cat door.sys > door.tmp
cat dorinfo1.def > dorinfo1.tmp
cat door32.sys > door32.tmp
copy door.tmp door.sys /y
copy dorinfo1.tmp dorinfo1.def /y
copy door32.tmp door32.sys /y
cd\
rem files are now formated correctly

if "%DOOR%"=="TW2002" goto TW2002
if "%DOOR%"=="TW2002N" goto TW2002N
if "%DOOR%"=="SHELL" goto SHELL
if "%DOOR%"=="LORD" goto LORD
if "%DOOR%"=="TWEXT" goto TWEXT
if "%DOOR%"=="TWEXTN" goto TWEXTN
if "%DOOR%"=="TWEDIT" goto TWEDIT
if "%DOOR%"=="TWEDITN" goto TWEDITN
if "%DOOR%"=="ANSIDUDE" goto ANSIDUDE
if "%DOOR%"=="CODE" goto CODE
if "%DOOR%"=="KROZ" goto KROZ
if "%DOOR%"=="MAZE" goto MAZE
if "%DOOR%"=="CRUX" goto CRUX
if "%DOOR%"=="ZZT" goto ZZT
if "%DOOR%"=="HELICO" goto HELICO



echo End
exitemu


:TW2002
tw2002.bat
goto END

:TW2002N
tw2002n.bat
goto END

:LORD
lord.bat
goto END


:SHELL
goto fakeend

:TWEXT
twext.bat
goto END

:TWEXTN
twextn.bat
goto END

:TWEDIT
twedit.bat
goto END

:TWEDITN
tweditn.bat
goto END

:KNK
knk.bat
goto END

:ANSIDUDE
ansidude.bat
goto END

:CODE
code.bat
goto END

:KROZ
kroz.bat
goto END

:MAZE
maze.bat
goto END

:CRUX
crux.bat
goto END

:ZZT
zzt.bat
goto END

:HELICO
helico.bat
goto END


:END
rem REMEMBER TO CALL EXITEMU this will notify emulator to return to linux
exitemu

:FAKEEND
Echo Welcome to Shell


-------
end autoexec.bat

example bat files in dos to call programs


tw2002.bat
--------------
cd\2002
tw2002
exitemu

knk.bat
-----------
cd\knk
knk c:\node%node%\dorinfo1.def




I know this email looks massivly complex, and it does take some
getting used to.  There is so many variables and differences/quirks in
running doors from different platforms in same bbs envionment. this
script set helps keep them all consistent. And allows for quick and
easy changes to programs.


Programs you must have for scripts to work
linux
elebbs .9 or higher
bash compatable shell running
dosemu

goodluck
_______________________________________________________________


--- Internet Rex 2.29
* Origin: The gateway at The Snake (2:280/4312.101)
SEEN-BY: 633/267 270
@PATH: 280/4312 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.