Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require bash for rgbenv #18

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion rgbenv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

# SPDX-License-Identifier: MIT
#
Expand All @@ -22,6 +22,29 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

if ! (command -v bash 2>&1 > /dev/null); then
echo "Sorry, rgbenv requires bash."
exit 1
fi

if [ "${SHELL}" != "$(command -v bash)" ]; then
# Prevent boundless recursion
if [ -z "${REEXEC_COUNT}" ]; then
RGBENV_REEXEC_COUNT=0
else
RGBENV_REEXEC_COUNT=$(expr ${RGBENV_REEXEC_COUNT} + 1)
fi
export RGBENV_REEXEC_COUNT

if [ "${RGBENV_REEXEC_COUNT}" -gt 1 ]; then
exit
fi

exec /usr/bin/env bash "${0}" "${@}"
fi

set -euo pipefail

# --------------- Constant defines -------------------------------------------------

RGBDS_GIT="https://github.com/gbdev/rgbds"
Expand Down
Loading