diff --git a/xCAT-rmc/lib/perl/TEAL/Semaphore.pm b/xCAT-rmc/lib/perl/TEAL/Semaphore.pm new file mode 100644 index 000000000..5c912e625 --- /dev/null +++ b/xCAT-rmc/lib/perl/TEAL/Semaphore.pm @@ -0,0 +1,22 @@ +package TEAL::Semaphore; + +use strict; +use warnings; +require IPC::SysV; + +sub new { + my $class = shift; + my $self = {}; + my $key = IPC::SysV::ftok("/var/log/teal",0x646c6100); + $self->{ID} = semget($key,1,0); + bless $self,$class; + return $self; +} + +sub post { + my $self = shift; + my $op = pack("s!3",0,1,0); + semop $self->{ID},$op || die "failed to post" +} + +1; diff --git a/xCAT-rmc/xCAT-rmc.spec b/xCAT-rmc/xCAT-rmc.spec index 46ab616e8..afc9f4354 100644 --- a/xCAT-rmc/xCAT-rmc.spec +++ b/xCAT-rmc/xCAT-rmc.spec @@ -35,6 +35,7 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon mkdir -p $RPM_BUILD_ROOT/install/postscripts mkdir -p $RPM_BUILD_ROOT/install/postscripts/rmcmon/resources mkdir -p $RPM_BUILD_ROOT/install/postscripts/rmcmon/scripts +mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/TEAL set +x cp plugin/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring @@ -42,6 +43,9 @@ cp -r resources $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/rmc cp scripts/* $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon chmod 755 $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon/* + +cp lib/perl/TEAL/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/TEAL + set -x cp scripts/configrmcnode $RPM_BUILD_ROOT/install/postscripts