Merge "[Doc] Usage and ISO Check Common Code"

This commit is contained in:
Zuul 2018-12-03 21:07:50 +00:00 committed by Gerrit Code Review
commit 0385914366
3 changed files with 23 additions and 32 deletions

View File

@ -1,5 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
usage() {
echo "$0 [-h] [-i <iso image>]"
echo ""
echo "Options:"
echo " -i: StarlingX ISO image"
echo ""
}
iso_image_check() {
local ISOIMAGE=$1
FILETYPE=$(file --mime-type -b ${ISOIMAGE})
if ([ "$FILETYPE" != "application/x-iso9660-image" ]); then
echo "$ISOIMAGE is not an application/x-iso9660-image type"
exit -1
fi
}
# delete a node's disk file in a safe way # delete a node's disk file in a safe way
delete_disk() { delete_disk() {
local fpath="$1" local fpath="$1"

View File

@ -1,19 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )" SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
usage() {
echo "$0 [-h] [-i <iso image>]"
echo ""
echo "Options:"
echo " -i: StarlingX ISO image"
echo ""
}
while getopts "i:" o; do while getopts "i:" o; do
case "${o}" in case "${o}" in
i) i)
ISOIMAGE="$OPTARG" ISOIMAGE=$(readlink -f "$OPTARG")
;; ;;
*) *)
usage usage
@ -28,12 +21,7 @@ if [ -z "${ISOIMAGE}" ]; then
exit -1 exit -1
fi fi
ISOIMAGE=$(readlink -f "$ISOIMAGE") iso_image_check ${ISOIMAGE}
FILETYPE=$(file --mime-type -b ${ISOIMAGE})
if ([ "$FILETYPE" != "application/x-iso9660-image" ]); then
echo "$ISOIMAGE is not an application/x-iso9660-image type"
exit -1
fi
BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr} BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
CONTROLLER=${CONTROLLER:-controller-allinone} CONTROLLER=${CONTROLLER:-controller-allinone}

View File

@ -1,21 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#set -x
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )" SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
usage() {
echo "$0 [-h] [-i <iso image>]"
echo ""
echo "Options:"
echo " -i: StarlingX ISO image"
echo ""
}
while getopts "i:" o; do while getopts "i:" o; do
case "${o}" in case "${o}" in
i) i)
ISOIMAGE="$OPTARG" ISOIMAGE=$(readlink -f "$OPTARG")
;; ;;
*) *)
usage usage
@ -30,12 +21,7 @@ if [ -z "${ISOIMAGE}" ]; then
exit -1 exit -1
fi fi
ISOIMAGE=$(readlink -f "$ISOIMAGE") iso_image_check ${ISOIMAGE}
FILETYPE=$(file --mime-type -b ${ISOIMAGE})
if ([ "$FILETYPE" != "application/x-iso9660-image" ]); then
echo "$ISOIMAGE is not an application/x-iso9660-image type"
exit -1
fi
BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr} BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
CONTROLLER=${CONTROLLER:-controller} CONTROLLER=${CONTROLLER:-controller}