Gary Wu | ab1a4c9 | 2017-08-25 06:46:17 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # This particular environment was created specifically for MultiCloud |
| 3 | |
| 4 | # vim: ts=4 sw=4 sts=4 et tw=72 : |
| 5 | |
| 6 | # force any errors to cause the script and job to end in failure |
| 7 | set -xeu -o pipefail |
| 8 | |
| 9 | rh_systems() { |
| 10 | # memcached |
| 11 | yum install -y memcached |
| 12 | systemctl enable memcached |
| 13 | } |
| 14 | |
| 15 | ubuntu_systems() { |
| 16 | # memcached |
| 17 | apt-get install memcached |
| 18 | } |
| 19 | |
| 20 | all_systems() { |
| 21 | echo 'No common distribution configuration to perform' |
| 22 | } |
| 23 | |
| 24 | echo "---> Detecting OS" |
| 25 | ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') |
| 26 | |
| 27 | case "${ORIGIN}" in |
| 28 | fedora|centos|redhat) |
| 29 | echo "---> RH type system detected" |
| 30 | rh_systems |
| 31 | ;; |
| 32 | ubuntu) |
| 33 | echo "---> Ubuntu system detected" |
| 34 | ubuntu_systems |
| 35 | ;; |
| 36 | *) |
| 37 | echo "---> Unknown operating system" |
| 38 | ;; |
| 39 | esac |
| 40 | |
| 41 | # execute steps for all systems |
| 42 | all_systems |