summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorOliver Tappe2007-06-20 20:04:19 +0200
committerOliver Tappe2007-06-20 20:04:19 +0200
commit898eca2232289d3f64431bc3763da4b65bb3ae61 (patch)
tree2a213ff0429b76037a6cc0f2fbf9f99ec025ed2a /bin
parent* added support for invoking a chrooted shell for any installed vendor-OS, (diff)
downloadcore-898eca2232289d3f64431bc3763da4b65bb3ae61.tar.gz
core-898eca2232289d3f64431bc3763da4b65bb3ae61.tar.xz
core-898eca2232289d3f64431bc3763da4b65bb3ae61.zip
* split export type into filesystem and (optional) blockdevice, closing
ticket#139 * code-reformatting with perltidy git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1176 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'bin')
-rwxr-xr-xbin/slxldd69
-rwxr-xr-xbin/slxsettings51
2 files changed, 67 insertions, 53 deletions
diff --git a/bin/slxldd b/bin/slxldd
index 88ac7574..a41fc81c 100755
--- a/bin/slxldd
+++ b/bin/slxldd
@@ -52,12 +52,13 @@ my (
$rootPath = '/';
GetOptions(
- 'help|?' => \$helpReq,
- 'man' => \$manReq,
+ 'help|?' => \$helpReq,
+ 'man' => \$manReq,
'root-path=s' => \$rootPath,
- 'verbose' => \$verbose,
- 'version' => \$versionReq,
-) or pod2usage(2);
+ 'verbose' => \$verbose,
+ 'version' => \$versionReq,
+ )
+ or pod2usage(2);
pod2usage(-msg => $abstract, -verbose => 0, -exitval => 1) if $helpReq;
pod2usage(-verbose => 2) if $manReq;
if ($versionReq) {
@@ -73,7 +74,7 @@ if (!$rootPath) {
}
$rootPath =~ s[/+$][];
- # remove trailing slashes
+# remove trailing slashes
if (!@ARGV) {
print STDERR _tr("You need to specify at least one file!\n");
@@ -83,12 +84,13 @@ if (!@ARGV) {
fetchLoaderConfig();
foreach my $file (@ARGV) {
- if (substr($file,0,1) ne '/') {
+ if (substr($file, 0, 1) ne '/') {
# force relative paths relative to $rootPath:
$file = "$rootPath/$file";
}
if (!-e $file) {
- print STDERR _tr("slxldd: unable to find file '%s', skipping it\n", $file);
+ print STDERR _tr("slxldd: unable to find file '%s', skipping it\n",
+ $file);
next;
}
push @filesToDo, $file;
@@ -103,7 +105,7 @@ sub fetchLoaderConfigFile
my $ldConfFile = shift;
open(LDCONF, "< $ldConfFile");
- while(<LDCONF>) {
+ while (<LDCONF>) {
chomp;
if (/^\s*include\s+(.+?)\s*$/i) {
foreach my $incFile (<$rootPath$1>) {
@@ -113,7 +115,7 @@ sub fetchLoaderConfigFile
}
if (/\S+/i) {
s[=.+][];
- # remove any lib-type specifications (e.g. '=libc5')
+ # remove any lib-type specifications (e.g. '=libc5')
push @libFolders, "$rootPath$_";
}
}
@@ -123,12 +125,13 @@ sub fetchLoaderConfigFile
sub fetchLoaderConfig
{
if (!-e "$rootPath/etc") {
- die _tr("'%s'-folder not found, maybe wrong root-path?\n", "$rootPath/etc");
+ die _tr("'%s'-folder not found, maybe wrong root-path?\n",
+ "$rootPath/etc");
}
fetchLoaderConfigFile("$rootPath/etc/ld.so.conf");
# add "trusted" folders /lib and /usr/lib if not already in place:
- if (!grep { m[^$rootPath/lib$]} @libFolders) {
+ if (!grep { m[^$rootPath/lib$] } @libFolders) {
push @libFolders, "$rootPath/lib";
}
if (!grep { m[^$rootPath/usr/lib$] } @libFolders) {
@@ -137,20 +140,21 @@ sub fetchLoaderConfig
# add lib32-folders for 64-bit Debians, as they do not
# refer those in ld.so.conf (which I find strange...)
- if (-e '/lib32' && !grep { m[^$rootPath/lib32$]} @libFolders) {
+ if (-e '/lib32' && !grep { m[^$rootPath/lib32$] } @libFolders) {
push @libFolders, "$rootPath/lib32";
}
if (-e '/usr/lib32'
- && !grep { m[^$rootPath/usr/lib32$] } @libFolders) {
+ && !grep { m[^$rootPath/usr/lib32$] } @libFolders)
+ {
push @libFolders, "$rootPath/usr/lib32";
}
}
sub addLib
{
- my $lib = shift;
+ my $lib = shift;
my $bitwidth = shift;
- my $rpath = shift;
+ my $rpath = shift;
if (!exists $libInfo{$lib}) {
push @libs, $lib;
@@ -163,15 +167,22 @@ sub addLib
foreach my $folder (@folders) {
if (-e "$folder/$lib") {
# have library matching name, now check if the platform is ok, too:
- my $libFileInfo = `file --dereference --brief $folder/$lib 2>/dev/null`;
+ my $libFileInfo =
+ `file --dereference --brief $folder/$lib 2>/dev/null`;
if ($?) {
die _tr("unable to fetch file info for '%s', giving up!\n",
- $folder/$lib);
+ $folder / $lib);
}
my $libBitwidth = ($libFileInfo =~ m[64-bit]i) ? 64 : 32;
if ($bitwidth != $libBitwidth) {
- vlog 0, _tr('%s has wrong bitwidth (%s instead of %s)',
- "$folder/$lib", $libBitwidth, $bitwidth) if $verbose;
+ vlog(
+ 0,
+ _tr(
+ '%s has wrong bitwidth (%s instead of %s)',
+ "$folder/$lib", $libBitwidth, $bitwidth
+ )
+ )
+ if $verbose;
next;
}
$libPath = "$folder/$lib";
@@ -201,7 +212,9 @@ sub addLibsForBinary
print STDERR _tr("\tinfo is: '%s'...\n", $fileInfo) if $verbose;
if ($fileInfo !~ m[^application/(x-executable|x-shared)]i) {
# ignore anything that's not an executable or a shared library
- print STDERR _tr("%s: ignored, as it isn't an executable or a shared library\n", $binary);
+ print STDERR _tr(
+ "%s: ignored, as it isn't an executable or a shared library\n",
+ $binary);
next;
}
@@ -214,7 +227,7 @@ sub addLibsForBinary
chomp $fileInfo;
print STDERR _tr("\tinfo is: '%s'...\n", $fileInfo) if $verbose;
my $bitwidth = ($fileInfo =~ m[64-bit]i) ? 64 : 32;
- # determine whether binary is 32- or 64-bit platform
+ # determine whether binary is 32- or 64-bit platform
# now find out about needed libs, we first try objdump...
if ($verbose) {
@@ -230,7 +243,7 @@ sub addLibsForBinary
print STDERR _tr("\trpath='%s'\n", $rpath);
}
}
- while($res =~ m[^\s*NEEDED\s*(.+?)\s*$]gm) {
+ while ($res =~ m[^\s*NEEDED\s*(.+?)\s*$]gm) {
addLib($1, $bitwidth, $rpath);
}
} else {
@@ -240,7 +253,9 @@ sub addLibsForBinary
}
$res = `readelf -d $binary 2>/dev/null`;
if ($?) {
- die _tr("neither objdump nor readelf seems to be installed, giving up!\n");
+ die _tr(
+ "neither objdump nor readelf seems to be installed, giving up!\n"
+ );
}
# find out if rpath is set for binary:
my $rpath;
@@ -250,15 +265,12 @@ sub addLibsForBinary
print STDERR _tr("\trpath='%s'\n", $rpath);
}
}
- while($res =~ m{\(NEEDED\)[^\[]+\[(.+?)\]\s*$}gm) {
+ while ($res =~ m{\(NEEDED\)[^\[]+\[(.+?)\]\s*$}gm) {
addLib($1, $bitwidth, $rpath);
}
}
}
-
-__END__
-
=head1 NAME
slxldd - OpenSLX-script to determine the libraries required by any given
@@ -306,3 +318,4 @@ Prints the version and exits.
=back
=cut
+
diff --git a/bin/slxsettings b/bin/slxsettings
index 1d4afcb5..e753ad99 100755
--- a/bin/slxsettings
+++ b/bin/slxsettings
@@ -36,27 +36,21 @@ use Pod::Usage;
use FindBin;
use lib "$FindBin::RealBin/../lib";
use lib "$FindBin::RealBin";
- # development path to config-db stuff
+# development path to config-db stuff
use OpenSLX::Basics;
use OpenSLX::Utils;
-my (
- $quiet,
- @reset,
- $helpReq,
- $manReq,
- $versionReq,
-);
+my ($quiet, @reset, $helpReq, $manReq, $versionReq,);
GetOptions(
'quiet' => \$quiet,
- # will avoid printing anything
+ # will avoid printing anything
'reset=s' => \@reset,
- # resets given option to its default
+ # resets given option to its default
- 'help|?' => \$helpReq,
- 'man' => \$manReq,
+ 'help|?' => \$helpReq,
+ 'man' => \$manReq,
'version' => \$versionReq,
);
pod2usage(-msg => $abstract, -verbose => 0, -exitval => 1) if $helpReq;
@@ -75,8 +69,10 @@ my %givenSettings = %cmdlineConfig;
while (scalar @ARGV) {
my $extSetting = shift;
if ($extSetting !~ m[^([-\w]+)=(.+)$]) {
- die _tr("extended setting '%s' has unknown format, expected '<key>=<value>!'",
- $extSetting);
+ die _tr(
+ "extended setting '%s' has unknown format, expected '<key>=<value>!'",
+ $extSetting
+ );
}
$givenSettings{$1} = $2;
}
@@ -90,7 +86,7 @@ my %changed;
foreach my $key (keys %givenSettings) {
my $value = $givenSettings{$key};
next if !defined $value;
- vlog 0, _tr("setting %s to '%s'", $key, $value) unless $quiet;
+ vlog(0, _tr("setting %s to '%s'", $key, $value)) unless $quiet;
my $externalKey = externalKeyFor($key);
if (!($settings =~ s[^\s*$externalKey=.*?$][$externalKey=$value]ms)) {
$settings .= "$externalKey=$value\n";
@@ -102,9 +98,13 @@ foreach my $key (keys %givenSettings) {
foreach my $key (@reset) {
my $externalKey = externalKeyFor($key);
if ($settings =~ s[^\s*?$externalKey=.*?\n][]ms) {
- vlog 0, _tr("removing option '%s' from local settings", $key) unless $quiet;
+ vlog(0,
+ _tr("removing option '%s' from local settings", $key))
+ unless $quiet;
} else {
- vlog 0, _tr("option '%s' didn't exist in local settings!", $key) unless $quiet;
+ vlog(0,
+ _tr("option '%s' didn't exist in local settings!", $key))
+ unless $quiet;
}
$changed{$key}++;
}
@@ -113,7 +113,7 @@ foreach my $key (@reset) {
if (keys %changed) {
my $f = "$openslxConfig{'config-path'}/settings";
open(SETTINGS, "> $f")
- or die _tr("Unable to write local settings file '%s' (%s)", $f, $!);
+ or die _tr("Unable to write local settings file '%s' (%s)", $f, $!);
print SETTINGS $settings;
close(SETTINGS);
@@ -128,10 +128,10 @@ if (!keys %changed) {
print _tr("paths fixed at installation time:\n");
print qq[\t--base-path='$openslxConfig{'base-path'}'\n];
print qq[\t--config-path='$openslxConfig{'config-path'}'\n];
- my $text
- = keys %changed
- ? "resulting base settings (cmdline options):\n"
- : "current base settings (cmdline options):\n";
+ my $text =
+ keys %changed
+ ? "resulting base settings (cmdline options):\n"
+ : "current base settings (cmdline options):\n";
print $text;
my @baseSettings = grep { exists $cmdlineConfig{$_} } keys %openslxConfig;
foreach my $key (sort @baseSettings) {
@@ -150,12 +150,12 @@ sub externalKeyFor
my $key = shift;
$key =~ tr[-][_];
- return "SLX_".uc($key);
+ return "SLX_" . uc($key);
}
sub changedHandler
{
- my $key = shift;
+ my $key = shift;
my $value = shift;
# invoke a key-specific change handler if it exists:
@@ -323,4 +323,5 @@ Prints the version and exits.
slxos-setup, slxos-export, slxconfig, slxconfig-demuxer
-=cut \ No newline at end of file
+=cut
+