Use interpreter from $PATH instead of absolute paths in various scripts using /usr/bin/env (#9689)

On NixOS, `bash` isn't under `/bin/bash` but rather in some directory in `$PATH`. Locally, I've been patching those scripts to make them work.

`/usr/bin/env` seems to be the only [portable way](https://unix.stackexchange.com/questions/29608/why-is-it-better-to-use-usr-bin-env-name-instead-of-path-to-name-as-my) to use binaries from the PATH as interpreters.

Signed-off-by: Quentin Gliech <quentingliech@gmail.com>
This commit is contained in:
Quentin Gliech 2021-03-25 17:53:54 +01:00 committed by GitHub
parent e5801db830
commit d4c4798a25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 18 additions and 17 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# this script is run by buildkite in a plain `xenial` container; it installs the # this script is run by buildkite in a plain `xenial` container; it installs the
# minimal requirements for tox and hands over to the py35-old tox environment. # minimal requirements for tox and hands over to the py35-old tox environment.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# Test script for 'synapse_port_db', which creates a virtualenv, installs Synapse along # Test script for 'synapse_port_db', which creates a virtualenv, installs Synapse along
# with additional dependencies needed for the test (such as coverage or the PostgreSQL # with additional dependencies needed for the test (such as coverage or the PostgreSQL

1
changelog.d/9689.misc Normal file
View File

@ -0,0 +1 @@
Use interpreter from `$PATH` via `/usr/bin/env` instead of absolute paths in various scripts.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# this script will use the api: # this script will use the api:
# https://github.com/matrix-org/synapse/blob/master/docs/admin_api/purge_history_api.rst # https://github.com/matrix-org/synapse/blob/master/docs/admin_api/purge_history_api.rst

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
DOMAIN=yourserver.tld DOMAIN=yourserver.tld
# add this user as admin in your home server: # add this user as admin in your home server:

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
DIR="$( cd "$( dirname "$0" )" && pwd )" DIR="$( cd "$( dirname "$0" )" && pwd )"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
DIR="$( cd "$( dirname "$0" )" && pwd )" DIR="$( cd "$( dirname "$0" )" && pwd )"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# The script to build the Debian package, as ran inside the Docker image. # The script to build the Debian package, as ran inside the Docker image.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# This script runs the PostgreSQL tests inside a Docker container. It expects # This script runs the PostgreSQL tests inside a Docker container. It expects
# the relevant source files to be mounted into /src (done automatically by the # the relevant source files to be mounted into /src (done automatically by the

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# A script which checks that an appropriate news file has been added on this # A script which checks that an appropriate news file has been added on this
# branch. # branch.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Find linting errors in Synapse's default config file. # Find linting errors in Synapse's default config file.
# Exits with 0 if there are no problems, or another code otherwise. # Exits with 0 if there are no problems, or another code otherwise.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# Update/check the docs/sample_config.yaml # Update/check the docs/sample_config.yaml

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# Runs linting scripts over the local Synapse checkout # Runs linting scripts over the local Synapse checkout
# isort - sorts import statements # isort - sorts import statements

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# This script generates SQL files for creating a brand new Synapse DB with the latest # This script generates SQL files for creating a brand new Synapse DB with the latest
# schema, on both SQLite3 and Postgres. # schema, on both SQLite3 and Postgres.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# This script builds the Docker image to run the PostgreSQL tests, and then runs # This script builds the Docker image to run the PostgreSQL tests, and then runs
# the tests. # the tests.