Last active
December 10, 2015 10:08
-
-
Save robinsmidsrod/4419556 to your computer and use it in GitHub Desktop.
Some Enterprise-grade HP servers seems to identify with the wrong UUID to iPXE.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
use strict; | |
use warnings; | |
use Test::More; | |
my $actual_uuid = '1F00B3E0-00C6-0800-2C4A-BCAEC5280EAD'; | |
my $ipxe_uuid = 'e0b3001f-c600-0008-2c4a-bcaec5280ead'; | |
is( convert_ipxe_uuid($ipxe_uuid), $actual_uuid, "iPXE UUID converted successfully" ); | |
done_testing(); | |
exit; | |
sub convert_ipxe_uuid { | |
my ($ipxe_uuid) = @_; | |
my @parts = split /-/, uc $ipxe_uuid; | |
$parts[0] = reverse_hex($parts[0]); | |
$parts[1] = reverse_hex($parts[1]); | |
$parts[2] = reverse_hex($parts[2]); | |
return uc join("-", @parts); | |
} | |
sub reverse_hex { | |
my ($hex_str) = @_; | |
return unpack("H*", | |
join("", | |
reverse | |
split("", | |
pack("H*", $hex_str) | |
) | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See details here: http://forum.ipxe.org/showthread.php?tid=6685