Skip to content

Commit

Permalink
portability enhancement: use "#!/usr/bin/env bash" on all shell scrip…
Browse files Browse the repository at this point in the history
…ts that use bash extensions, and use "#!/bin/sh" on the rest.
  • Loading branch information
douzzer committed Aug 19, 2024
1 parent e562a1c commit 1a26b16
Show file tree
Hide file tree
Showing 58 changed files with 62 additions and 61 deletions.
2 changes: 1 addition & 1 deletion Docker/buildAndPush.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Assume we're in wolfssl/Docker
WOLFSSL_DIR=$(builtin cd ${BASH_SOURCE%/*}/..; pwd)
Expand Down
2 changes: 1 addition & 1 deletion Docker/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

echo "Running with \"${*}\"..."

Expand Down
2 changes: 1 addition & 1 deletion Docker/yocto/buildAndPush.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Assume we're in wolfssl/Docker/yocto
WOLFSSL_DIR=$(builtin cd ${BASH_SOURCE%/*}/../..; pwd)
Expand Down
2 changes: 1 addition & 1 deletion IDE/ARDUINO/sketches/wolfssl_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ press the reset button or power cycle the Arduino before making a connection.
Here's one possible script to test the server from a command-line client:

```bash
#!/bin/bash
#!/usr/bin/env bash
echo "client log " > client_log.txt
counter=1
THIS_ERR=0
Expand Down
2 changes: 1 addition & 1 deletion IDE/Espressif/ESP-IDF/compileAllExamples.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# testing script: compileAllExamples
#
Expand Down
2 changes: 1 addition & 1 deletion IDE/Espressif/ESP-IDF/examples/wolfssl_test/testAll.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# testAll.sh [keyword suffix]
#
Expand Down
2 changes: 1 addition & 1 deletion IDE/Espressif/ESP-IDF/examples/wolfssl_test/testMonitor.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Syntax:
# ./testMonitor.sh <example_name> <target> <keyword>
Expand Down
2 changes: 1 addition & 1 deletion IDE/Espressif/ESP-IDF/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# check if IDF_PATH is set
if [ -z "$IDF_PATH" ]; then
Expand Down
2 changes: 1 addition & 1 deletion IDE/HEXAGON/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
if [ -z $1 ]; then
echo "./build <Debug | Release>"
exit 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

function usage(){
cat << _EOT_
Expand Down
2 changes: 1 addition & 1 deletion IDE/Renesas/e2studio/Projects/tools/rsa_pss_sign.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

SIGOPT=rsa_padding_mode:pss
SIGOPT2=rsa_pss_saltlen:-1
Expand Down
2 changes: 1 addition & 1 deletion IDE/apple-universal/build-wolfssl-framework.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# build-wolfssl-framework.sh
#
Expand Down
6 changes: 4 additions & 2 deletions IDE/mynewt/setup.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash -e
#!/usr/bin/env bash

# this scrypt deploy wolfssl and wolfcrypto source code to mynewt project
# this script deploys wolfssl and wolfcrypto source code to the mynewt project.
# run as bash "mynewt project root directory path"

set -e

SCRIPTDIR=`dirname $0`
SCRIPTDIR=`cd $SCRIPTDIR && pwd -P`
WOLFSSL_MYNEWTDIR=${SCRIPTDIR}
Expand Down
2 changes: 1 addition & 1 deletion RTOS/nuttx/wolfssl/setup-wolfssl.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

set -e # exit on any command failure
if [ ! -d wolfssl ]; then
Expand Down
2 changes: 1 addition & 1 deletion async-check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script creates symbolic links to the required asynchronous
# file for using the asynchronous simulator and make check
Expand Down
2 changes: 1 addition & 1 deletion certs/crl/gencrls.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# gencrls, crl config already done, see taoCerts.txt for setup
check_result(){
Expand Down
2 changes: 1 addition & 1 deletion certs/ecc/genecc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# run from wolfssl root

Expand Down
2 changes: 1 addition & 1 deletion certs/ed25519/gen-ed25519-certs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

check_result(){
if [ $1 -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion certs/ed25519/gen-ed25519.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

EXAMPLE=$1
echo "This uses ed25519 certificate generator from wolfssl-examples github"
Expand Down
2 changes: 1 addition & 1 deletion certs/ed448/gen-ed448-certs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

check_result(){
if [ $1 -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion certs/gen_revoked.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

###########################################################
########## update and sign server-revoked-key.pem ################
Expand Down
2 changes: 1 addition & 1 deletion certs/p521/gen-p521-certs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

check_result(){
if [ $1 -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion certs/renewcerts.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# renewcerts.sh
#
# renews the following certs:
Expand Down
2 changes: 1 addition & 1 deletion certs/rsapss/renew-rsapss-certs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

check_result(){
if [ $1 -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion certs/sm2/gen-sm2-certs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

check_result(){
if [ $1 -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion certs/statickeys/gen-static.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# run from wolfssl root

Expand Down
2 changes: 1 addition & 1 deletion certs/test-pathlen/assemble-chains.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# assemble-chains.sh
# Create certs and assemble all the certificate CA path test cert chains.
Expand Down
2 changes: 1 addition & 1 deletion certs/test-pathlen/refreshkeys.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

keyList=(
chainA-ICA1-key.pem chainA-entity-key.pem
Expand Down
2 changes: 1 addition & 1 deletion certs/test/gen-badsig.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

generate() {
# read in certificate and alter the last part of the signature
Expand Down
2 changes: 1 addition & 1 deletion commit-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#commit-tests.sh

Expand Down
2 changes: 1 addition & 1 deletion doc/generate_documentation.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# This script depends on g++, cmake, git, and make to be installed

POSIXLY_CORRECT=1
Expand Down
2 changes: 1 addition & 1 deletion fips-check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# fips-check.sh
# This script checks the current revision of the code against the
Expand Down
3 changes: 1 addition & 2 deletions fips-hash.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

if test ! -x ./wolfcrypt/test/testwolfcrypt
then
Expand All @@ -18,4 +18,3 @@ then
cp wolfcrypt/src/fips_test.c wolfcrypt/src/fips_test.c.bak
sed "s/^\".*\";/\"${NEWHASH}\";/" wolfcrypt/src/fips_test.c.bak >wolfcrypt/src/fips_test.c
fi

2 changes: 1 addition & 1 deletion pull_to_vagrant.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
SRC=vagrant
DST=wolfssl

Expand Down
2 changes: 1 addition & 1 deletion scripts/aria-cmake-build-test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# aria_cmake_build_test.sh
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/benchmark_compare.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# This script is designed to compare the output of wolfcrypt/benchmark test
# application. If the file has an extension ".csv", then it will parse the
# comma separated format, otherwise it will use the standard output format. The
Expand Down
2 changes: 1 addition & 1 deletion scripts/crl-revoked.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#crl.test
# if we can, isolate the network namespace to eliminate port collisions.
Expand Down
2 changes: 1 addition & 1 deletion scripts/dtls.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script can be run with several environment variables set dictating its
# run. You can set the following to what you like:
Expand Down
2 changes: 1 addition & 1 deletion scripts/dtlscid.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# dtlscid.test
# Copyright wolfSSL 2022-2024
Expand Down
2 changes: 1 addition & 1 deletion scripts/external.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# external.test

Expand Down
2 changes: 1 addition & 1 deletion scripts/google.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# google.test

Expand Down
2 changes: 1 addition & 1 deletion scripts/makedistsmall.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#set -v

# Script to produce a small source/header only package (with CMake support)
Expand Down
4 changes: 2 additions & 2 deletions scripts/memtest.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Run this script from the wolfSSL root as `./scripts/memtest.sh`.

Expand All @@ -14,7 +14,7 @@ make

for i in {1..1000}
do
echo "Trying $i...\n"
echo -e "Trying ${i}...\n"

./tests/unit.test > ./scripts/memtest.txt 2>&1

Expand Down
2 changes: 1 addition & 1 deletion scripts/ocsp-stapling-with-ca-as-responder.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# ocsp-stapling-with-ca-as-responder.test

Expand Down
2 changes: 1 addition & 1 deletion scripts/ocsp-stapling.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# ocsp-stapling.test
# Test requires HAVE_OCSP and HAVE_CERTIFICATE_STATUS_REQUEST
Expand Down
2 changes: 1 addition & 1 deletion scripts/ocsp-stapling2.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# ocsp-stapling2.test
# Test requires HAVE_OCSP and HAVE_CERTIFICATE_STATUS_REQUEST_V2
Expand Down
2 changes: 1 addition & 1 deletion scripts/openssl.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# openssl.test

Expand Down
2 changes: 1 addition & 1 deletion scripts/openssl_srtp.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Test WolfSSL/OpenSSL srtp interoperability
#
# TODO: add OpenSSL client with WolfSSL server
Expand Down
2 changes: 1 addition & 1 deletion scripts/pem.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# pem.test
# Copyright wolfSSL 2023-2023
Expand Down
2 changes: 1 addition & 1 deletion scripts/ping.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# ping.test

Expand Down
2 changes: 1 addition & 1 deletion scripts/pkcallbacks.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#pkcallbacks.test

Expand Down
2 changes: 1 addition & 1 deletion scripts/psk.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# psk.test
# copyright wolfSSL 2016
Expand Down
2 changes: 1 addition & 1 deletion scripts/resume.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#resume.test

Expand Down
2 changes: 1 addition & 1 deletion scripts/sniffer-gen.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#set -x

# Run this script from the wolfSSL root
Expand Down
2 changes: 1 addition & 1 deletion scripts/sniffer-testsuite.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#sniffer-testsuite.test

Expand Down
2 changes: 1 addition & 1 deletion scripts/stm32l4-v4_0_1_build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
WOLF_ROOT=$(eval "pwd")
echo "WOLF_ROOT set to: \"$WOLF_ROOT\""
cd ../ || exit 5
Expand Down
2 changes: 1 addition & 1 deletion scripts/tls13.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# tls13.test
# Copyright wolfSSL 2016-2021
Expand Down
2 changes: 1 addition & 1 deletion scripts/trusted_peer.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# trusted_peer.test
# copyright wolfSSL 2016
Expand Down

0 comments on commit 1a26b16

Please sign in to comment.