John DeNisco | 68b0ee3 | 2017-09-27 16:35:23 -0400 | [diff] [blame] | 1 | #!/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 | |
| 15 | check_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 | |
| 48 | check_os |
| 49 | case "$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 | ;; |
| 60 | esac |
| 61 | |
| 62 | sudo mkdir $ROOTDIR/vpp |
| 63 | sudo mkdir $ROOTDIR/vpp/vpp-config |
| 64 | sudo mkdir $ROOTDIR/vpp/vpp-config/dryrun |
| 65 | sudo mkdir $ROOTDIR/vpp/vpp-config/scripts |
| 66 | sudo mkdir $ROOTDIR/vpp/vpp-config/configs |
John DeNisco | 9fa5cf4 | 2018-02-06 15:23:05 -0500 | [diff] [blame] | 67 | sudo mkdir $ROOTDIR/vpp/vpp-config/images |
John DeNisco | 68b0ee3 | 2017-09-27 16:35:23 -0400 | [diff] [blame] | 68 | sudo mkdir $ROOTDIR/vpp/vpp-config/dryrun/default |
| 69 | sudo mkdir $ROOTDIR/vpp/vpp-config/dryrun/sysctl.d |
| 70 | sudo mkdir $ROOTDIR/vpp/vpp-config/dryrun/vpp |
John DeNisco | 9fa5cf4 | 2018-02-06 15:23:05 -0500 | [diff] [blame] | 71 | sudo cp scripts/dpdk-devbind.py $ROOTDIR/vpp/vpp-config/scripts/. |
John DeNisco | 68b0ee3 | 2017-09-27 16:35:23 -0400 | [diff] [blame] | 72 | sudo cp data/auto-config.yaml $ROOTDIR/vpp/vpp-config/configs/. |
John DeNisco | 9fa5cf4 | 2018-02-06 15:23:05 -0500 | [diff] [blame] | 73 | sudo cp data/cloud-config.iso $ROOTDIR/vpp/vpp-config/configs/. |
| 74 | sudo cp data/iperf-centos.xml.template $ROOTDIR/vpp/vpp-config/configs/. |
| 75 | sudo cp data/iperf-ubuntu.xml.template $ROOTDIR/vpp/vpp-config/configs/. |
| 76 | sudo cp data/xenial-mod.img $ROOTDIR/vpp/vpp-config/images/. |
| 77 | sudo cp data/80-vpp.conf.template $ROOTDIR/vpp/vpp-config/dryrun/sysctl.d/. |
John DeNisco | 68b0ee3 | 2017-09-27 16:35:23 -0400 | [diff] [blame] | 78 | sudo cp data/grub.template $ROOTDIR/vpp/vpp-config/dryrun/default/. |
| 79 | sudo cp data/startup.conf.template $ROOTDIR/vpp/vpp-config/dryrun/vpp/. |