From: Kuralamudhan Ramakrishnan Date: Fri, 16 Aug 2019 19:27:35 +0000 (-0700) Subject: inital Makefile struct with bm metal3 X-Git-Tag: v0.4.0~98^2 X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=0bdd89c784101fad05fd8d03e5ea7acd4c6199d9;p=icn.git inital Makefile struct with bm metal3 Change-Id: Icceed6c014c867926cd413cbfa0a086736ead6b7 --- diff --git a/Makefile b/Makefile index e69de29..567ea2e 100644 --- a/Makefile +++ b/Makefile @@ -0,0 +1,12 @@ +SHELL:=/bin/bash +BMDIR:=$(CURDIR)/env/metal3 +METAL3DIR:=$(CURDIR)/deploy/metal3/scripts +all: bm_install + +bm_preinstall: + pushd $(BMDIR) && ./01_install_package.sh && ./02_configure.sh && ./03_launch_prereq.sh && popd + +bm_install: + pushd $(METAL3DIR) && ./metal3.sh && popd + +.PHONY: all bm_preinstall bm_install diff --git a/deploy/metal3/scripts/metal3.sh b/deploy/metal3/scripts/metal3.sh index b5ba520..f268d8b 100755 --- a/deploy/metal3/scripts/metal3.sh +++ b/deploy/metal3/scripts/metal3.sh @@ -9,6 +9,11 @@ BM_OPERATOR="${BM_OPERATOR:-https://github.com/metal3-io/baremetal-operator.git} source $LIBDIR/env/lib/common.sh +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" + exit 1 +fi + function get_default_inteface_ipaddress() { local _ip=$1 local _default_interface=$(awk '$2 == 00000000 { print $1 }' /proc/net/route) diff --git a/env/01_install_package.sh b/env/metal3/01_install_package.sh similarity index 96% rename from env/01_install_package.sh rename to env/metal3/01_install_package.sh index b38cce9..36beb04 100755 --- a/env/01_install_package.sh +++ b/env/metal3/01_install_package.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -ex -lib/common.sh -lib/logging.sh +LIBDIR="$(dirname "$PWD")" + +source $LIBDIR/lib/common.sh +source $LIBDIR/lib/logging.sh if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" diff --git a/env/02_configure.sh b/env/metal3/02_configure.sh similarity index 98% rename from env/02_configure.sh rename to env/metal3/02_configure.sh index 016f202..15864d6 100755 --- a/env/02_configure.sh +++ b/env/metal3/02_configure.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash set -xe +LIBDIR="$(dirname "$PWD")" -source lib/logging.sh -source lib/common.sh +source $LIBDIR/lib/logging.sh +source $LIBDIR/lib/common.sh if [[ $EUID -ne 0 ]]; then echo "confgiure script must be run as root" diff --git a/env/03_launch_prereq.sh b/env/metal3/03_launch_prereq.sh similarity index 96% rename from env/03_launch_prereq.sh rename to env/metal3/03_launch_prereq.sh index 544ae0a..95c17f0 100755 --- a/env/03_launch_prereq.sh +++ b/env/metal3/03_launch_prereq.sh @@ -1,11 +1,13 @@ #!/bin/bash set -xe -source lib/logging.sh -source lib/common.sh +LIBDIR="$(dirname "$PWD")" + +source $LIBDIR/lib/logging.sh +source $LIBDIR/lib/common.sh if [[ $EUID -ne 0 ]]; then - echo "confgiure script must be run as root" + echo "launch script must be run as root" exit 1 fi