1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#!/bin/bash
# Modified from the pilot-xfer pilotconfig package.
# Pretty much s/pilot/firecracker/
#
#
# If /dev/firecracker already exists then set the default port
# to whatever that links to, other use ttyS1 as the default.
defport=$(perl -e 'print readlink("/dev/firecracker");')
if [ "$1" == "--no-ask" -a -L /dev/firecracker ]
then
echo "/dev/firecracker is already a symlink to $defport. Not changing."
exit 0
fi
# Note that I tried to account for the different serial cards out there.
# Considering that I've got a Cyclades, firecrackerconfig used to do the wrong
# thing for me. -DS
#
# These are all the supported serial cards under 2.0.36. Got more?
# send a bug report.
#
# ttyS* == normal serial port
# ttyC* == Cyclades
# ttyD* == Digiboard
# ttyE* == Stallion
# ttyF* == Computone IntelliPort II
# ttyH* == Chase
# ttyL* == SDL RISCom
# ttyP* == Hayes ESP
# ttyR* == Rocketport
# ttyV* == Control VS-1000
# ttyW* == Specialix IO8+
# ttyX* == Specialix
# echo $defport
case $defport in
/dev/*) defport=$(echo $defport | sed s_^/dev/__);;
tty[SCDEFHLPRVWX]*) defport=$(echo $defport | sed s_^/dev/__);;
*) defport="ttyS1";;
esac
echo "What serial port do you have the cradle connected to [$defport]? "
echo -n "> "
read answer
if [ -n "$answer" ]
then
port=$(echo $answer | sed s_^/dev/__)
else
port="$defport"
fi
echo "Setting /dev/firecracker to point to /dev/$port"
# Set up a link for /dev/firecracker to point to the serial port
rm -f /dev/firecracker
ln -s $port /dev/firecracker
exit 0
|