commit - 243f1a27b4b7edd416aff0664b10af30e24698e9
commit + 4851eeb93b663c97ff3884a93d36bdc6e77fe73e
blob - 65d916305182bb5e4bbec8d7ab3625977a8c960e
blob + 68d79c963f04d9b580bdc76e05ba6245fea11974
--- secstore
+++ secstore
}
}
-# secstore_list
-#
-# Produce a listing of files in the gpm directory, using the SECSTORE_LSCMD
-# environment variable if defined.
-sub secstore_list {
- my $cmd = $ENV{SECSTORE_LSCMD};
+# find $file
+sub find {
+ my $path = shift @_;
+ my $f = basename $path;
+
+ if ($f eq "." || $f eq "..") {
+ return 1;
+ }
- unless (defined $cmd) {
- opendir my $dh, "." or die "couldn't open directory .: $!\n";
- while (readdir $dh) {
- if ($_ ne "." && $_ ne ".." && -d $_) {
- $cmd = "find . -type f | sed 's,^\./,,'";
- last;
- }
- }
- $cmd = "ls" unless defined $cmd;
+ if (-d $path) {
+ my $dh;
+ if (!opendir $dh, $path) {
+ print STDERR "Can't open directory $path: $!\n";
+ return 0;
+ }
+ while (readdir $dh) {
+ find($path . "/" . $_);
+ }
+ } else {
+ print "$path\n";
}
- system $cmd;
- $? == 0 or exit 1;
+
+ return 1;
+
}
+
+# secstore_list
+#
+# Produce a listing of files in the secstore directory.
+sub secstore_list {
+ my $status = 1;
+ opendir my $dh, "." or die "couldn't open directory .: $!\n";
+ while (readdir $dh) {
+ $status = find($_) ? $status : 0;
+ }
+ exit $status;
+}
+
# move_file from to
sub move_file {
my ($from, $to, $force) = @_;