Changeset 255

Show
Ignore:
Timestamp:
02/18/08 19:01:22 (9 months ago)
Author:
mbr
Message:

fixed exit status for --test-mode, better handling of GnuPG homedir

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gpgdir/trunk/gpgdir

    r246 r255  
    203203} 
    204204 
     205my $initial_dir = cwd or die "[*] Could not get CWD: $!"; 
     206 
     207if ($gpg_homedir) { 
     208    ### it was specified on the comamnd line 
     209    if ($gpg_homedir !~ m|^/|) { 
     210        $gpg_homedir = $initial_dir . '/' . $gpg_homedir; 
     211    } 
     212} 
     213 
    205214### build up GnuPG options hash 
    206215if ($verbose) { 
     
    219228 
    220229unless ($symmetric_mode) { 
    221     if ($gpg_homedir) {  ### specified on the command line with --gnupg-dir 
    222         unless ($gpg_homedir =~ /\.gnupg$/) { 
    223             die "[*] Must specify the path to a user .gnupg directory ", 
    224                 "e.g. /home/username/.gnupg\n"; 
    225         } 
    226     } else { 
    227         if (-d "${homedir}/.gnupg") { 
    228             $gpg_homedir = "${homedir}/.gnupg"; 
    229         } 
     230    unless ($gpg_homedir) { 
     231        $gpg_homedir = "${homedir}/.gnupg" 
     232            if -d "${homedir}/.gnupg"; 
    230233    } 
    231234    unless (-d $gpg_homedir) { 
    232         die "[*] GnuPG directory: ${homedir}/.gnupg does not exist. Please\n", 
     235        die "[*] GnuPG directory: $gpg_homedir does not exist. Please\n", 
    233236            "    create it by executing: \"gpg --gen-key\".  Exiting.\n"; 
    234237    } 
     
    292295### in --Trial-run mode. 
    293296$skip_test_mode = 1 if $trial_run; 
    294  
    295 my $initial_dir = cwd or die "[*] Could not get CWD: $!"; 
    296297 
    297298if ($symmetric_mode) { 
     
    11301131    chdir $initial_dir or die "[*] Could not chdir($initial_dir)"; 
    11311132 
    1132     return 1; 
     1133    return 0;  ### exit status 
    11331134} 
    11341135