Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #
- # This is a wrapper for dmidecode that will return the configured UUID
- # when 'dmidecode -s system-uuid' is called. Otherwise, it will call dmidecode
- # and return as appropriate.
- #
- use strict;
- use warnings;
- use IO::Handle;
- # Desired System UUID
- my $uuid="31873b9e-1069-42ce-b950-137ae5eaa3d1";
- my $exit=0;
- # Read command line.
- my $cla="";
- foreach my $arg (@ARGV) { $cla.=$arg." "; }
- $cla=~s/\s+$//;
- if ($cla eq "-s system-uuid")
- {
- print $uuid, "\n";
- }
- else
- {
- # Do a real dmidecode call.
- my $sc="/usr/sbin/dmidecode $cla 2>&1 |";
- my $fh=IO::Handle->new();
- open ($fh, $sc) or die $!;
- while (<$fh>)
- {
- print $_;
- }
- $fh->close();
- $exit=$?;
- }
- exit($exit);
Advertisement
Add Comment
Please, Sign In to add comment