From 4e5798852f583a68d123a9c49ae0ef59ec9ffc76 Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Thu, 8 Jun 2023 12:38:26 -0700 Subject: [PATCH] make shebangs posix compliant (#2974) Previously, these scripts wouldn't work on exotic systems such as NixOS. ``` fd '\.sh$' -t f --exec sed -i 's@#!/bin/bash@#!/usr/bin/env bash@' ``` --- api_tests/prepare-drone-federation-test.sh | 2 +- api_tests/run-federation-test.sh | 2 +- docker/docker_db_backup.sh | 2 +- docker/test_deploy.sh | 2 +- scripts/clear_db.sh | 2 +- scripts/compilation_benchmark.sh | 2 +- scripts/db-init.sh | 2 +- scripts/fix-clippy.sh | 2 +- scripts/install.sh | 2 +- scripts/query_testing/apache_bench_report.sh | 2 +- scripts/query_testing/api_benchmark.sh | 2 +- scripts/query_testing/views_old/generate_reports.sh | 2 +- .../query_testing/views_to_diesel_migration/generate_reports.sh | 2 +- scripts/restore_db.sh | 2 +- scripts/test.sh | 2 +- scripts/update_config_defaults.sh | 2 +- scripts/update_translations.sh | 2 +- scripts/upgrade_deps.sh | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/api_tests/prepare-drone-federation-test.sh b/api_tests/prepare-drone-federation-test.sh index afe18e1d2..813b3b15c 100755 --- a/api_tests/prepare-drone-federation-test.sh +++ b/api_tests/prepare-drone-federation-test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e export RUST_BACKTRACE=1 diff --git a/api_tests/run-federation-test.sh b/api_tests/run-federation-test.sh index ebde0c04d..ed4bba416 100755 --- a/api_tests/run-federation-test.sh +++ b/api_tests/run-federation-test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432 diff --git a/docker/docker_db_backup.sh b/docker/docker_db_backup.sh index 0bfa68029..8ec3e70c7 100755 --- a/docker/docker_db_backup.sh +++ b/docker/docker_db_backup.sh @@ -1,2 +1,2 @@ -#!/bin/bash +#!/usr/bin/env bash docker-compose exec postgres pg_dumpall -c -U lemmy > dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql diff --git a/docker/test_deploy.sh b/docker/test_deploy.sh index fe91ea317..ff4eb5b9f 100755 --- a/docker/test_deploy.sh +++ b/docker/test_deploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e export COMPOSE_DOCKER_CLI_BUILD=1 diff --git a/scripts/clear_db.sh b/scripts/clear_db.sh index b62490e12..dc53ee7eb 100755 --- a/scripts/clear_db.sh +++ b/scripts/clear_db.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash psql -U lemmy -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public; DROP SCHEMA utils CASCADE;" diff --git a/scripts/compilation_benchmark.sh b/scripts/compilation_benchmark.sh index af355734b..93d1b6a23 100755 --- a/scripts/compilation_benchmark.sh +++ b/scripts/compilation_benchmark.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e times=3 diff --git a/scripts/db-init.sh b/scripts/db-init.sh index 04ce7b901..e7c97392c 100755 --- a/scripts/db-init.sh +++ b/scripts/db-init.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Default configurations diff --git a/scripts/fix-clippy.sh b/scripts/fix-clippy.sh index d85913783..25b4b22ca 100755 --- a/scripts/fix-clippy.sh +++ b/scripts/fix-clippy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" diff --git a/scripts/install.sh b/scripts/install.sh index 2a8390816..874776b15 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Set the database variable to the default first. diff --git a/scripts/query_testing/apache_bench_report.sh b/scripts/query_testing/apache_bench_report.sh index d062a5111..ae804a531 100755 --- a/scripts/query_testing/apache_bench_report.sh +++ b/scripts/query_testing/apache_bench_report.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e declare -a arr=( diff --git a/scripts/query_testing/api_benchmark.sh b/scripts/query_testing/api_benchmark.sh index 9f06580a7..4c1ee9e1f 100755 --- a/scripts/query_testing/api_benchmark.sh +++ b/scripts/query_testing/api_benchmark.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # By default, this script runs against `http://127.0.0.1:8536`, but you can pass a different Lemmy instance, diff --git a/scripts/query_testing/views_old/generate_reports.sh b/scripts/query_testing/views_old/generate_reports.sh index 8d2b4a052..f52653f2d 100755 --- a/scripts/query_testing/views_old/generate_reports.sh +++ b/scripts/query_testing/views_old/generate_reports.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # You can import these to http://tatiyants.com/pev/#/plans/new diff --git a/scripts/query_testing/views_to_diesel_migration/generate_reports.sh b/scripts/query_testing/views_to_diesel_migration/generate_reports.sh index 12993a080..aa443c1b1 100755 --- a/scripts/query_testing/views_to_diesel_migration/generate_reports.sh +++ b/scripts/query_testing/views_to_diesel_migration/generate_reports.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # You can import these to http://tatiyants.com/pev/#/plans/new diff --git a/scripts/restore_db.sh b/scripts/restore_db.sh index a886fc08d..f77624fbb 100755 --- a/scripts/restore_db.sh +++ b/scripts/restore_db.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash psql -U lemmy -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" cat docker/lemmy_dump_2021-01-29_16_13_40.sqldump | psql -U lemmy diff --git a/scripts/test.sh b/scripts/test.sh index e3239c7d3..f117238bd 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e PACKAGE="$1" diff --git a/scripts/update_config_defaults.sh b/scripts/update_config_defaults.sh index 07aceb3ef..024b8ca11 100755 --- a/scripts/update_config_defaults.sh +++ b/scripts/update_config_defaults.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e dest=${1-config/defaults.hjson} diff --git a/scripts/update_translations.sh b/scripts/update_translations.sh index 71c62e99a..1114f8048 100755 --- a/scripts/update_translations.sh +++ b/scripts/update_translations.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e pushd ../../lemmy-translations diff --git a/scripts/upgrade_deps.sh b/scripts/upgrade_deps.sh index 90adb896f..0c4ae6f0f 100755 --- a/scripts/upgrade_deps.sh +++ b/scripts/upgrade_deps.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash pushd ../