Thorvald
05-16-2003, 09:16 PM
For those of you aren't familiar with Unix, here are some basic things to setup for your remote Telnet sessions when using a network adapter (Plus some other handy settings).
1. Profile
When you login remotely via Telnet, you likely noticed that your Path was blank and no commands were found. Yes you can type the path command manually each time but there is a better way. Create a file called "profile" under the etc directory and fill it with the commands you want to execute when you login:
#!/bin/bash
PATH=/var/hack/bin:/sbin:/bin:/tivobin:/tvbin:.
IGNOREEOF=1000
TERM=xterm
PS1="[\\w]\\\$ "
export PATH IGNOREEOF TERM PS1
This will setup your path and other handy items automatically. Best to keep a copy of "profile" and copy it using your hackinit each time you boot to ensure the Tivo won't wipe it out. Add the following line to your hackinit:
cp /var/hack/profile /etc/profile
2. Command Prompt with current Path
There is alot you can do with the prompt under bash. I personally prefer the basic "current path". This is set with the PS1 enviroment variable such as:
PS1="[\\w]\\\$ "
This will result in the following for your command prompt:
[/var/hack/bin]#
Now you can keep track of what directory you are in without constantly typing pwd. There are a TON of options that you can add to your command prompt, read the man page on bash for more ideas.
3. Debugging your Hackinit upon bootup
Some people like log files, I personally like to see what is happening live, out the serial port. You can redirect the echo command to the serial port as follows:
echo "Look at me!" > /dev/ttyS2
ttyS2 is the serial port device on the Tivo.
I use this for my hackinit script so I can watch it's progress (besides, it looks fancier when it's booting):
#!/bin/bash
echo "Starting Hackinit" > /dev/ttyS2
PATH=/var/hack/bin:/sbin:/bin:/tivobin:/tvbin:.
TIVO_ROOT=
MFS_DEVICE=/dev/hda10
IGNOREEOF=1000
TERM=xterm
PS1="[\\w]\\\$ "
export PATH TIVO_ROOT MFS_DEVICE IGNOREEOF TERM PS1
echo "Replacing DSSAPP" > /dev/ttyS2
mount -o remount,rw /
rm -rf /tvbin/dssapp
cp /var/hack/dssapp /tvbin/dssapp
chmod 777 /tvbin/dssapp
echo "Starting BASH" > /dev/ttyS2
/bin/bash</dev/ttyS2&>/dev/ttyS2&
echo "Starting usbcore.o" > /dev/ttyS2
insmod /diag/usbcore.o
echo "Starting usb-ohci.o" > /dev/ttyS2
insmod /diag/usb-ohci.o
echo "Starting pegasus.o" > /dev/ttyS2
insmod /diag/pegasus.o
echo "Enabling eth0 as 192.168.0.5" > /dev/ttyS2
ifconfig eth0 192.168.0.5 broadcast 192.168.0.255 netmask 255.255.255.0
echo "Setting Default Gateway on eth0" > /dev/ttyS2
route add default gw 192.168.0.1 netmask 0.0.0.0 metric 1
echo "Starting ftp daemon" > /dev/ttyS2
/var/hack/bin/ftpd
echo "Replacing rc.sysinit to disable software upgrades"> /dev/ttyS2
rm -rf /etc/rc.d/rc.sysinit
cp /var/hack/rc.sysinit.noupgrade /etc/rc.d/rc.sysinit
echo "Adding /etc/profile for telnet logins" > /dev/ttyS2
cp /var/hack/profile /etc/profile
echo "Enabling eth0 as 192.168.0.5" > /dev/ttyS2
ifconfig eth0 192.168.0.5 broadcast 192.168.0.255 netmask 255.255.255.0
echo "Setting Default Gateway on eth0" > /dev/ttyS2
route add default gw 192.168.0.1 netmask 0.0.0.0 metric 1
echo "Starting ftp daemon" > /dev/ttyS2
/var/hack/bin/ftpd
echo "Replacing rc.sysinit to disable software upgrades"> /dev/ttyS2
rm -rf /etc/rc.d/rc.sysinit
cp /var/hack/rc.sysinit.noupgrade /etc/rc.d/rc.sysinit
echo "Adding /etc/profile for telnet logins" > /dev/ttyS2
cp /var/hack/profile /etc/profile
echo "Sleeping 60 secs for time sync..." > /dev/ttyS2
sleep 60
date >> /var/hack/hackinit.log
echo "Calling FIXSUB" > /dev/ttyS2
/var/hack/callfixsub.tcl &
If anyone has other customization ideas, please add to the list!
1. Profile
When you login remotely via Telnet, you likely noticed that your Path was blank and no commands were found. Yes you can type the path command manually each time but there is a better way. Create a file called "profile" under the etc directory and fill it with the commands you want to execute when you login:
#!/bin/bash
PATH=/var/hack/bin:/sbin:/bin:/tivobin:/tvbin:.
IGNOREEOF=1000
TERM=xterm
PS1="[\\w]\\\$ "
export PATH IGNOREEOF TERM PS1
This will setup your path and other handy items automatically. Best to keep a copy of "profile" and copy it using your hackinit each time you boot to ensure the Tivo won't wipe it out. Add the following line to your hackinit:
cp /var/hack/profile /etc/profile
2. Command Prompt with current Path
There is alot you can do with the prompt under bash. I personally prefer the basic "current path". This is set with the PS1 enviroment variable such as:
PS1="[\\w]\\\$ "
This will result in the following for your command prompt:
[/var/hack/bin]#
Now you can keep track of what directory you are in without constantly typing pwd. There are a TON of options that you can add to your command prompt, read the man page on bash for more ideas.
3. Debugging your Hackinit upon bootup
Some people like log files, I personally like to see what is happening live, out the serial port. You can redirect the echo command to the serial port as follows:
echo "Look at me!" > /dev/ttyS2
ttyS2 is the serial port device on the Tivo.
I use this for my hackinit script so I can watch it's progress (besides, it looks fancier when it's booting):
#!/bin/bash
echo "Starting Hackinit" > /dev/ttyS2
PATH=/var/hack/bin:/sbin:/bin:/tivobin:/tvbin:.
TIVO_ROOT=
MFS_DEVICE=/dev/hda10
IGNOREEOF=1000
TERM=xterm
PS1="[\\w]\\\$ "
export PATH TIVO_ROOT MFS_DEVICE IGNOREEOF TERM PS1
echo "Replacing DSSAPP" > /dev/ttyS2
mount -o remount,rw /
rm -rf /tvbin/dssapp
cp /var/hack/dssapp /tvbin/dssapp
chmod 777 /tvbin/dssapp
echo "Starting BASH" > /dev/ttyS2
/bin/bash</dev/ttyS2&>/dev/ttyS2&
echo "Starting usbcore.o" > /dev/ttyS2
insmod /diag/usbcore.o
echo "Starting usb-ohci.o" > /dev/ttyS2
insmod /diag/usb-ohci.o
echo "Starting pegasus.o" > /dev/ttyS2
insmod /diag/pegasus.o
echo "Enabling eth0 as 192.168.0.5" > /dev/ttyS2
ifconfig eth0 192.168.0.5 broadcast 192.168.0.255 netmask 255.255.255.0
echo "Setting Default Gateway on eth0" > /dev/ttyS2
route add default gw 192.168.0.1 netmask 0.0.0.0 metric 1
echo "Starting ftp daemon" > /dev/ttyS2
/var/hack/bin/ftpd
echo "Replacing rc.sysinit to disable software upgrades"> /dev/ttyS2
rm -rf /etc/rc.d/rc.sysinit
cp /var/hack/rc.sysinit.noupgrade /etc/rc.d/rc.sysinit
echo "Adding /etc/profile for telnet logins" > /dev/ttyS2
cp /var/hack/profile /etc/profile
echo "Enabling eth0 as 192.168.0.5" > /dev/ttyS2
ifconfig eth0 192.168.0.5 broadcast 192.168.0.255 netmask 255.255.255.0
echo "Setting Default Gateway on eth0" > /dev/ttyS2
route add default gw 192.168.0.1 netmask 0.0.0.0 metric 1
echo "Starting ftp daemon" > /dev/ttyS2
/var/hack/bin/ftpd
echo "Replacing rc.sysinit to disable software upgrades"> /dev/ttyS2
rm -rf /etc/rc.d/rc.sysinit
cp /var/hack/rc.sysinit.noupgrade /etc/rc.d/rc.sysinit
echo "Adding /etc/profile for telnet logins" > /dev/ttyS2
cp /var/hack/profile /etc/profile
echo "Sleeping 60 secs for time sync..." > /dev/ttyS2
sleep 60
date >> /var/hack/hackinit.log
echo "Calling FIXSUB" > /dev/ttyS2
/var/hack/callfixsub.tcl &
If anyone has other customization ideas, please add to the list!