Test for bash at the top.
Put a test for bash at the top to make sure that people don't try to run in POSIX sh mode.
This commit is contained in:
parent
20c7162a9f
commit
5051fc5312
|
@ -32,6 +32,16 @@
|
|||
## Rocky is RC status. Using this script means you accept all risks of system
|
||||
## instability.
|
||||
|
||||
# This check needs to be right at the top because we start with bash-isms right
|
||||
# away in this script.
|
||||
# We need bash version >= 4 for associative arrays. This will also verify
|
||||
# that we're actually running bash.
|
||||
if [ -n "$POSIXLY_CORRECT" ] || [ -z "$BASH_VERSION" ]; then
|
||||
printf '%s\n' "bash >= 4.0 is required for this script." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Path to logfile
|
||||
logfile=/var/log/migrate2rocky.log
|
||||
|
||||
|
@ -119,17 +129,17 @@ bin_check() {
|
|||
exit_message "You must run this script as root. Either use sudo or 'su -c ${0}'"
|
||||
fi
|
||||
|
||||
# Check the platform.
|
||||
if [[ $(os-release PLATFORM_ID) != "$SUPPORTED_PLATFORM" ]]; then
|
||||
exit_message "This script must be run on an EL8 distribution. Migration from other distributions is not supported."
|
||||
fi
|
||||
|
||||
# We need bash version >= 4 for associative arrays. This will also verify
|
||||
# that we're actually running bash.
|
||||
if (( BASH_VERSINFO < 4 )); then
|
||||
exit_message "bash >= 4.0 is required for this script."
|
||||
fi
|
||||
|
||||
# Check the platform.
|
||||
if [[ $(os-release PLATFORM_ID) != "$SUPPORTED_PLATFORM" ]]; then
|
||||
exit_message "This script must be run on an EL8 distribution. Migration from other distributions is not supported."
|
||||
fi
|
||||
|
||||
local -a missing bins
|
||||
bins=(
|
||||
rpm dnf awk column tee tput mkdir
|
||||
|
|
Loading…
Reference in New Issue