Skip to content

Commit

Permalink
Merge pull request #316 from mariux64/update-kvm-monitor-from-0.9-to-…
Browse files Browse the repository at this point in the history
…0.91

kvm-monitor: dumped inline build, added missing kvms
  • Loading branch information
david authored Mar 9, 2017
2 parents 6d3bf71 + 1aae39a commit 96558a2
Showing 1 changed file with 2 additions and 116 deletions.
118 changes: 2 additions & 116 deletions kvm-monitor.be0
Original file line number Diff line number Diff line change
@@ -1,119 +1,5 @@
#!/usr/bin/env beesh

# BEE_VERSION kvm-monitor-0.9-2

mee_build() {

mkdir -pv ${B}/etc/udev/rules.d
cd ${B}/etc/udev/rules.d

# build inline
/usr/bin/cat > 51-raritan-kvm.rules <<__'RULE'
SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="14dd", ENV{ID_MODEL_ID}=="0002", PROGRAM="/lib/udev/kvm_monitor.pl"
__RULE


chmod 644 51-raritan-kvm.rules
cd -

mkdir -pv ${B}/lib/udev
cd ${B}/lib/udev


# build inline
/usr/bin/cat > kvm_monitor.pl <<__'SCRIPT'
#!/usr/bin/perl -w

use strict;
# use Data::Dumper; $Data::Dumper::Sortkeys=1;
# print Dumper \%ENV

# root> lsusb -v | grep iSerial
my %serial_to_name = qw(
960f2408004ca12a2641C894DA0F1B6A kvm03
96132408034ca1d22641C894DA0F1B6A kvm04
96112408034ca1d62641C894DA0F1B6A kvm05
960d2408004ca12eDAB76E6660AFB498 kvm06
96132408004ca11e2641C894DA0F1B6A kvm07
96132408004ca1322641C894DA0F1B6A kvm09
96fec24603c408f42641C894DA0F1B6A kvm10
960dc24600c47d202641C894DA0F1B6A kvm12
960dc24600c47d282641C894DA0F1B6A kvm13
96fec24600c408082641C894DA0F1B6A kvm14
96fac24603c46bfc2641C894DA0F1B6A kvm15
96fec24603c408c82641C894DA0F1B6A kvm16
96fbc24600c4a7402641C894DA0F1B6A kvm17
96fcc24603c4a7fc2641C894DA0F1B6A kvm18
);

my $action = $ENV{ACTION} || 'missing action';
my $id = $ENV{ID_SERIAL_SHORT} || 'missing environment variable';

my $name = sprintf "Unknown KVM with ID '%s'", $id;
$name = $serial_to_name{$id} if exists $serial_to_name{$id};

my $msg = 'kvm-event: ' . $name;
if ($action eq 'add') {
$msg .= ' was attached.';
} elsif ($action eq 'remove') {
$msg .= ' was removed.';
} else {
$msg .= ", and an unknown event has occurred ($action)";
}

system('/usr/bin/logger', $msg);

exit;

=head2

The environment seen (kvm13)

ACTION=add
ACTION=remove

==== event ====
Thu May 26 13:08:33 CEST 2016
ACTION=add
BUSNUM=002
DEVLINKS=/dev/char/189:136
DEVNAME=bus/usb/002/009
DEVNUM=009
DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3
DEVTYPE=usb_device
ID_BUS=usb
ID_MODEL=Multidevice
ID_MODEL_ENC=Multidevice
ID_MODEL_ID=0002
ID_REVISION=0001
ID_SERIAL=Peppercon_AG_Multidevice_960dc24600c47d282641C894DA0F1B6A
ID_SERIAL_SHORT=960dc24600c47d282641C894DA0F1B6A
ID_USB_INTERFACES=:030101:030102:
ID_VENDOR=Peppercon_AG
ID_VENDOR_ENC=Peppercon\x20AG
ID_VENDOR_ID=14dd
MAJOR=189
MINOR=136
PRODUCT=14dd/2/1
PWD=/
SEQNUM=3362
SHLVL=1
SUBSYSTEM=usb
TYPE=0/0/0
UDEV_LOG=3
_=/usr/bin/env

=cut

__SCRIPT

chmod 755 kvm_monitor.pl
cd -

echo "# syntax check on: '${B}/lib/udev/kvm_monitor.pl'";
/usr/bin/perl -wc ${B}/lib/udev/kvm_monitor.pl || exit

cp -vax ${B}/* ${D}

}
# BEE_VERSION kvm-monitor-0.91-0

SRCURL[0]="http://macheteinfach:8030/kvm_tools/releases/kvm_monitor-${PKGVERSION}.tgz"

0 comments on commit 96558a2

Please sign in to comment.