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