blob: c940c0ac816056d74ae73ba85f1bfe6b53f9ef58 [file] [log] [blame]
Gary Wue5f3fc72017-08-04 07:09:26 -07001#!/bin/bash
2# This particular environment was created specifically for vfc-nfvo-lcm
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
7set -xeu -o pipefail
8
9rh_systems() {
10 # redis
Gary Wuf3192eb2017-08-10 10:21:59 -070011 yum install -y redis
Gary Wue5f3fc72017-08-04 07:09:26 -070012 systemctl enable redis.service
13}
14
15ubuntu_systems() {
16 # redis
17
18 # 1. download and install redis
19 cd /tmp
20 wget http://download.redis.io/releases/redis-4.0.1.tar.gz
21 tar -zxf redis-4.0.1.tar.gz
22 cd /tmp/redis-4.0.1
23 make
24 make install
25
26 # 2. set conf file and init script
Gary Wu4d62efa2017-08-10 09:51:08 -070027 cp /tmp/redis-4.0.1/src/redis-server /etc/init.d/redis-server
Gary Wue5f3fc72017-08-04 07:09:26 -070028 chmod +x /etc/init.d/redis-server
Gary Wu4d62efa2017-08-10 09:51:08 -070029 cp /tmp/redis-4.0.1/redis.conf /etc/redis.conf
Gary Wue5f3fc72017-08-04 07:09:26 -070030
31 # 3. set auto start when start system
32 update-rc.d redis-server defaults
33}
34
35all_systems() {
36 echo 'No common distribution configuration to perform'
37}
38
39echo "---> Detecting OS"
40ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
41
42case "${ORIGIN}" in
43 fedora|centos|redhat)
44 echo "---> RH type system detected"
45 rh_systems
46 ;;
47 ubuntu)
48 echo "---> Ubuntu system detected"
49 ubuntu_systems
50 ;;
51 *)
52 echo "---> Unknown operating system"
53 ;;
54esac
55
56# execute steps for all systems
57all_systems