Make shell scripts more portable by using /usr/bin/env bash

This commit is contained in:
Jonathan "Duke" Leto
2022-09-19 16:30:39 -07:00
parent 86a2c1c73c
commit 2a8dbbad7b
39 changed files with 44 additions and 44 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -53,7 +53,7 @@ script: |
function create_global_faketime_wrappers { function create_global_faketime_wrappers {
for prog in ${FAKETIME_PROGS}; do for prog in ${FAKETIME_PROGS}; do
echo '#!/bin/bash' > ${WRAP_DIR}/${prog} echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog} echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog} echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
@@ -65,7 +65,7 @@ script: |
function create_per-host_faketime_wrappers { function create_per-host_faketime_wrappers {
for i in $HOSTS; do for i in $HOSTS; do
for prog in ${FAKETIME_HOST_PROGS}; do for prog in ${FAKETIME_HOST_PROGS}; do
echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog} echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog} echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog} echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}

View File

@@ -20,7 +20,7 @@ script: |
# Create global faketime wrappers # Create global faketime wrappers
for prog in ${FAKETIME_PROGS}; do for prog in ${FAKETIME_PROGS}; do
echo '#!/bin/bash' > ${WRAP_DIR}/${prog} echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog} echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
echo "export FAKETIME=\"${REFERENCE_DATETIME}\"" >> ${WRAP_DIR}/${prog} echo "export FAKETIME=\"${REFERENCE_DATETIME}\"" >> ${WRAP_DIR}/${prog}

View File

@@ -48,7 +48,7 @@ script: |
function create_global_faketime_wrappers { function create_global_faketime_wrappers {
for prog in ${FAKETIME_PROGS}; do for prog in ${FAKETIME_PROGS}; do
echo '#!/bin/bash' > ${WRAP_DIR}/${prog} echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog} echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog} echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
@@ -60,7 +60,7 @@ script: |
function create_per-host_faketime_wrappers { function create_per-host_faketime_wrappers {
for i in $HOSTS; do for i in $HOSTS; do
for prog in ${FAKETIME_HOST_PROGS}; do for prog in ${FAKETIME_HOST_PROGS}; do
echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog} echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog} echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog} echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}

View File

@@ -47,7 +47,7 @@ script: |
function create_global_faketime_wrappers { function create_global_faketime_wrappers {
for prog in ${FAKETIME_PROGS}; do for prog in ${FAKETIME_PROGS}; do
echo '#!/bin/bash' > ${WRAP_DIR}/${prog} echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog}
echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog} echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog} echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
@@ -59,7 +59,7 @@ script: |
function create_per-host_faketime_wrappers { function create_per-host_faketime_wrappers {
for i in $HOSTS; do for i in $HOSTS; do
for prog in ${FAKETIME_HOST_PROGS}; do for prog in ${FAKETIME_HOST_PROGS}; do
echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog} echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog} echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog} echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
@@ -75,14 +75,14 @@ script: |
for i in $HOSTS; do for i in $HOSTS; do
mkdir -p ${WRAP_DIR}/${i} mkdir -p ${WRAP_DIR}/${i}
for prog in collect2; do for prog in collect2; do
echo '#!/bin/bash' > ${WRAP_DIR}/${i}/${prog} echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}/${prog}
REAL=$(${i}-gcc -print-prog-name=${prog}) REAL=$(${i}-gcc -print-prog-name=${prog})
echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog} echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog}
echo "${REAL} \$@" >> $WRAP_DIR/${i}/${prog} echo "${REAL} \$@" >> $WRAP_DIR/${i}/${prog}
chmod +x ${WRAP_DIR}/${i}/${prog} chmod +x ${WRAP_DIR}/${i}/${prog}
done done
for prog in gcc g++; do for prog in gcc g++; do
echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog} echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog} echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog} echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog} echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# hushd The hush core server. # hushd The hush core server.
# #

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# This code inspired by and dedicated to Decker # This code inspired by and dedicated to Decker
echo "Airdropping funds to HUSH3, hold onto your butts..." echo "Airdropping funds to HUSH3, hold onto your butts..."

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# This code inspired by and dedicated to Decker # This code inspired by and dedicated to Decker
echo "Airdropping funds to HUSH3, hold onto your butts..." echo "Airdropping funds to HUSH3, hold onto your butts..."

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2018-2020 The Hush developers # Copyright (c) 2018-2020 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
### This script attempts to download the signature file SHA256SUMS.asc from bitcoin.org ### This script attempts to download the signature file SHA256SUMS.asc from bitcoin.org
### It first checks if the signature passes, and then downloads the files specified in ### It first checks if the signature passes, and then downloads the files specified in

