In startup scripts, it's sometimes useful/necessary to know which version of unslung is running. There are annoying differences between versions, such as the (linksys-induced) change in device naming that can be painful when phasing over to a new version, and using one set of configuration files.
I've used the following shell script snippet to accomplish this.; hopefully somone else will find it useful
Also, although I run multiple devices, the startup scripts and software load is identical for them all. To give each device its personality, I have a S00configure script that turns services on/off and softlinks the right configuration files. S00configure decides what to do based on the IP address configured in the linksys GUI. I've included the code snipped that does that as well.
if [ -e /etc/motd ]; then
SLUGV="`grep 'Unslung V.' /etc/motd | sed -e 's|.*-uNSLUng-\([0-9][0-9]*\.[0-9][0-9]*.*\)-.*$|\1|'`"
SLUGVMAJ="`/bin/echo $SLUGV | sed -e 's/\(.*\)\..*/\1/'`"
SLUGVMIN="`/bin/echo $SLUGV | sed -e 's/.*\.\(.*\)/\1/'`"
else
SLUGVMAJ="5"
SLUGVMIN="5"
fi
#
if [ "`mount | grep '/dev/sda1 on / '`" = "" ]; then
if [ "`mount | grep '/dev/sdb1 on / '`" = "" ]; then
# Not running from disk, don't touch flash
# BTDEV=
# BTDEV='ramdisk'
exit 1
else
BTFDEV="/dev/sdb1"
if [ $SLUGVMAJ -ge 6 ]; then
BTDEV='hdd'
else
BTDEV='flash'
fi
fi
else
BTFDEV="/dev/sda1"
if [ $SLUGVMAJ -ge 6 ]; then
BTDEV='flash'
else
BTDEV='hdd'
fi
fi
#
# Identify this host & determine configuration
#
IPADDR="`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-ixp0 | sed -e's/IPADDR=//'`"
# - 192.168.SUBNET.HOST
BASE="`/bin/echo $IPADDR | sed -e's/\.[0-9]*$//'`"
# - SUBNET
SUBNET="`/bin/echo $BASE | sed -e's/^[0-9]*\.[0-9]*\.//'`"
# - HOST
HOST="`/bin/echo $IPADDR | sed -e's/^.*\.\([0-9]*\)$/\1/'`"
|