LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Postscript for automatic USB installation (MAC address for Hostname) (https://www.linuxquestions.org/questions/linux-newbie-8/postscript-for-automatic-usb-installation-mac-address-for-hostname-793821/)

habtamu 03-07-2010 02:41 PM

Postscript for automatic USB installation (MAC address for Hostname)
 
Hello,

I am looking for help on how to make my bootable USB drive to automatically change the hostname to the MAC address of the system.


i know that i am suppose to add some scripts under the postscipt portion of the kickstart file and this is what i have so far and is not working.

I also know for sure that the first script below works because when i echo it on linux mechine it gives me the MAC address the way i want. However there is more i need to do so that wherever the installation is the hostname automatically becomes the MAC address

%post

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


Please Help!

jamescondron 03-08-2010 12:43 PM

Take a look at runlevels and the man page for 'hostname';

If I understand you, you just want to use the hostname command to set it to $HOSTNAME, and you want to run it at boot.

As a jumping off point, the file you'll want to look at is rc.local; I forget the path, but you'll find it


All times are GMT -5. The time now is 11:43 AM.