blob: fa7166189c2a9c09deb85ef70684c1e2871a311a [file] [log] [blame]
John DeNisco68b0ee32017-09-27 16:35:23 -04001#!/bin/bash -x
2# Copyright (c) 2016 Cisco and/or its affiliates.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at:
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15check_os()
16{
17
18 # perform some very rudimentary platform detection
19 lsb_dist=''
20 if command_exists lsb_release; then
21 lsb_dist="$(lsb_release -si)"
22 fi
23 if [ -z "$lsb_dist" ] && [ -r /etc/lsb-release ]; then
24 lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
25 fi
26 if [ -z "$lsb_dist" ] && [ -r /etc/fedora-release ]; then
27 lsb_dist='fedora'
28 fi
29 if [ -z "$lsb_dist" ] && [ -r /etc/centos-release ]; then
30 lsb_dist='centos'
31 fi
32 if [ -z "$lsb_dist" ] && [ -r /etc/os-release ]; then
33 lsb_dist="$(. /etc/os-release && echo "$ID")"
34 fi
35
36 lsb_dist="$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')"
37 case "$lsb_dist" in
38 fedora|centos|ubuntu|debian)
39 ;;
40 *)
41 echo "Operating system [$lsb_dist] is unsupported"
42 exit 0
43 ;;
44 esac
45 LSB=$lsb_dist
46}
47
48check_os
49case "$LSB" in
50 centos)
51 ROOTDIR='/usr'
52 ;;
53 ubuntu)
54 ROOTDIR='/usr/local'
55 ;;
56 *)
57 echo "$LSB is not supported"
58 exit 1
59 ;;
60esac
61
62sudo mkdir $ROOTDIR/vpp
63sudo mkdir $ROOTDIR/vpp/vpp-config
64sudo mkdir $ROOTDIR/vpp/vpp-config/dryrun
65sudo mkdir $ROOTDIR/vpp/vpp-config/scripts
66sudo mkdir $ROOTDIR/vpp/vpp-config/configs
John DeNisco9fa5cf42018-02-06 15:23:05 -050067sudo mkdir $ROOTDIR/vpp/vpp-config/images
John DeNisco68b0ee32017-09-27 16:35:23 -040068sudo mkdir $ROOTDIR/vpp/vpp-config/dryrun/default
69sudo mkdir $ROOTDIR/vpp/vpp-config/dryrun/sysctl.d
70sudo mkdir $ROOTDIR/vpp/vpp-config/dryrun/vpp
John DeNisco9fa5cf42018-02-06 15:23:05 -050071sudo cp scripts/dpdk-devbind.py $ROOTDIR/vpp/vpp-config/scripts/.
John DeNisco68b0ee32017-09-27 16:35:23 -040072sudo cp data/auto-config.yaml $ROOTDIR/vpp/vpp-config/configs/.
John DeNisco9fa5cf42018-02-06 15:23:05 -050073sudo cp data/cloud-config.iso $ROOTDIR/vpp/vpp-config/configs/.
74sudo cp data/iperf-centos.xml.template $ROOTDIR/vpp/vpp-config/configs/.
75sudo cp data/iperf-ubuntu.xml.template $ROOTDIR/vpp/vpp-config/configs/.
76sudo cp data/xenial-mod.img $ROOTDIR/vpp/vpp-config/images/.
77sudo cp data/80-vpp.conf.template $ROOTDIR/vpp/vpp-config/dryrun/sysctl.d/.
John DeNisco68b0ee32017-09-27 16:35:23 -040078sudo cp data/grub.template $ROOTDIR/vpp/vpp-config/dryrun/default/.
79sudo cp data/startup.conf.template $ROOTDIR/vpp/vpp-config/dryrun/vpp/.