[Lunar-commits] CVS: lunar-tools/lnet lnet,1.2,1.3

Auke Kok sofar at lunar-linux.org
Wed Nov 10 14:03:05 UTC 2004


Update of /var/cvs/lunar/lunar-tools/lnet
In directory espresso.foo-projects.org:/home/sofar/active/lunar-tools/lnet

Modified Files:
	lnet 
Log Message:
Added host- and domainname setting!


Index: lnet
===================================================================
RCS file: /var/cvs/lunar/lunar-tools/lnet/lnet,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- lnet	10 Nov 2004 13:46:09 -0000	1.2
+++ lnet	10 Nov 2004 14:03:03 -0000	1.3
@@ -74,6 +74,7 @@
 		      $(echo -en $LIST)              \
                       "A"  "Add a network device"    \
                       "D"  "Setup DNS configuration" \
+		      "N"  "Setup host and domain name" \
 		      "G"  "Setup global Gateway"`
 
     if [ $? != 0 ] ; then
@@ -84,6 +85,7 @@
       [0-9]*) ethernet_menu ${INTERFACES[$COMMAND]} ;;
       A)      ethernet_config ;;
       D)      dns_config ;;
+      N)      hostname_config ;;
       G)      gateway_config ;;
     esac
   done
@@ -135,6 +137,33 @@
     fi;
 }
 
+function hostname_config()
+{
+   if [ -f /etc/hostname ]; then
+     HOSTNAME=$(cat /etc/hostname)
+   fi
+   HOSTNAME=`inputbox "Enter this systems host name" "$HOSTNAME"`
+   if [ -n "$HOSTNAME" ]; then
+     echo "$HOSTNAME" > /etc/hostname
+   else
+     rm /etc/hostname
+   fi
+   if [ -f /etc/domainname ]; then
+     DOMAINNAME=$(cat /etc/domainname)
+   fi
+   DOMAINNAME=`inputbox "Enter this systems domain name" "$DOMAINNAME"`
+   if [ -n "$DOMAINNAME" ]; then
+     echo "$DOMAINNAME" > /etc/domainname
+   else
+     rm /etc/domainname
+   fi
+
+   # and set them too:
+   clear
+   /etc/init.d/hostname
+   sleep 2
+}
+
 function gateway_config() {
    GATEWAY_PROMPT="Enter Gateway IP Address"
    GATEWAY=`inputbox "$GATEWAY_PROMPT" "$GATEWAY"`



More information about the Lunar-commits mailing list