summaryrefslogtreecommitdiffstats
path: root/installer/slxos-export
diff options
context:
space:
mode:
authorOliver Tappe2007-06-20 21:39:31 +0200
committerOliver Tappe2007-06-20 21:39:31 +0200
commite41af69c5ad53d013a1d45b96e64140b25853aaa (patch)
treec3b6b13d17aa3a7cd6791b116b3aad22f073df40 /installer/slxos-export
parent* added support for creating the squashfs only if the vendor-OS has been (diff)
downloadcore-e41af69c5ad53d013a1d45b96e64140b25853aaa.tar.gz
core-e41af69c5ad53d013a1d45b96e64140b25853aaa.tar.xz
core-e41af69c5ad53d013a1d45b96e64140b25853aaa.zip
* fixed bug in used-count handling for exports that caused the image to
be deleted no matter how many block devices used it * beautified list of exported vendor-OSes (slxos-export list-ex) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1183 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer/slxos-export')
-rwxr-xr-xinstaller/slxos-export30
1 files changed, 25 insertions, 5 deletions
diff --git a/installer/slxos-export b/installer/slxos-export
index cdf37672..19ec3d5b 100755
--- a/installer/slxos-export
+++ b/installer/slxos-export
@@ -60,18 +60,38 @@ my $action = shift @ARGV;
if ($action =~ m[^list-ex]i) {
print _tr("List of exported vendor-OSes:\n");
foreach my $type (sort keys %supportedExportFileSystems) {
- my @files = <$openslxConfig{'public-path'}/export/$type/*>;
+ # list all image files, followed by the block devices using it:
+ my @files = map {
+ s[^.+/][];
+ $_
+ } sort <$openslxConfig{'public-path'}/export/$type/*>;
+ my %imageFiles;
+ foreach my $file (@files) {
+ if ($file =~ m[^(.+)@(.+)$]) {
+ # it's a link referring to a block device using this image,
+ # we collect the name of the block device:
+ push @{$imageFiles{$1}}, $2;
+ } else {
+ # it's an image file, we setup an empty array of block devices:
+ $imageFiles{$file} = [];
+ }
+ }
print join(
'',
map {
- s[^.+/][];
- "\t$type/$_\n";
+ my $devices = join(',', @{$imageFiles{$_}});
+ if (length($devices)) {
+ my $name = "$type/$_";
+ "\t$name".substr(' ' x 30, length($name))."($devices)\n";
+ } else {
+ "\t$type/$_\n";
+ }
}
grep {
# filter out RSYNC_TMP folders:
$_ !~ m[###];
}
- sort @files
+ sort keys %imageFiles
);
}
} elsif ($action =~ m[^list-in]i) {
@@ -83,7 +103,7 @@ if ($action =~ m[^list-ex]i) {
s[^.+/][];
"\t$_\n";
}
- sort @files
+ sort @files
);
} elsif ($action =~ m[^list-ty]i) {
print _tr("List of supported export types:\n\t");