[Prev][Next][Index][Thread][Search]
scripts for dynamic ip address alocation and remote emacspeak
these are a couple of scripts that I wrote to solve the problem of using remote emacspeak over my universities ppp connection which uses dynamic ip address alocation.
they may be useful to someone.
the first script sits on the local machine. it should be in your path.
i call this script remacs.
you call the script with the name or ip address of the machine you want to run remote emacspeak on.
it requires you to have both sed and ssh (secure shell) installed. if you don't have ssh, you could change it to use rsh. installing ssh would not be that difficult and it's far preferable than rsh.
ultimately we would use ssh both ways, at the moment it is only used to connect from the local machine to the remote machine.
i assume that you can already ssh from the local machine to the remote machine.
and rsh from the remote machine to the local machine.
i might fix it to work with ssh both ways if i can figure it out.
remacs script
-------------------------
#!/bin/sh
# this script sits on the local machine (with speech attached)
# where tcl is on your system.
TCL=/usr/bin/tcl
# where the speech driver is on your machine.
DTK_DRIVER=/usr/local/emacspeak/dtk-exp
# determine the dynamic ppp address alocated to this machine.
# this uses ifconfig assuming that you are using /dev/ppp0.
# if you are using another network interface, change ppp0 to the name of your alternate interface.
PPP_ADDRESS=`/sbin/ifconfig ppp0 |sed -n -e "s/ inet addr://" -e "s/P-t-P:.*//p"`
#set the terminal type to vt100, just incase.
TERM=vt100
export TERM
# we use ssh to connect to the remote machine that you want to run emacspeak on
# we run the launch_remote_emacs script on that machine which sets the environment variables and then launches emacspeak:
#
#the path to launch_remote_emacspeak in the line below should reflect where it is on your system.
ssh -t $1 '~/bin/launch_remote_emacspeak' $PPP_ADDRESS $TCL $DTK_DRIVER
-------------------------
the second script sits on the remote machine.
it is called by the script above with the local machines current ip address, the location of tcl on the local machine, and the location of the speech driver.
the function of this script is to set up the propper DTK environment variables and then launch emacs.
launch_remote_emacspeak
-------------------------
#!/bin/csh
#this is a script to launch emacs on a remote machine and have the speech output on your local machine.
# this script sits on the remote machine.
# $1 is the current ip address of the machine that has the speech attached to it.
# if you use a driver other than dtk-exp, you will have to modify the DTK_PROGRAM variable to reflect this.
# where the remote-tcl script is on this machine (machine without speech)
# change this to reflect where you put the remote-tcl script
setenv DTK_TCL ~/emacspeak/remote-tcl
# ip address of the local machine (machine that has the speech attached.)
setenv DTK_IP_ADDRESS $1
# where tcl is on the local machine (machine with speech attached)
setenv DTK_REMOTE_TCL $2
# the name of the driver used on the local machine (one with speech).
setenv DTK_DRIVER $3
# make sure the port is unset.
setenv DTK_PORT
# launch emacspeak.
emacspeak
-------------------------
finally we modify the remote-tcl script which sits on the remote machine in the dirrectory defined by DTK_TCL in the launch_remote_emacspeak script.
we comment out the line:
rsh $remote $tcl $1
and replace it with:
rsh $DTK_IP_ADDRESS $DTK_REMOTE_TCL $DTK_DRIVER
that's it!
now you should be able to type:
remacs {machine name}
on your local machine and emacspeak should be launched on the remote machine with speech on your local machine.
common problems:
a. one of the scripts isn't exicutable.
b. ssh to the remote machine isn't working. remember to use ssh-add before launching remacs.
c. rsh isn't working usually because the remote host isn't in your ~/.rhosts file.
d. one of the variables in the scripts isn't set correctly for your setup.
good luck!