View File

@@ -1,4 +1,4 @@
#!/usr/bin/bash #!/usr/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# The BSD License (http://www.opensource.org/licenses/bsd-license.php) # The BSD License (http://www.opensource.org/licenses/bsd-license.php)
# specifies the terms and conditions of use for checksec.sh: # specifies the terms and conditions of use for checksec.sh:

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e -o pipefail set -e -o pipefail
CURDIR=$(cd $(dirname "$0"); pwd) CURDIR=$(cd $(dirname "$0"); pwd)

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Released under the GPLv3 # Released under the GPLv3

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Released under the GPLv3 # Released under the GPLv3

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# THIS FILE IS GENERATED FROM run-bitcoind-for-test.sh.in # THIS FILE IS GENERATED FROM run-bitcoind-for-test.sh.in
# Copyright (c) 2013-2014 The Bitcoin Core developers # Copyright (c) 2013-2014 The Bitcoin Core developers
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# THIS FILE IS GENERATED FROM tests-config.sh.in # THIS FILE IS GENERATED FROM tests-config.sh.in
# Copyright (c) 2013-2014 The Bitcoin Core developers # Copyright (c) 2013-2014 The Bitcoin Core developers
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
set -eo pipefail set -eo pipefail
hush_cli='./hush-cli' hush_cli='./hush-cli'

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Released under the GPLv3 # Released under the GPLv3

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2018-2020 The Hush developers # Copyright (c) 2018-2020 The Hush developers
#set working directory to the location of this script #set working directory to the location of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

View File

@@ -1,3 +1,3 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2018-2020 The Hush developers # Copyright (c) 2018-2020 The Hush developers
./hush-smart-chain -ac_name=KOOLAID $@ ./hush-smart-chain -ac_name=KOOLAID $@

View File

@@ -1,3 +1,3 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2018-2020 The Hush developers # Copyright (c) 2018-2020 The Hush developers
./hush-smart-chain -ac_name=KUSH $@ ./hush-smart-chain -ac_name=KUSH $@

View File

@@ -1,3 +1,3 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2018-2020 The Hush developers # Copyright (c) 2018-2020 The Hush developers
./hush-smart-chain -ac_name=ZEX $@ ./hush-smart-chain -ac_name=ZEX $@

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2018-2022 The Hush developers # Copyright (c) 2018-2022 The Hush developers
set -eo pipefail set -eo pipefail

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2018-2020 The Hush developers # Copyright (c) 2018-2020 The Hush developers
set -x set -x
delay=60 delay=60

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# set working directory to the location of this script # set working directory to the location of this script

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# set working directory to the location of this script # set working directory to the location of this script

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# any CLI args given to this script will be passed along # any CLI args given to this script will be passed along
# example: ./test_randomx -debug=randomx # example: ./test_randomx -debug=randomx

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2019-2020 radix42 # Copyright (c) 2019-2020 radix42
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Original aarch64 port by radix42. Thank you! # Original aarch64 port by radix42. Thank you!

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying # Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html # file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2019-2020 Hush developers # Copyright (c) 2019-2020 Hush developers
/hush/src/hush-cli $@ /hush/src/hush-cli $@

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers # Copyright (c) 2016-2022 The Hush developers
# Released under the GPLv3 # Released under the GPLv3