Run MAC address generation within a known environment
authorMatt Palmer <mpalmer@hezmatt.org>
Thu, 21 Apr 2016 01:22:57 +0000 (11:22 +1000)
committerMatt Palmer <mpalmer@hezmatt.org>
Thu, 21 Apr 2016 01:22:57 +0000 (11:22 +1000)
We're taking the Mulder approach, Trust No-one.  ms5sum and sed may not be
as they seem...

launcher

index 0a7791142c85ea3556112cc4a7bb3cfa1c1662b0..c2ee2440163a6ab533d1dda71cbe38db3a2bd8c3 100755 (executable)
--- a/launcher
+++ b/launcher
@@ -528,7 +528,7 @@ run_start(){
      # docker added more hostname rules
      hostname=${hostname/_/-}
 
-     mac_address="--mac-address $(echo $hostname | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')"
+     mac_address="--mac-address $(echo $hostname | $docker_path run $user_args -i --rm -a stdout -a stderr $image /bin/sh -c "md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/'")"
 
      set -x
      $docker_path run $user_args $links $attach_on_run $restart_policy "${env[@]}" -h "$hostname" \