Index: client/1.0/neutral/pkgr.eagle ================================================================== --- client/1.0/neutral/pkgr.eagle +++ client/1.0/neutral/pkgr.eagle @@ -400,10 +400,14 @@ variable openPgpInstalledDirectory if {[catch {openPgpMustBeInstalled}] == 0} then { return true } + + if {![info exists openPgpInstalledDirectory]} then { + return false + } if {[isWindows]} then { if {[info exists env(ProgramFiles(x86))]} then { set programFiles $env(ProgramFiles\(x86\)) } elseif {[info exists env(ProgramFiles)]} then { @@ -418,10 +422,14 @@ } if {![file isdirectory $directory]} then { return false } + + if {![info exists openPgpFileNameOnly]} then { + return false + } set fileName [file join $directory $openPgpFileNameOnly] if {[file exists $fileName] && [file isfile $fileName]} then { return [addToPath $directory] @@ -437,10 +445,11 @@ # undefined. # # proc openPgpMustBeInstalled {} { variable openPgpFileNameOnly + variable openPgpFileNamesOnly variable openPgpInstalledCommand variable openPgpInstalledPattern set message { Cannot use OpenPGP: it does not appear to be installed. @@ -451,22 +460,58 @@ Alternatively, it may be possible to install GNU Privacy Guard (GPG) via the package management subsystem included with your operating system. } - if {[isEagle]} then { - if {[catch { - eval exec -success Success [subst $openPgpInstalledCommand] - } result]} then { - error $message + set found false + + foreach fileName $openPgpFileNamesOnly { + if {[isEagle]} then { + if {[catch { + eval exec -success Success [subst $openPgpInstalledCommand] + } result] == 0} then { + set found true; break + } + } else { + if {[catch { + eval exec [subst $openPgpInstalledCommand] + } result] == 0} then { + set found true; break + } + } + } + + if {$found} then { + # + # NOTE: Was this procedure already run -AND- did it actually find a + # viable OpenPGP file name? + # + if {[info exists openPgpFileNameOnly]} then { + # + # NOTE: If the OpenPGP file name that we found before (?) does not + # match what we already have, issue a log message. + # + if {$fileName ne $openPgpFileNameOnly} then { + pkgLog [appendArgs \ + "the OpenPGP file name is being changed from \"" \ + $openPgpFileNameOnly "\" to \"" $fileName \"] + + set openPgpFileNameOnly $fileName + } + } else { + # + # NOTE: Configure the OpenPGP file name to the one that was just + # found. + # + set openPgpFileNameOnly $fileName } } else { - if {[catch { - eval exec [subst $openPgpInstalledCommand] - } result]} then { - error $message - } + # + # NOTE: If no viable OpenPGP file name was found, raise the error + # message. + # + error $message } if {![info exists result] || \ ![regexp -- $openPgpInstalledPattern $result]} then { error "cannot use OpenPGP: unknown or unsupported version" @@ -2092,23 +2137,30 @@ } else { set openPgpInstalledDirectory [file join / usr bin] } } + # + # NOTE: These are the candidate names of the executable file used to + # invoke the OpenPGP implementation, possibly without a file + # extension. + # + variable openPgpFileNamesOnly; # DEFAULT: [list gpg2 gpg] + + if {![info exists openPgpFileNamesOnly]} then { + if {[isWindows]} then { + set openPgpFileNamesOnly [list gpg2.exe gpg.exe] + } else { + set openPgpFileNamesOnly [list gpg2 gpg] + } + } + # # NOTE: This is the name of the executable file used to invoke the # OpenPGP implementation, possibly without a file extension. # - variable openPgpFileNameOnly; # DEFAULT: gpg2[.exe] - - if {![info exists openPgpFileNameOnly]} then { - if {[isWindows]} then { - set openPgpFileNameOnly gpg2.exe - } else { - set openPgpFileNameOnly gpg2 - } - } + variable openPgpFileNameOnly; # DEFAULT: # # NOTE: The command to use when attempting to import an OpenPGP key # file. This must be configured according to the implementation # of OpenPGP in use. @@ -2137,12 +2189,11 @@ # implementation of OpenPGP in use. # variable openPgpInstalledCommand; # DEFAULT: gpg2 --version if {![info exists openPgpInstalledCommand]} then { - set openPgpInstalledCommand \ - {{${openPgpFileNameOnly}} --version} + set openPgpInstalledCommand {{${fileName}} --version} } # # NOTE: The regular expression pattern used when attempting to verify # that OpenPGP is installed locally. This must be configured