From 12976c07a6ee6e87219cbb47c999092e3843fbb0 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <[email protected]>
Date: Tue, 18 Mar 2014 21:59:43 +0100
Subject: [PATCH] support for non-linux

---
Makefile.PL                               | 5 +----
lib/Tapper/Installer/Precondition/Exec.pm | 5 +++--
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index 55aa1e0..5a5d628 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,6 +1,3 @@
-use lib 'inc';
-use Devel::AssertOS qw[Linux];
-
use strict;
use warnings;

@@ -41,7 +38,7 @@ my %WriteMakefileArgs = (
    "Hash::Merge::Simple" => 0,
    "IO::Handle" => 0,
    "IO::Select" => 0,
-    "Linux::Personality" => 0,
+    ($^O eq 'linux' ? ("Linux::Personality" => 0) : ()),
    "Log::Log4perl" => 0,
    "Moose" => 0,
    "MooseX::Log::Log4perl" => 0,
diff --git a/lib/Tapper/Installer/Precondition/Exec.pm b/lib/Tapper/Installer/Precondition/Exec.pm
index 6d2fbe0..d19f87b 100644
--- a/lib/Tapper/Installer/Precondition/Exec.pm
+++ b/lib/Tapper/Installer/Precondition/Exec.pm
@@ -13,7 +13,6 @@ use warnings;
use Moose;
use IO::Handle; # needed to set pipe nonblocking
use IO::Select;
-use Linux::Personality qw/personality PER_LINUX32 /;

extends 'Tapper::Installer::Precondition';

@@ -71,7 +70,9 @@ sub install
                ($error, $output)    = $self->log_and_exec("mount -t sysfs sys ".$self->cfg->{paths}{base_dir}."/sys");
                ($error, $output)    = $self->log_and_exec("mount -t proc proc ".$self->cfg->{paths}{base_dir}."/proc");
                my $arch = $exec->{arch} // "";
-                personality(PER_LINUX32) if $arch eq 'linux32';
+               if ($arch eq 'linux32') {
+                       Linux::Personality::personality(Linux::Personality::PER_LINUX32());
+               }
                chroot $self->cfg->{paths}{base_dir};
                chdir ("/");
                %ENV = (%ENV, %{$exec->{environment} || {} });
--
1.8.3.4