Index: client/1.0/neutral/pkgr.eagle ================================================================== --- client/1.0/neutral/pkgr.eagle +++ client/1.0/neutral/pkgr.eagle @@ -417,22 +417,22 @@ # it already appeared to be available for use. # # proc probeForOpenPgpInstallation {} { global env - variable openPgpFileNameOnly - variable openPgpInstalledDirectory + variable openPgpFileNamesOnly + variable openPgpInstalledDirectories if {[catch {openPgpMustBeInstalled}] == 0} then { return true } - if {![info exists openPgpFileNameOnly]} then { + if {![info exists openPgpFileNamesOnly]} then { return false } - if {![info exists openPgpInstalledDirectory]} then { + if {![info exists openPgpInstalledDirectories]} then { return false } if {[isWindows]} then { if {[info exists env(ProgramFiles(x86))]} then { @@ -440,24 +440,33 @@ } elseif {[info exists env(ProgramFiles)]} then { set programFiles $env(ProgramFiles) } else { return false } - - set directory [file join $programFiles $openPgpInstalledDirectory] - } else { - set directory $openPgpInstalledDirectory } - if {![file isdirectory $directory]} then { - return false - } - - set fileName [file join $directory $openPgpFileNameOnly] - - if {[file exists $fileName] && [file isfile $fileName]} then { - return [addToPath $directory] + foreach directory $openPgpInstalledDirectories { + if {[isWindows]} then { + set subDirectory [file join $programFiles $directory] + } else { + set subDirectory $directory + } + + if {[file isdirectory $subDirectory]} then { + foreach fileNameOnly $openPgpFileNamesOnly { + set fileName [file join $subDirectory $fileNameOnly] + + if {[file exists $fileName] && [file isfile $fileName]} then { + pkgLog [appendArgs \ + "the OpenPGP directory is being initialized to \"" \ + $subDirectory "\" based on OpenPGP file name \"" \ + $fileNameOnly \"] + + return [addToPath $subDirectory] + } + } + } } return false } @@ -485,11 +494,11 @@ the package management subsystem included with your operating system. } set found false - foreach fileName $openPgpFileNamesOnly { + foreach fileNameOnly $openPgpFileNamesOnly { if {[isEagle]} then { if {[catch { eval exec -success Success [subst $openPgpInstalledCommand] } result] == 0} then { set found true; break @@ -511,23 +520,27 @@ 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 { + if {$fileNameOnly ne $openPgpFileNameOnly} then { pkgLog [appendArgs \ "the OpenPGP file name is being changed from \"" \ - $openPgpFileNameOnly "\" to \"" $fileName \"] + $openPgpFileNameOnly "\" to \"" $fileNameOnly \"] - set openPgpFileNameOnly $fileName + set openPgpFileNameOnly $fileNameOnly } } else { # # NOTE: Configure the OpenPGP file name to the one that was just # found. # - set openPgpFileNameOnly $fileName + pkgLog [appendArgs \ + "the OpenPGP file name is being initialized to \"" \ + $fileNameOnly \"] + + set openPgpFileNameOnly $fileNameOnly } } else { # # NOTE: If no viable OpenPGP file name was found, raise the error # message. @@ -2298,17 +2311,19 @@ # # NOTE: This is the name of the sub-directory containing the OpenPGP # implementation. It is platform-specific. On Windows, this # sub-directory is relative to the "Program Files" directory. # - variable openPgpInstalledDirectory; # DEFAULT: [file join GNU GnuPG] + variable openPgpInstalledDirectories; # DEFAULT: [list ...] - if {![info exists openPgpInstalledDirectory]} then { + if {$force || ![info exists openPgpInstalledDirectories]} then { if {[isWindows]} then { - set openPgpInstalledDirectory [file join GNU GnuPG] + set openPgpInstalledDirectories [list \ + [file join gnupg bin] [file join GNU GnuPG]] } else { - set openPgpInstalledDirectory [file join / usr bin] + set openPgpInstalledDirectories [list \ + [file join / usr bin]] } } # # NOTE: These are the candidate names of the executable file used to @@ -2315,11 +2330,11 @@ # invoke the OpenPGP implementation, possibly without a file # extension. # variable openPgpFileNamesOnly; # DEFAULT: [list gpg2 gpg] - if {![info exists openPgpFileNamesOnly]} then { + if {$force || ![info exists openPgpFileNamesOnly]} then { if {[isWindows]} then { set openPgpFileNamesOnly [list gpg2.exe gpg.exe] } else { set openPgpFileNamesOnly [list gpg2 gpg] } @@ -2336,11 +2351,11 @@ # file. This must be configured according to the implementation # of OpenPGP in use. # variable openPgpImportCommand; # DEFAULT: gpg2 --import - if {![info exists openPgpImportCommand]} then { + if {$force || ![info exists openPgpImportCommand]} then { set openPgpImportCommand \ {{${openPgpFileNameOnly}} --import {${fileName}}} } # @@ -2348,11 +2363,11 @@ # that OpenPGP successfully imported one or more keys. This must # be configured according to the implementation of OpenPGP in use. # variable openPgpImportPattern; # DEFAULT: ^gpg: Total number processed... - if {![info exists openPgpImportPattern]} then { + if {$force || ![info exists openPgpImportPattern]} then { set openPgpImportPattern {^gpg: Total number processed: [1-9]\d*$} } # # NOTE: The command to use when attempting to verify that OpenPGP is @@ -2359,22 +2374,22 @@ # installed locally. This must be configured according to the # implementation of OpenPGP in use. # variable openPgpInstalledCommand; # DEFAULT: gpg2 --version --homedir {} - if {![info exists openPgpInstalledCommand]} then { - set openPgpInstalledCommand {{${fileName}} --version --homedir {}} + if {$force || ![info exists openPgpInstalledCommand]} then { + set openPgpInstalledCommand {{${fileNameOnly}} --version --homedir {}} } # # NOTE: The regular expression pattern used when attempting to verify # that OpenPGP is installed locally. This must be configured # according to the implementation of OpenPGP in use. # variable openPgpInstalledPattern; # DEFAULT: ^gpg \(GnuPG\) 2\.[0123]\. - if {![info exists openPgpInstalledPattern]} then { + if {$force || ![info exists openPgpInstalledPattern]} then { set openPgpInstalledPattern {^gpg \(GnuPG\) 2\.[0123]\.} } # # NOTE: The command to use when verifying OpenPGP signatures for the @@ -2381,11 +2396,11 @@ # downloaded package scripts. This must be configured according # to the implementation of OpenPGP in use. # variable openPgpVerifyCommand; # DEFAULT: gpg2 --verify {${fileName}} - if {![info exists openPgpVerifyCommand]} then { + if {$force || ![info exists openPgpVerifyCommand]} then { set openPgpVerifyCommand \ {{${openPgpFileNameOnly}} --verify {${fileName}}} } # @@ -2393,11 +2408,11 @@ # downloaded package scripts. This must be configured according # to the implementation of OpenPGP in use. # variable openPgpSignCommand; # DEFAULT: gpg2 --detach-sign ... - if {![info exists openPgpSignCommand]} then { + if {$force || ![info exists openPgpSignCommand]} then { set openPgpSignCommand "" append openPgpSignCommand \ {{${openPgpFileNameOnly}} --detach-sign --armor}