VMSify-conf.pl 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #! /usr/bin/perl
  2. use strict;
  3. use warnings;
  4. my @directory_vars = ( "dir", "certs", "crl_dir", "new_certs_dir" );
  5. my @file_vars = ( "database", "certificate", "serial", "crlnumber",
  6. "crl", "private_key", "RANDFILE" );
  7. while(<STDIN>) {
  8. chomp;
  9. foreach my $d (@directory_vars) {
  10. if (/^(\s*\#?\s*${d}\s*=\s*)\.\/([^\s\#]*)([\s\#].*)$/) {
  11. $_ = "$1sys\\\$disk:\[.$2$3";
  12. } elsif (/^(\s*\#?\s*${d}\s*=\s*)(\w[^\s\#]*)([\s\#].*)$/) {
  13. $_ = "$1sys\\\$disk:\[.$2$3";
  14. }
  15. s/^(\s*\#?\s*${d}\s*=\s*\$\w+)\/([^\s\#]*)([\s\#].*)$/$1.$2\]$3/;
  16. while(/^(\s*\#?\s*${d}\s*=\s*(\$\w+\.|sys\\\$disk:\[\.)[\w\.]+)\/([^\]]*)\](.*)$/) {
  17. $_ = "$1.$3]$4";
  18. }
  19. }
  20. foreach my $f (@file_vars) {
  21. s/^(\s*\#?\s*${f}\s*=\s*)\.\/(.*)$/$1sys\\\$disk:\[\/$2/;
  22. while(/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/(\w+\/[^\s\#]*)([\s\#].*)$/) {
  23. $_ = "$1.$3$4";
  24. }
  25. if (/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/(\w+)([\s\#].*)$/) {
  26. $_ = "$1]$3.$4";
  27. } elsif (/^(\s*\#?\s*${f}\s*=\s*(\$\w+|sys\\\$disk:\[)[^\/]*)\/([^\s\#]*)([\s\#].*)$/) {
  28. $_ = "$1]$3$4";
  29. }
  30. }
  31. print $_,"\n";
  32. }