Debian Codegraph @

debian/tests/alternative-bin-sh

raw
1 #!/bin/sh
2
3 set -eu
4
5 CURRENT_SHELL=$(readlink -f /bin/sh)
6 # shellcheck disable=SC2064 # Evaluate $CURRENT_SHELL now, not at runtime.
7 trap "ln -s '$CURRENT_SHELL' /bin/sh.orig; mv /bin/sh.orig /bin/sh" EXIT INT TERM
8
9 # Test with dash.
10 echo "Pointing /bin/sh to /bin/dash"
11 ln -s dash /bin/sh.new
12 mv /bin/sh.new /bin/sh
13 /bin/sh -c 'test "${BASH_VERSION:-x}" = "x"'
14 echo "OK"
15
16 echo "Running the test suite with dash..."
17 make check
18
19 # Test with bash.
20 echo "Pointing /bin/sh to /bin/bash"
21 ln -s bash /bin/sh.new
22 mv /bin/sh.new /bin/sh
23 /bin/sh -c 'test "${BASH_VERSION:-x}" != "x"'
24 echo "OK"
25
26 echo "Running the test suite with bash..."
27 make check
28
29 # Test with busybox.
30 echo "Pointing /bin/sh to /bin/busybox"
31 ln -s busybox /bin/sh.new
32 mv /bin/sh.new /bin/sh
33 /bin/sh -c 'test "${BASH_VERSION:-x}" = "x"'
34 echo "OK"
35
36 echo "Running the test suite with busybox sh..."
37 make check
38
39 # Test with (legacy) mksh
40 echo "Pointing /bin/sh to /bin/lksh"
41 ln -s lksh /bin/sh.new
42 mv /bin/sh.new /bin/sh
43 /bin/sh -c 'test "${KSH_VERSION:-x}" != "x"'
44 echo "OK"
45
46 echo "Running the test suite with lksh..."
47 make check