summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/OpenSLX/Utils.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm
index 346e9d4d..6ebd4d7c 100644
--- a/lib/OpenSLX/Utils.pm
+++ b/lib/OpenSLX/Utils.pm
@@ -34,6 +34,7 @@ $VERSION = 1.01;
getFQDN
readPassword
hostIs64Bit
+ getAvailableBusyboxApplets
);
=head1 NAME
@@ -558,4 +559,29 @@ sub hostIs64Bit
return $arch =~ m[64];
}
+=item B<getAvailableBusyboxApplets()>
+
+Returns the list of the applets that is provided by the given busybox binary.
+
+=cut
+
+sub getAvailableBusyboxApplets
+{
+ my $busyboxBinary = shift;
+
+ my $busyboxHelp = qx{$busyboxBinary --help};
+ if ($busyboxHelp !~ m{defined functions:(.+)\z}ims) {
+ die "unable to parse busybox --help output:\n$busyboxHelp";
+ }
+ my $rawAppletList = $1;
+ my @busyboxApplets
+ = map {
+ $_ =~ s{\s+}{}igms;
+ $_;
+ }
+ split m{,}, $rawAppletList;
+
+ return @busyboxApplets;
+}
+
1;