Last change
on this file since 27014 was 27014, checked in by ak19, 11 years ago |
First commit for Dspace Depositor Clone (Institutional Repository) containing minor updates to Dr Bainbridge's code used in puka's custom gsdl-instrep installation (ir collection). The files in this commit work if you use the ds metadata set in your collection (DSpace might not use such a metadata set, and it might have been invented for the gsdl-instrep's ir collection). Turn this depositor on by replacing depositor.dm with depositdspace.dm in etc/main.cfg and depositing to a collection using a custom ds metadata set containing Title, Type, Language, Abstract, Sponsorship, Description, Author, Series, Identifier, Subject.
|
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | #!/usr/bin/perl -w
|
---|
2 |
|
---|
3 | use Digest::MD5;
|
---|
4 |
|
---|
5 | use gsdlCGI;
|
---|
6 |
|
---|
7 | sub load_gsdl_utils
|
---|
8 | {
|
---|
9 | my ($gsdlhome) = @_;
|
---|
10 |
|
---|
11 | require "$gsdlhome/perllib/util.pm";
|
---|
12 | }
|
---|
13 |
|
---|
14 | sub generate_checksum
|
---|
15 | {
|
---|
16 | my ($filename,$gsdl_cgi) = @_;
|
---|
17 |
|
---|
18 | if (!defined $filename || ($filename =~ m/^\s*$/)) {
|
---|
19 | $gsdl_cgi->generate_error("No filename given.\n");
|
---|
20 | return;
|
---|
21 | }
|
---|
22 |
|
---|
23 | if (!open(FILE, $filename)) {
|
---|
24 | $gsdl_cgi->generate_error("Cannot open $filename: $!\n");
|
---|
25 | return;
|
---|
26 | }
|
---|
27 |
|
---|
28 | binmode(FILE);
|
---|
29 |
|
---|
30 | my $ctx = Digest::MD5->new;
|
---|
31 | $ctx->addfile(*FILE);
|
---|
32 | my $digest = $ctx->hexdigest;
|
---|
33 |
|
---|
34 | return $digest;
|
---|
35 | }
|
---|
36 |
|
---|
37 |
|
---|
38 | sub main
|
---|
39 | {
|
---|
40 | #my $gsdl_cgi = new gsdlCGI("+cmdline"); # doesn't work anymore
|
---|
41 | my $gsdl_cgi = new gsdlCGI();
|
---|
42 |
|
---|
43 | $gsdl_cgi->setup_gsdl();
|
---|
44 | my $gsdlhome = $ENV{'GSDLHOME'};
|
---|
45 |
|
---|
46 | $gsdl_cgi->checked_chdir($gsdlhome);
|
---|
47 |
|
---|
48 | # filename is now local to the current dir after checked_dir
|
---|
49 | my $filename = $gsdl_cgi->clean_param("filename");
|
---|
50 |
|
---|
51 | my $checksum = generate_checksum($filename,$gsdl_cgi);
|
---|
52 |
|
---|
53 |
|
---|
54 | print STDOUT "Content-type:text/plain\n\n";
|
---|
55 | print STDOUT "$checksum (MD5)\n";
|
---|
56 | }
|
---|
57 |
|
---|
58 | &main();
|
---|
59 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.