mirror of
https://github.com/rocky-linux/rocky-tools.git
synced 2024-11-25 06:31:24 +00:00
Merge pull request #32 from pajamian/main
Move some checks to the top of the script.
This commit is contained in:
commit
2d4a24b5fc
@ -32,6 +32,26 @@
|
||||
## Rocky is RC status. Using this script means you accept all risks of system
|
||||
## instability.
|
||||
|
||||
# These checks need to be right at the top because we start with bash-isms right
|
||||
# away in this script.
|
||||
if [ -n "$POSIXLY_CORRECT" ] || [ -z "$BASH_VERSION" ]; then
|
||||
printf '%s\n' "bash >= 4.0 is required for this script." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We need bash version >= 4 for associative arrays.
|
||||
if (( BASH_VERSINFO < 4 )); then
|
||||
printf '%s\n' "bash >= 4.0 is required for this script." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure we're root.
|
||||
if (( EUID != 0 )); then
|
||||
printf '%s\n' "You must run this script as root. Either use sudo or 'su -c ${0}'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Path to logfile
|
||||
logfile=/var/log/migrate2rocky.log
|
||||
|
||||
@ -114,22 +134,11 @@ pre_check () {
|
||||
# work unless it's severly broken. This is just a simple check that will cause
|
||||
# the script to bail if any expected system utilities are missing.
|
||||
bin_check() {
|
||||
# Make sure we're root.
|
||||
if (( EUID != 0 )); then
|
||||
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
|
||||
|
||||
local -a missing bins
|
||||
bins=(
|
||||
rpm dnf awk column tee tput mkdir
|
||||
|
Loading…
Reference in New Issue
Block a user