Overview
Comment: | Modify the 'openPgpMustBeInstalled' procedure so that it can support checking for both the 'gpg2' and 'gpg' executables, in that order. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | openPgpVars |
Files: | files | file ages | folders |
SHA1: |
12a6ce4b8c9015f52d0b8a851235879b |
User & Date: | mistachkin on 2017-08-10 02:42:04 |
Other Links: | branch diff | manifest | tags |
Context
2017-08-10
| ||
02:55 | Consistently check for the 'openPgpFileNameOnly' variable before trying to use it. Closed-Leaf check-in: 195273da17 user: mistachkin tags: openPgpVars | |
02:42 | Modify the 'openPgpMustBeInstalled' procedure so that it can support checking for both the 'gpg2' and 'gpg' executables, in that order. check-in: 12a6ce4b8c user: mistachkin tags: openPgpVars | |
01:23 | Improvements to the OpenPGP (e.g. GPG) integration. check-in: 5d7c84b5b4 user: mistachkin tags: openPgpVars | |
Changes
Modified client/1.0/neutral/pkgr.eagle from [0cb6d3475a] to [9f02f489ad].
︙ | ︙ | |||
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | global env variable openPgpFileNameOnly variable openPgpInstalledDirectory if {[catch {openPgpMustBeInstalled}] == 0} then { return true } if {[isWindows]} then { if {[info exists env(ProgramFiles(x86))]} then { set programFiles $env(ProgramFiles\(x86\)) } 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] } return false } # # NOTE: This procedure attempts to verify that a configured implementation # of OpenPGP is installed locally. There are no arguments. Script # errors are raised if any problems are found. The return value is # undefined. # # <public> proc openPgpMustBeInstalled {} { variable openPgpFileNameOnly variable openPgpInstalledCommand variable openPgpInstalledPattern set message { Cannot use OpenPGP: it does not appear to be installed. GNU Privacy Guard (GPG) may be downloaded from "https://www.gnupg.org/" and then installed. Signed binaries for Windows may be available from "https://www.gpg4win.org/". Alternatively, it may be possible to install GNU Privacy Guard (GPG) via the package management subsystem included with your operating system. } | > > > > > > > > > > > > | | | | < > | | | | | > > > > | > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | global env variable openPgpFileNameOnly 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 { set programFiles $env(ProgramFiles) } else { return false } set directory [file join $programFiles $openPgpInstalledDirectory] } else { set directory $openPgpInstalledDirectory } 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] } return false } # # NOTE: This procedure attempts to verify that a configured implementation # of OpenPGP is installed locally. There are no arguments. Script # errors are raised if any problems are found. The return value is # undefined. # # <public> proc openPgpMustBeInstalled {} { variable openPgpFileNameOnly variable openPgpFileNamesOnly variable openPgpInstalledCommand variable openPgpInstalledPattern set message { Cannot use OpenPGP: it does not appear to be installed. GNU Privacy Guard (GPG) may be downloaded from "https://www.gnupg.org/" and then installed. Signed binaries for Windows may be available from "https://www.gpg4win.org/". Alternatively, it may be possible to install GNU Privacy Guard (GPG) via the package management subsystem included with your operating system. } 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 { # # 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" } |
︙ | ︙ | |||
2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 | if {[isWindows]} then { set openPgpInstalledDirectory [file join GNU GnuPG] } else { set openPgpInstalledDirectory [file join / usr bin] } } # # NOTE: This is the name of the executable file used to invoke the # OpenPGP implementation, possibly without a file extension. # | > > > > > > > > > > > > > > > | < < < < < < < < | 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 | if {[isWindows]} then { set openPgpInstalledDirectory [file join GNU GnuPG] } 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: <unset> # # 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. # variable openPgpImportCommand; # DEFAULT: gpg2 --import |
︙ | ︙ | |||
2135 2136 2137 2138 2139 2140 2141 | # NOTE: The command to use when attempting to verify that OpenPGP is # installed locally. This must be configured according to the # implementation of OpenPGP in use. # variable openPgpInstalledCommand; # DEFAULT: gpg2 --version if {![info exists openPgpInstalledCommand]} then { | | < | 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 | # NOTE: The command to use when attempting to verify that OpenPGP is # installed locally. This must be configured according to the # implementation of OpenPGP in use. # variable openPgpInstalledCommand; # DEFAULT: gpg2 --version if {![info exists openPgpInstalledCommand]} then { set openPgpInstalledCommand {{${fileName}} --version} } # # 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. # |
︙ | ︙ |