Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clean out code for windows.
  • Loading branch information
perlDreamer committed Jan 6, 2012
1 parent df1d7e5 commit f62fd7c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 37 deletions.
1 change: 0 additions & 1 deletion wre/lib/WRE/Config.pm
Expand Up @@ -57,7 +57,6 @@ necessary.

sub getRoot {
my ($self,$path) = @_;
my $volume = WRE::Host->new(wreConfig => $self)->getOsName eq 'windows' ? 'c:' : '';
my $root = dir("/data/wre");
if (defined $path) {
return $root->file($path)->stringify;
Expand Down
12 changes: 5 additions & 7 deletions wre/lib/WRE/File.pm
Expand Up @@ -62,14 +62,12 @@ sub changeOwner {
my $self = shift;
my $path = shift;
my $host = WRE::Host->new(wreConfig=>$self->wreConfig);
if ($host->getOsName ne "windows") {
my $refId = id $self;
if ($groupId{$refId} eq "" || $userId{$refId} eq "") {
my $user = $self->wreConfig->get("user");
(undef, undef, $userId{$refId}, $groupId{$refId}) = getpwnam $user or carp $user." not in passwd file";
}
chown $userId{$refId}, $groupId{$refId}, $path;
my $refId = id $self;
if ($groupId{$refId} eq "" || $userId{$refId} eq "") {
my $user = $self->wreConfig->get("user");
(undef, undef, $userId{$refId}, $groupId{$refId}) = getpwnam $user or carp $user." not in passwd file";
}
chown $userId{$refId}, $groupId{$refId}, $path;
}


Expand Down
15 changes: 0 additions & 15 deletions wre/lib/WRE/Host.pm
Expand Up @@ -103,21 +103,9 @@ sub getOsType {
elsif ( -f "/etc/fedora-release" ) {
return "Fedora";
}
elsif ( -f "/etc/slackware-release" || -f "/etc/slackware-version" ) {
return "Slackware";
}
elsif ( -f "/etc/debian_release" || -f "/etc/debian_version" ) {
return "Debian";
}
elsif ( -f "/etc/mandrake-release" ) {
return "Mandrake";
}
elsif ( -f "/etc/yellowdog-release" ) {
return "YellowDog";
}
elsif ( -f "/etc/gentoo-release" ) {
return "Gentoo";
}
elsif ( -f "/etc/lsb-release" ) {
return "Ubuntu";
}
Expand Down Expand Up @@ -150,9 +138,6 @@ Returns a boolean indicating whether the current user is a privileged user for t

sub isPrivilegedUser {
my $self = shift;
if ($self->getOsName eq "windows" || $< == 0) {
return 1;
}
return 0;
}

Expand Down
18 changes: 4 additions & 14 deletions wre/lib/WRE/Spectre.pm
Expand Up @@ -136,13 +136,8 @@ sub start {
$wreConfig->set("wreMonitor/spectreAdministrativelyDown", 0);
my $host = WRE::Host->new(wreConfig => $wreConfig);
my $cmd = "";
if ($host->getOsName eq "windows") {
$cmd = "net start WREspectre";
}
else {
chdir $wreConfig->getWebguiRoot("/sbin");
$cmd = $wreConfig->getRoot("/prereqs/bin/perl")." spectre.pl --daemon";
}
chdir $wreConfig->getWebguiRoot("/sbin");
$cmd = $wreConfig->getRoot("/prereqs/bin/perl")." spectre.pl --daemon";
system($cmd);
while ($count < 10 && $success == 0) {
sleep(1);
Expand All @@ -168,13 +163,8 @@ sub stop {
$wreConfig->set("wreMonitor/spectreAdministrativelyDown", 1);
my $host = WRE::Host->new(wreConfig => $wreConfig);
my $cmd = "";
if ($host->getOsName eq "windows") {
$cmd = "net stop WREspectre";
}
else {
chdir($wreConfig->getWebguiRoot("/sbin"));
$cmd = $wreConfig->getRoot("/prereqs/bin/perl")." spectre.pl --shutdown";
}
chdir($wreConfig->getWebguiRoot("/sbin"));
$cmd = $wreConfig->getRoot("/prereqs/bin/perl")." spectre.pl --shutdown";
`$cmd`; # catch command line output
while ($count < 10 && $success == 1) {
sleep(1);
Expand Down

0 comments on commit f62fd7c

Please sign in to comment.