BACKGROUND: I have a large farm of foxconn thin clients currently running an ancient build of thinstation. Seeing I did not build this image, and it being so old, I started on creating a tahrpup TFTP boot setup as replacement. This forum has answered and solved almost every problem just by searching. But I have an issue I really need help solving.
ISSUE: Our current setup with thinstation creates a hostname ts_macadddress no colons. This is how we identify machines. Somehow during boot I need to insert a script (I think) in etc/rc.d/rc.sysinit that asks ifconfig eth0 its mac address, removes colons, appends ts_ in front of the mac and then makes it the clients hostname by updating (or creating?) etc/hosts and etc/hostname. Remember all the clients boot off an image I made from a snapshot so right now they all have the same hostname. This is an assumption from my feeble attempts at searching for a solution.
I have found hints at doing this, but because I have no clue about scripting I am stuck. I am going to post snippets of stuff I found that might help somebody here that can maybe help me.
The following is not code for puppy, but maybe it helps...
This is stuff I found from a rasberry pi forum about mac as hostname:
Code: Select all
MAC="pi""$( sed "s/^.*macaddr=\([0-9A-F:]*\) .*$/\1/;s/://g" /proc/cmdline )"
echo "$MAC" > "/etc/hostname"
CURRENT_HOSTNAME=$(cat /proc/sys/kernel/hostname)
sed -i "s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\t$MAC/g" /etc/hosts
hostname $MAC
Code: Select all
HOSTNAME=(`/sbin/ifconfig eth0 |grep HWaddr |cut -d ' ' -f11 |sed 's/://g'`)
echo HOSTNAME=$HOSTNAME >> /etc/sysconfig/network
HOSTNAME $HOSTNAME
echo NETWORKING=yes > /etc/sysconfig/network
This one thing is the last hurdle for me and I am stuck. Can anybody help?
Thank you in advance! ps. I know it might be stupid, but the boss wants it exactly the same so here I am.