Created
August 16, 2017 00:48
-
-
Save sKwa/6d67c99ef597dfd80147dcbee1f05a2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# | |
# TODO: hostname | |
info() { | |
echo -e $( date "+[ %T.%3N ] ") "\033[01;32m[INF]\033[00m ${@}" | |
} | |
error() { | |
echo -e $( date "+[ %T.%3N ] ") "\033[01;31m[ERR]\033[00m ${@} -> \033[01;31mEXIT!\033[00m" | |
exit 1 | |
} | |
info '############## START ############' | |
info 'make sure a script is run as root' | |
if [[ "${UID}" -ne 0 ]]; then | |
error "${0} must be run as root" | |
fi | |
info 'validate architecture' | |
if [[ $( uname -i ) != 'x86_64' ]]; then | |
error 'x86_64 architecture require' | |
fi | |
info 'update system' | |
yum -y update >&/dev/null | |
if [[ "${?}" -ne 0 ]]; then | |
error "can't update, check your network" | |
fi | |
info 'install Verica basic dependencies' | |
yum -y install bash sudo bc openssh ntp netstat yum-utils >&/dev/null | |
info 'check shell, all shell scripts must run under the BASH shell' | |
if [[ "${SHELL}" != '/bin/bash' ]]; then | |
error 'all shell scripts must run under the BASH shell' | |
fi | |
info '############## DONE! ############' | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment