VMSify-conf.pl 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #! /usr/bin/env perl
  2. # Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. use strict;
  9. use warnings;
  10. my @directory_vars = ( "dir", "certs", "crl_dir", "new_certs_dir" );
  11. my @file_vars = ( "database", "certificate", "serial", "crlnumber",
  12. "crl", "private_key", "RANDFILE" );
  13. while(<STDIN>) {
  14. s|\R$||;
  15. foreach my $d (@directory_vars) {
  16. if (/^(\s*\#?\s*${d}\s*=\s*)\.\/([^\s\#]*)([\s\#].*)$/) {
  17. $_ = "$1sys\\\$disk:\[.$2$3";
  18. } elsif (/^(\s*\#?\s*${d}\s*=\s*)(\w[^\s\#]*)([\s\#].*)$/) {
  19. $_ = "$1sys\\\$disk:\[.$2$3";
  20. }
  21. s/^(\s*\#?\s*${d}\s*=\s*\$\w+)\/([^\s\#]*)([\s\#].*)$/$1.$2\]$3/;
  22. while(/^(\s*\#?\s*${d}\s*=\s*(\$\w+\.|sys\\\$disk:\[\.)[\w\.]+)\/([^\]]*)\](.*)$/) {
  23. $_ = "$1.$3]$4";
  24. }
  25. }
  26. foreach my $f (@file_vars) {
  27. s/^(\s*\#?\s*${f}\s*=\s*)\.\/(.*)$/$1sys\\\$disk:\[\/$2/;
  28. while(/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/(\w+\/[^\s\#]*)([\s\#].*)$/) {
  29. $_ = "$1.$3$4";
  30. }
  31. if (/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/(\w+)([\s\#].*)$/) {
  32. $_ = "$1]$3.$4";
  33. } elsif (/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/([^\s\#]*)([\s\#].*)$/) {
  34. $_ = "$1]$3$4";
  35. }
  36. }
  37. print $_,"\n";
  38. }