Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | # vim: ts=4 sw=4 sts=4 et tw=72 : |
| 4 | |
| 5 | # force any errors to cause the script and job to end in failure |
| 6 | set -xeu -o pipefail |
| 7 | |
| 8 | rh_systems() { |
| 9 | echo 'No changes to apply' |
| 10 | } |
| 11 | |
| 12 | ubuntu_systems() { |
| 13 | apt-get clean |
| 14 | apt-get update |
| 15 | echo 'No changes to apply' |
| 16 | } |
| 17 | |
| 18 | all_systems() { |
| 19 | echo 'No common distribution configuration to perform' |
| 20 | } |
| 21 | |
| 22 | echo "---> Detecting OS" |
| 23 | ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') |
| 24 | |
| 25 | case "${ORIGIN}" in |
| 26 | fedora|centos|redhat) |
| 27 | echo "---> RH type system detected" |
| 28 | rh_systems |
| 29 | ;; |
| 30 | ubuntu) |
| 31 | echo "---> Ubuntu system detected" |
| 32 | ubuntu_systems |
| 33 | ;; |
| 34 | *) |
| 35 | echo "---> Unknown operating system" |
| 36 | ;; |
| 37 | esac |
| 38 | |
| 39 | # execute steps for all systems |
| 40 | all_systems |