chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / ve / versionCheckHook / hook.sh
blob88a046b552eed4805bf05053fb2ab4bd69a70c2c
1 _handleCmdOutput(){
2 local versionOutput
3 versionOutput="$(env \
4 --chdir=/ \
5 --argv0="$(basename "$1")" \
6 --ignore-environment \
7 "$@" 2>&1 \
8 | sed -e 's|@storeDir@/[^/ ]*/|{{storeDir}}/|g' \
9 || true)"
10 if [[ "$versionOutput" =~ "$version" ]]; then
11 echoPrefix="Successfully managed to"
12 else
13 echoPrefix="Did not"
15 # The return value of this function is this variable:
16 echo "$echoPrefix"
17 # And in anycase we want these to be printed in the build log, useful for
18 # debugging, so we print these to stderr.
19 echo "$echoPrefix" find version "$version" in the output of the command \
20 "$@" >&2
21 echo "$versionOutput" >&2
23 versionCheckHook(){
24 runHook preVersionCheck
25 echo Executing versionCheckPhase
27 local cmdProgram cmdArg echoPrefix
28 if [[ -z "${versionCheckProgram-}" ]]; then
29 if [[ -z "${pname-}" ]]; then
30 echo "both \$pname and \$versionCheckProgram are empty, so" \
31 "we don't know which program to run the versionCheckPhase" \
32 "upon" >&2
33 exit 2
34 else
35 cmdProgram="${!outputBin}/bin/$pname"
37 else
38 cmdProgram="$versionCheckProgram"
40 if [[ ! -x "$cmdProgram" ]]; then
41 echo "versionCheckHook: $cmdProgram was not found, or is not an executable" >&2
42 exit 2
44 if [[ -z "${versionCheckProgramArg}" ]]; then
45 for cmdArg in "--help" "--version"; do
46 echoPrefix="$(_handleCmdOutput "$cmdProgram" "$cmdArg")"
47 if [[ "$echoPrefix" == "Successfully managed to" ]]; then
48 break
50 done
51 else
52 cmdArg="$versionCheckProgramArg"
53 echoPrefix="$(_handleCmdOutput "$cmdProgram" "$cmdArg")"
55 if [[ "$echoPrefix" == "Did not" ]]; then
56 exit 2
59 runHook postVersionCheck
60 echo Finished versionCheckPhase
63 if [[ -z "${dontVersionCheck-}" ]]; then
64 echo "Using versionCheckHook"
65 preInstallCheckHooks+=(versionCheckHook)