Bug 68108 - [patch] Adding mac-address /conf selector to diskless boot
Summary: [patch] Adding mac-address /conf selector to diskless boot
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 5.2.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-19 12:40 UTC by dirkx
Modified: 2017-12-31 22:37 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (2.53 KB, patch)
2004-06-19 12:40 UTC, dirkx
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dirkx 2004-06-19 12:32:24 UTC
The fix does not work on  a default install. Below fixes that.

Dw.

diff -c3 /tmp/initdiskless initdiskless
*** /tmp/initdiskless   Sat Jun 19 12:51:53 2004
--- initdiskless        Sat Jun 19 13:30:52 2004
***************
*** 40,45 ****
--- 40,46 ----
  #
  #     /conf/base              universal base
  #     /conf/default           modified by a secondary universal base
+ #     /conf/${macaddress}     modified by the mac address of the
physical machine.
  #     /conf/${ipba}           modified based on the assigned broadcast
IP
  #     /conf/${ip}             modified based on the machine's assigned
IP
  #
***************
*** 132,137 ****
--- 133,146 ----
  bootp_ipbca=""
  iflist=`ifconfig -l`
  for i in ${iflist} ; do
+     set `ifconfig ${i} ether`
+     if [ "x$5" = "xether" ]; then
+       _IFS=${IFS}
+       IFS=:
+       set $6
+       boot_mac=$1$2$3$4$5$6
+       IFS=${_IFS}
+     fi
      set `ifconfig ${i}`
      while [ $# -ge 1 ] ; do
          if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then
***************
*** 146,152 ****
          break
      fi
  done
! echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast
${bootp_ipbca}"

  # Figure out our NFS root path
  #
--- 155,161 ----
          break
      fi
  done
! echo "Interface ${boot_mac} ${bootp_ifc} IP-Address ${bootp_ipa}
Broadcast ${bootp_ipbca}"

  # Figure out our NFS root path
  #
***************
*** 159,167 ****
      shift
  done

! # Resolve templates in /conf/base, /conf/default, /conf/${bootp_ipbca},
! # and /conf/${bootp_ipa}.  For each subdirectory found within these
! # directories:
  #
  # - calculate memory filesystem sizes.  If the subdirectory (prior to
  #   NFS remounting) contains the file 'md_size', the contents specified
--- 168,176 ----
      shift
  done

! # Resolve templates in /conf/base, /conf/default, /conf/${boot_mac},
! # /conf/${bootp_ipbca} # and /conf/${bootp_ipa}.  For each subdirectory
! # found within these directories:
  #
  # - calculate memory filesystem sizes.  If the subdirectory (prior to
  #   NFS remounting) contains the file 'md_size', the contents specified
***************
*** 179,185 ****
  #   it before attemping to the remount.  This allows the root to be
  #   relocated without needing to change the remount files.
  #
! for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
      for j in /conf/$i/* ; do
        # memory filesystem size specification
        #
--- 188,194 ----
  #   it before attemping to the remount.  This allows the root to be
  #   relocated without needing to change the remount files.
  #
! for i in base default ${boot_mac} ${bootp_ipbca} ${bootp_ipa} ; do
      for j in /conf/$i/* ; do
        # memory filesystem size specification
        #
Comment 1 dirkx 2004-06-19 12:40:06 UTC
	Right now during a diskless boot /conf/default, /conf/b-cast
	and /conf/ip address is checked for system specific configs.

	As some configs are very tied to HW, rather than to the subnet
	the HW happens to be used with - it can be useful to tie certain
	configs to the mac address.

	The patch below add this facilities very much along the
	lines of that supported by Solaris.

How-To-Repeat: 
	Patch, reboot diskless machine.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:40 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped