[arch-releng] Get Mac Address for profiles - Proof of Concept

Jud jud at judfilm.net
Wed Apr 1 10:06:46 EDT 2009


Just to get the ball rolling. This script would be started by the boot
process outside of aif. Any ideas/comments welcome.

#!/bin/sh
# Proof of Concept

# ToDo:
# Work backwards - test for wireless then wired
eth2/eth1/wlan1/wlan0/eth0 any others? # Make into function(s)?
# More Sanity Tests?
# Another layer - groups of mac address for a profile type -
profile:desktop01:<mac>,<mac>,<mac>
# How would the boot process call this script without interrupting the
possibility of a normal install?

# Get the MAC address for eth0
var=$(ifconfig -a | grep eth0)

# We only need the MAC Address
var=$(echo ${var: -19})

# Convert to be a filename for our purposes; Strip out ':'
var=$(echo ${var//:/})

# Make sure it is Hex aka within the MAC Address specs and ifconfig
output
if [[ $var =~ [[:xdigit:]] ]]; then
  echo "$var".profile
else
  echo "error"; exit 1
fi

# Check if file exists and is readable
if [ -r "$var.profile" ]; then

# Start Auto Install, when finished reboot
# Note: for auto-reboot the install drive should not be the primary
boot device 
aif -p automatic -c $var.profile && reboot

# End of File


More information about the arch-releng mailing list