home *** CD-ROM | disk | FTP | other *** search
/ Caldera Network Desktop 1.0 / caldera-network-desktop-1.0.bin / images / ramdisk2-beta.img / usr / lib / perl / net < prev    next >
Text File  |  1995-12-04  |  16KB  |  829 lines

  1. ## Takes care of configuring the network -*-perl-*-
  2.  
  3. $net_up = 0;
  4. $interface = "internal";
  5. $hostname = "";
  6. $domainname = "";
  7. $fqdn = "";
  8. $ipaddr = "";
  9. $network = "";
  10. $netmask = "";
  11. $broadcast = "";
  12. $gateway = "";
  13. @nslist = ();
  14.  
  15. $config_net_first_time = 1;
  16. $net_configed = 0;
  17.  
  18. sub make_net_up {
  19.  
  20.     while (! $net_up) {
  21.     if (! &config_net) {
  22.         return 0;
  23.     }
  24.     
  25.     &_uninit_net;
  26.     &_init_net;
  27.     }
  28.  
  29.     return 1;
  30. }
  31.  
  32. sub reconfig_net_up {
  33.  
  34.     if ($net_up) {
  35.     &_uninit_net;
  36.     }
  37.     return &make_net_up;
  38. }
  39.  
  40. sub bring_net_up {
  41.     local ( $ret );
  42.  
  43.     if ($net_up) {
  44.     if (! &rhs_yesno("Notice",
  45. <<EOM
  46. >
  47. Networking appears to be active already.
  48. >
  49. Bring it down and then back up?
  50. >
  51. EOM
  52.              , 60)) {
  53.         return 1;
  54.     }
  55.     &_uninit_net;
  56.     }
  57.  
  58.     if (! $net_configed) {
  59.     &rhs_msgbox("Error",
  60. <<EOM
  61. >
  62. Networking is not yet configured.
  63. >
  64. EOM
  65.             , 60);
  66.     return 0;
  67.     }
  68.  
  69.     $ret = &_init_net;
  70.  
  71.     if ($net_up) {
  72.     &rhs_msgbox("Notice",
  73. <<EOM
  74. >
  75. The network has been initialized.
  76. >
  77. EOM
  78.             , 40);
  79.     } else {
  80.     &rhs_msgbox("Error",
  81. <<EOM
  82. >
  83. The network has NOT been initialized.
  84. >
  85. EOM
  86.             , 40);
  87.     }
  88.  
  89.     return $ret;
  90. }
  91.  
  92. sub bring_net_down {
  93.     local ( $ret );
  94.  
  95.     $ret = &_uninit_net;
  96.  
  97.     if ($net_up) {
  98.     &rhs_msgbox("Error",
  99. <<EOM
  100. >
  101. The network was NOT brought down.
  102. >
  103. EOM
  104.             , 40);
  105.     } else {
  106.     &rhs_msgbox("Notice",
  107. <<EOM
  108. >
  109. Networking has been brought down.
  110. >
  111. EOM
  112.             , 40);
  113.     }
  114.  
  115.     return $ret;
  116. }
  117.  
  118. # This sub is used for the auto install
  119. sub configure_network {
  120.  
  121.     &mount_bootdisk();
  122.  
  123.     if ( -f "/bootdisk/defaults/network" ) {
  124.     require "/bootdisk/defaults/network";
  125.     $config_net_first_time = 0;
  126.     } elsif ( -f "/tmp/network-def" ) {
  127.     require "/tmp/network-def";
  128.     $config_net_first_time = 0;
  129.     }
  130.  
  131.     if ($net_configed) {
  132.     if (&rhs_yesno("Choose",
  133. <<EOM
  134. >
  135. Networking has already been configured (probably for
  136. an NFS install).  Do you wish to use this configuration for
  137. your installed Linux system?
  138. >
  139. EOM
  140.                , 70)) {
  141.         return 1;
  142.     }
  143.     }
  144.  
  145.     if ($config_net_first_time && !($installsource eq "ftp" || 
  146.                                     $installsource eq "nfs")) {
  147.     if (! &rhs_yesno("Choose",
  148. <<EOM
  149. >
  150. Do you want to configure networking for your installed Linux system?
  151. >
  152. EOM
  153.              , 70)) {
  154.         $net_configed = 0;
  155.  
  156.         if (! &rhs_inputbox ( "Hostname",
  157. <<EOM
  158. >
  159. Please enter a hostname for this machine (Example: torgo.redhat.com)
  160. >
  161. EOM
  162.                  , 70, $tmp)) {
  163.         return 0;
  164.         }
  165.         $fqdn = $dialog_result;
  166.         return 1;
  167.     }
  168.     }
  169.  
  170.     return &reconfig_net_up;
  171.  
  172.     print "Reached end of configure_network() !!\n";
  173.     exit 1;
  174. }
  175.  
  176. sub config_net {
  177.     local ( $msg, $i, $first_time );
  178.  
  179.     if ($net_up) {
  180.     if (! &rhs_yesno("Notice",
  181. <<EOM
  182. >
  183. Networking appears to be up.  If you continue and
  184. change any network parameters, you should bring networking down
  185. and back up again.
  186. >
  187. Continue?
  188. >
  189. EOM
  190.              , 60)) {
  191.         return 1;
  192.     }
  193.     }
  194.  
  195.     while (1) {
  196.     if ($config_net_first_time) {
  197.         $config_net_first_time = 0;
  198.         next if (! &config_net_sequence);
  199.     }
  200.  
  201.     # Are these parameters correct?
  202.         $msg =
  203. <<EOM
  204. >You have entered the following parameters:
  205. >Interface:         $interface
  206. >Hostname:          $hostname
  207. >Domain name:       $domainname
  208. >IP address:        $ipaddr
  209. >Network address:   $network
  210. >Network mask:      $netmask
  211. >Broadcast address: $broadcast
  212. >Gateway:           $gateway
  213. EOM
  214.     ;
  215.         if (@nslist == 0) {
  216.             $msg .=
  217. <<EOM
  218. >Nameserver:        none
  219. EOM
  220.     ;
  221.         } else {
  222.             for ($i = 0; $i < @nslist; $i++) {
  223.                 $msg .=
  224. <<EOM
  225. >Nameserver:        $nslist[$i]
  226. EOM
  227.     ;
  228.             }
  229.         }
  230.         $msg .=
  231. <<EOM
  232. >
  233. Is this correct?
  234. EOM
  235.     ;
  236.  
  237.     if (&rhs_yesno("Net Config", $msg, 50)) {
  238.         $net_configed = 1;
  239.         return 1;
  240.     }
  241.  
  242.     if (! &rhs_menu("Choose",
  243. <<EOM
  244. >
  245. What do you wish to do?
  246. >
  247. EOM
  248.             , 60, 3,
  249.             "Sequence", "Configure network information in sequence",
  250.             "Individual", "Configure individual network parameters",
  251.             "Cancel", "Cancel all network configuration")) {
  252.         return 0;
  253.     }
  254.  
  255.     if ($dialog_result eq "Sequence") {
  256.         next if (! &config_net_sequence);
  257.     } elsif ($dialog_result eq "Individual") {
  258.         next if (! &config_net_individual);
  259.     } elsif ($dialog_result eq "Cancel") {
  260.         # Cancel
  261.         $net_configed = 0;
  262.         return 0;
  263.     }
  264.     }
  265. }
  266.  
  267. sub config_net_sequence {
  268.  
  269.     return 0 if (! &net_interface);
  270.     return 0 if (! &net_hostname);
  271.     return 0 if (! &net_domainname);
  272.     return 0 if (! &net_fqdn);
  273.     return 0 if (! &net_ipaddr);
  274.     return 0 if (! &net_network);
  275.     return 0 if (! &net_netmask);
  276.     return 0 if (! &net_broadcast);
  277.     return 0 if (! &net_gateway);
  278.     return 0 if (! &net_nameservers);
  279.     
  280.     return 1;
  281. }
  282.  
  283. sub config_net_individual {
  284.  
  285.     local ( $ret, $i, $ns );
  286.  
  287.     while (1) {
  288.     $ns = $nslist[0];
  289.     for ($i = 1; $i < @nslist; $i++) {
  290.         $ns .= ", $nslist[$i]";
  291.     }
  292.     $ns = sprintf("%.25s", $ns);
  293.     $ret = &rhs_menu ( "Network Configuration",
  294. <<EOM
  295. Edit network parameters.
  296. EOM
  297.               , 60, 12,
  298.               "Interface",       $interface,
  299.               "Hostname",        $hostname,
  300.               "Domain name",     $domainname,
  301.               "FQDN",            $fqdn,
  302.               "IP Address",      $ipaddr,
  303.               "Network",         $network,
  304.               "Network mask",    $netmask,
  305.               "Broadcast addr",  $broadcast,
  306.               "Gateway",         $gateway,
  307.               "Nameservers",     $ns,
  308.               "--------------",  "",
  309.               "Done",            "" );
  310.     
  311.     return 0 if (! $ret);
  312.     return 1 if ($dialog_result eq "Done");
  313.     
  314.     &net_interface   if ($dialog_result eq "Interface");
  315.     &net_hostname    if ($dialog_result eq "Hostname");
  316.     &net_domainname  if ($dialog_result eq "Domain name");
  317.     &net_fqdn        if ($dialog_result eq "FQDN");
  318.     &net_ipaddr      if ($dialog_result eq "IP Address");
  319.     &net_network     if ($dialog_result eq "Network");
  320.     &net_netmask     if ($dialog_result eq "Network mask");
  321.     &net_broadcast   if ($dialog_result eq "Broadcast addr");
  322.     &net_gateway     if ($dialog_result eq "Gateway");
  323.     &net_nameservers if ($dialog_result eq "Nameservers");
  324.     }
  325. }
  326.  
  327. sub _uninit_net {
  328.     if ($net_up) {
  329.     &invoke("ifconfig $iface down");
  330.     $net_up = 0;
  331.     }
  332.     return 1;
  333. }
  334.  
  335. sub _init_net {
  336.     local ( $ret, $domain_bit, $string );
  337.  
  338.     open (FD, ">/etc/resolv.conf");
  339.     $string = &gen_resolv_conf;
  340.     print FD $string;
  341.     close FD;
  342.  
  343.     # We write this stuff so the X install can get at it
  344.     open (FD, ">/tmp/resolv.conf");
  345.     print FD $string;
  346.     close FD;
  347.  
  348.     open (FD, ">/tmp/network");
  349.     $string = &gen_network;
  350.     print FD $string;
  351.     close FD;
  352.  
  353.     open(FD, ">/tmp/ifcfg-$iface");
  354.     $string = &gen_ifcfg_eth;
  355.     print FD $string;
  356.     close FD;
  357.  
  358.     open(FD, ">/tmp/HOSTNAME");
  359.     $string = &gen_HOSTNAME;
  360.     print FD $string;
  361.     close FD;
  362.  
  363.     open(FD, ">/tmp/hosts");
  364.     $string = &gen_hosts;
  365.     print FD $string;
  366.     close FD;
  367.  
  368.     open(FD, ">/tmp/networks");
  369.     $string = &gen_networks;
  370.     print FD $string;
  371.     close FD;
  372.  
  373.     # Done writing temp stuff
  374.  
  375.     &invoke("hostname $fqdn");
  376.     $ret = &invoke("ifconfig $iface $ipaddr netmask $netmask broadcast $broadcast");
  377.     $ret = &invoke("route add -net $network netmask $netmask") unless ($ret != 0);
  378.     $ret = &invoke("route add default gw $gateway metric 1")
  379.     if (($gateway ne "none") && ($ret == 0));
  380.     
  381.     if ($ret != 0) {
  382.     $net_up = 0;
  383.     &rhs_msgbox ( "Error",
  384. <<EOM
  385. >
  386. An error occurred while setting up the network.
  387. Please check to see that it is configured properly.
  388. >
  389. EOM
  390.              , 70);
  391.     return 0;
  392.     }
  393.  
  394.     $net_up = 1;
  395.     return 1;
  396. }
  397.  
  398. ########## Individual Network config dialogs ####################
  399.  
  400. sub net_interface {
  401.  
  402.     if ($express_install) {
  403.     # just assume internal
  404.     # I dont even know if it will work with an "external"
  405.     $dialog_result = "internal";
  406.     } else {
  407.     if (! &rhs_menu ( "Network Configuration",
  408. <<EOM
  409. Which type of Ethernet adapter does this computer have?
  410. EOM
  411.              , 70, 2,
  412.              "internal", "Internal Ethernet card",
  413.              "external",  "D-Link external adapter")) {
  414.         return 0;
  415.     }
  416.     }
  417.  
  418.     $interface = $dialog_result;
  419.     if ($interface eq "internal") {
  420.     $iface = "eth0";
  421.     } else {
  422.     $iface = "dl0";
  423.     }
  424.     return 1;
  425. }
  426.  
  427. sub net_hostname {
  428.  
  429.     if (! &rhs_inputbox ( "Network Configuration",
  430. <<EOM
  431. What hostname have you selected for this computer? (Example: torgo)
  432. EOM
  433.              , 70, $hostname)) {
  434.     return 0;
  435.     }
  436.  
  437.     $hostname = $dialog_result;
  438.     return 1;
  439. }
  440.  
  441. sub net_domainname {
  442.  
  443.     if (! &rhs_inputbox ( "Network Configuration",
  444. <<EOM
  445. What domain name is this computer part of? (Example: redhat.com)
  446. EOM
  447.              , 70, $domainname)) {
  448.     return 0;
  449.     }
  450.  
  451.     $domainname = $dialog_result;
  452.     return 1;
  453. }
  454.  
  455. sub net_fqdn {
  456.     local ( $tmp, $ex );
  457.  
  458.     if ($hostname ne "" && $domainname ne "") {
  459.         $tmp = $hostname . "." . $domainname;
  460.     }
  461.     if ($fqdn ne "") {
  462.         $tmp = $fqdn;
  463.     }
  464.  
  465.     if (! &rhs_inputbox ( "Network Configuration",
  466. <<EOM
  467. >
  468. What is the fully qualified domain name (FQDN) of this computer? (Example: torgo.redhat.com)
  469. >
  470. EOM
  471.              , 70, $tmp)) {
  472.     return 0;
  473.     }
  474.  
  475.     $fqdn = $dialog_result;
  476.     return 1;
  477. }
  478.  
  479. sub net_ipaddr {
  480.  
  481.     if (! &rhs_inputbox ( "Network Configuration",
  482. <<EOM
  483. >
  484. What is the IP address of this computer? (Example: 199.183.24.2)
  485. >
  486. EOM
  487.              , 70, $ipaddr)) {
  488.     return 0;
  489.     }
  490.  
  491.     if ($dialog_result =~ /^(.*)\.(.*)\.(.*)\.(.*)$/) {
  492.         if ($1 > 223) {
  493.             if (! &rhs_yesno ( "Network Configuration",
  494. <<EOM
  495. >
  496. You have indicated a reserved network address. Please 
  497. confirm this choice.
  498. >
  499. EOM
  500.                   , 70 )) {
  501.         return 0;
  502.         }
  503.         }
  504.     }
  505.  
  506.     $ipaddr = $dialog_result;
  507.     return 1;
  508. }
  509.  
  510. sub net_network {
  511.     local ( $tmp );
  512.  
  513.     if ($ipaddr =~ /^(.*)\.(.*)\.(.*)\.(.*)$/) {
  514.         $tmp = $ipaddr;
  515.         $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/$1.0.0.0/ if ($1 <= 26);
  516.         $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/$1.$2.0.0/
  517.             if ($1 > 26 && $1 <= 128);
  518.         $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/$1.$2.$3.0/ if ($1 > 128);
  519.     }
  520.     $tmp = $network if ($network ne "");
  521.  
  522.     if (! &rhs_inputbox ( "Network Configuration",
  523. <<EOM
  524. >
  525. What is the network address of this computer? (Example: 199.183.24.0)
  526. >
  527. EOM
  528.              , 70, $tmp)) {
  529.     return 0;
  530.     }
  531.  
  532.     $network = $dialog_result;
  533.     return 1;
  534. }
  535.  
  536. sub net_netmask {
  537.     local ( $tmp );
  538.  
  539.     if ($ipaddr =~ /^(.*)\.(.*)\.(.*)\.(.*)$/) {
  540.         $tmp = $ipaddr;
  541.         $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/255.0.0.0/ if ($1 <= 26);
  542.         $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/255.255.0.0/
  543.             if ($1 > 26 && $1 <= 128);
  544.         $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/255.255.255.0/ if ($1 > 128);
  545.     }
  546.     $tmp = $netmask if ($netmask ne "");
  547.  
  548.     if (! &rhs_inputbox ( "Network Configuration",
  549. <<EOM
  550. >
  551. What is the netmask used by this computer? (Example: 255.255.255.0)
  552. >
  553. EOM
  554.              , 70, $tmp)) {
  555.     return 0;
  556.     }
  557.  
  558.     $netmask = $dialog_result;
  559.     return 1;
  560. }
  561.  
  562. sub net_broadcast {
  563.     local ( $tmp );
  564.  
  565.     if ($ipaddr =~ /^(.*)\.(.*)\.(.*)\.(.*)$/) {
  566.         $tmp = $ipaddr;
  567.         $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/$1.255.255.255/ if ($1 <= 26);
  568.         $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/$1.$2.255.255/
  569.             if ($1 > 26 && $1 <= 128);
  570.         $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/$1.$2.$3.255/ if ($1 > 128);
  571.     }
  572.     $tmp = $broadcast if ($broadcast ne "");
  573.  
  574.     if (! &rhs_inputbox ( "Network Configuration",
  575. <<EOM
  576. >
  577. What is the broadcast address used by this computer? (Example: 199.183.24.255)
  578. >
  579. EOM
  580.              , 70, $tmp)) {
  581.     return 0;
  582.     }
  583.  
  584.     $broadcast = $dialog_result;
  585.     return 1;
  586. }
  587.  
  588. sub net_gateway {
  589.     local ( $tmp );
  590.  
  591.     if (! &rhs_yesno ( "Network Configuration",
  592. <<EOM
  593. >
  594. Does this computer use a gateway?
  595. >
  596. EOM
  597.               , 70 )) {
  598.     $gateway = "none";
  599.     return 1;
  600.     }
  601.  
  602.     if ($ipaddr =~ /^(.*)\.(.*)\.(.*)\.(.*)$/) {
  603.     $tmp = $ipaddr;
  604.     $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/$1./ if ($1 <= 26);
  605.     $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/$1.$2./
  606.         if ($1 > 26 && $1 <= 128);
  607.     $tmp =~ s/^(.*)\.(.*)\.(.*)\.(.*)$/$1.$2.$3./ if ($1 > 128);
  608.     }
  609.     $tmp = $gateway if ($gateway ne "" && $gateway ne "none");
  610.  
  611.     if (! &rhs_inputbox ( "Network Configuration",
  612. <<EOM
  613. >
  614. What is the IP address of the gateway used by this computer?
  615. >
  616. EOM
  617.              , 70, $tmp)) {
  618.     return 0;
  619.     }
  620.  
  621.     $gateway = $dialog_result;
  622.     return 1;
  623. }
  624.  
  625. sub net_nameservers {
  626.  
  627.     @nslist = ();
  628.     if (! &rhs_yesno ( "Network Configuration",
  629. <<EOM
  630. >
  631. Does this computer use a nameserver?
  632. >
  633. EOM
  634.               , 70)) {
  635.     return 0;
  636.     }
  637.  
  638.     do {
  639.         if (! &rhs_inputbox ( "Network Configuration",
  640. <<EOM
  641. >
  642. What is the IP address of the nameserver?
  643. >
  644. EOM
  645.                  , 70, "")) {
  646.         return 0;
  647.     }
  648.  
  649.         $nslist[@nslist] = $dialog_result;
  650.     } while (&rhs_yesno ( "Network Configuration",
  651. <<EOM
  652. >
  653. Does this computer use another nameserver?
  654. >
  655. EOM
  656.              , 70));
  657.  
  658.     return 1;
  659. }
  660.  
  661. sub gen_network {
  662.     local ( $res );
  663.     
  664.     $res =  "NETWORKING=yes\n";
  665.     $res .= "HOSTNAME=$fqdn\n";
  666.  
  667.     return $res;
  668. }
  669.  
  670. sub gen_ifcfg_eth {
  671.     return
  672. <<EOM
  673. #!/bin/sh
  674.  
  675. #>>>Device type: ethernet
  676.  
  677. #>>>Variable declarations:
  678. DEVICE=$iface
  679. IPADDR=$ipaddr
  680. NETMASK=$netmask
  681. NETWORK=$network
  682. BROADCAST=$broadcast
  683. GATEWAY=$gateway
  684. ONBOOT=yes
  685. #>>>End variable declarations
  686. EOM
  687.     ;
  688. }
  689.  
  690. sub gen_HOSTNAME {
  691.     return "$fqdn\n";
  692. }
  693.  
  694. sub gen_hosts {
  695.     local ( $res );
  696.     if ($net_configed == 1) {
  697.     $res =  sprintf("%-18s %-25s\n", "127.0.0.1", "localhost");
  698.         $res .= sprintf("%-18s %-25s %s\n", $ipaddr, $fqdn, $hostname);
  699.     } else {
  700.     $res =  sprintf("%-18s %-25s %s\n", "127.0.0.1", "localhost", $fqdn);
  701.     }
  702.     return $res;
  703. }
  704.  
  705. sub gen_resolv_conf {
  706.     local ( $res, $tmp, $domain_bit, $i );
  707.     
  708.     $res = "domain $domainname\n";
  709.  
  710.     # There needs to be a "search" line in here
  711.     $res .= "search";
  712.     $tmp = $domainname;
  713.     for (;;) {
  714.     last if (! ($tmp =~ /\./));
  715.     $domain_bit = $tmp;
  716.     $res .= " $domain_bit";
  717.     $tmp =~ s/^\w*\.//;
  718.     last if ($tmp eq $domain_bit);
  719.     }
  720.     $res .= "\n";
  721.  
  722.     for ($i = 0; $i < @nslist; $i++) {
  723.     $res .= "nameserver $nslist[$i]\n";
  724.     }
  725.  
  726.     return $res;
  727. }
  728.  
  729. sub gen_networks {
  730.     local ( $res );
  731.     $res = "loopback 127.0.0.0\n";
  732.     if ($net_configed == 1) {
  733.         $res .= "localnet $network\n";
  734.     }
  735.     return $res;
  736. }
  737.  
  738. sub finish_net {
  739.  
  740.     local ( $tmp, $domain_bit, $i, $string );
  741.  
  742.     # Indicate networking - we always have a loopback device
  743.     open(FD, ">$fsmount/etc/sysconfig/network");
  744.     $string = &gen_network;
  745.     print FD $string;
  746.     close FD;
  747.  
  748.     # Configure ethernet device
  749.     if ($net_configed != 0) {
  750.     open(FD, ">$fsmount/etc/sysconfig/network-scripts/ifcfg-$iface");
  751.     $string = &gen_ifcfg_eth;
  752.     print FD $string;
  753.     close FD;
  754.     }
  755.  
  756.     # /etc/HOSTNAME
  757.  
  758.     open(FD, ">$fsmount/etc/HOSTNAME");
  759.     $string = &gen_HOSTNAME;
  760.     print FD $string;
  761.     close FD;
  762.  
  763.     # /etc/hosts
  764.  
  765.     open(FD, ">$fsmount/etc/hosts");
  766.     $string = &gen_hosts;
  767.     print FD $string;
  768.     close FD;
  769.  
  770.     # /etc/networks
  771.  
  772.     open(FD, ">$fsmount/etc/networks");
  773.     $string = &gen_networks;
  774.     print FD $string;
  775.     close FD;
  776.  
  777.     # /etc/resolv.conf
  778.     
  779.     open (FD, ">$fsmount/etc/resolv.conf");
  780.     $string = &gen_resolv_conf;
  781.     print FD $string;
  782.     close FD;
  783.  
  784.     return 1;
  785. }
  786.  
  787. sub config_hostname {
  788.  
  789.     if ($net_configed) {
  790.     if (! $express_install) {
  791.         &rhs_msgbox("Notice",
  792. <<EOM
  793. >
  794. You have already configured your hostname
  795. to be $fqdn (during network configuration).
  796. This will be used unless you re-configure networking.
  797. >
  798. EOM
  799.             , 60);
  800.     }
  801.     return 1;
  802.     }
  803.  
  804.     if (! &rhs_inputbox("Hostname",
  805. <<EOM
  806. >
  807. Please enter the hostname that you wish to use for your machine.
  808. >
  809. EOM
  810.             , 60, "")) {
  811.     return 0;
  812.     }
  813.  
  814.     $hostname = $dialog_result;
  815.     $fqdn = $dialog_result;
  816.     &invoke("hostname $fqdn");
  817.  
  818.     return 1;
  819. }
  820.  
  821. sub net_reset {
  822.  
  823.     &_uninit_net;
  824.     $net_configed = 0;
  825. }
  826.  
  827. ##########################
  828. 1;
  829.