|
|
|
@ -2,90 +2,111 @@
|
|
|
|
|
|
|
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
START_DIR_DONT_CHANGE=`pwd` |
|
|
|
|
SELF=$(basename "$0") |
|
|
|
|
# Include common bits |
|
|
|
|
. inc/releng_getopts.inc |
|
|
|
|
|
|
|
|
|
# Each releng_ test should decide whether or not it need |
|
|
|
|
# a xorriso binary to test, since some do compilations only. |
|
|
|
|
if [ ! -x $RELENG_XORRISO ]; then |
|
|
|
|
print_help |
|
|
|
|
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n" |
|
|
|
|
exit 31 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# check data dir, if any and after checking -x xorriso |
|
|
|
|
if [ -d "${GEN_DATA_DIR}" ]; then |
|
|
|
|
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} |
|
|
|
|
printf "\n${SELF}: use '${SELF} -c1' to remove.\n" |
|
|
|
|
exit 8 |
|
|
|
|
else |
|
|
|
|
mkdir "${GEN_DATA_DIR}" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
#START_DIR_DONT_CHANGE=`pwd` |
|
|
|
|
#SELF=$(basename "$0") |
|
|
|
|
# required config items |
|
|
|
|
RELENG_XORRISO="" |
|
|
|
|
#RELENG_XORRISO="" |
|
|
|
|
|
|
|
|
|
RELENG_GENISOIMAGE=/usr/bin/genisoimage |
|
|
|
|
RELENG_MKISOFS=/usr/bin/mkisofs |
|
|
|
|
|
|
|
|
|
# config file |
|
|
|
|
CONFFILE=${HOME}/.libburnia-releng/${SELF}.conf |
|
|
|
|
GEN_DATA_DIR=releng_generated_data/${SELF} |
|
|
|
|
# CONFFILE=${HOME}/.libburnia-releng/${SELF}.conf |
|
|
|
|
# GEN_DATA_DIR=releng_generated_data/${SELF} |
|
|
|
|
|
|
|
|
|
UPPER=40 |
|
|
|
|
KEEP=0 |
|
|
|
|
# KEEP=0 |
|
|
|
|
|
|
|
|
|
##################################################################### |
|
|
|
|
print_help() { |
|
|
|
|
cat << HLP |
|
|
|
|
Usage: |
|
|
|
|
$0 -help |
|
|
|
|
#print_help() { |
|
|
|
|
# cat << HLP |
|
|
|
|
#Usage: |
|
|
|
|
# $0 -help |
|
|
|
|
|
|
|
|
|
# using a config file ${CONFFILE} |
|
|
|
|
$0 -rc [-keep] |
|
|
|
|
# $0 -rc [-keep] |
|
|
|
|
|
|
|
|
|
# without using a config file |
|
|
|
|
$0 xorriso_cmd |
|
|
|
|
# $0 xorriso_cmd |
|
|
|
|
|
|
|
|
|
# cleanup test generated data directory and exit |
|
|
|
|
$0 -cleanup |
|
|
|
|
HLP |
|
|
|
|
} |
|
|
|
|
# $0 -cleanup |
|
|
|
|
#HLP |
|
|
|
|
#} |
|
|
|
|
|
|
|
|
|
##################################################################### |
|
|
|
|
# cleanup |
|
|
|
|
if [ "${1}" == "-cleanup" ]; then |
|
|
|
|
cd "${START_DIR_DONT_CHANGE}" || exit 2 |
|
|
|
|
if [ -d "${GEN_DATA_DIR}" ]; then |
|
|
|
|
rm -rf ${GEN_DATA_DIR} |
|
|
|
|
printf "${SELF}: removed %s\n" ${GEN_DATA_DIR} |
|
|
|
|
else |
|
|
|
|
printf "${SELF}: ${GEN_DATA_DIR} does not exist.\n" |
|
|
|
|
fi |
|
|
|
|
exit 0 |
|
|
|
|
fi |
|
|
|
|
#if [ "${1}" == "-cleanup" ]; then |
|
|
|
|
# cd "${START_DIR_DONT_CHANGE}" || exit 2 |
|
|
|
|
# if [ -d "${GEN_DATA_DIR}" ]; then |
|
|
|
|
# rm -rf ${GEN_DATA_DIR} |
|
|
|
|
# printf "${SELF}: removed %s\n" ${GEN_DATA_DIR} |
|
|
|
|
# else |
|
|
|
|
# printf "${SELF}: ${GEN_DATA_DIR} does not exist.\n" |
|
|
|
|
# fi |
|
|
|
|
# exit 0 |
|
|
|
|
#fi |
|
|
|
|
|
|
|
|
|
# help |
|
|
|
|
if [ ! "${1}" ]; then print_help && exit 3; fi |
|
|
|
|
#if [ ! "${1}" ]; then print_help && exit 3; fi |
|
|
|
|
# config file |
|
|
|
|
if [ "${1}" == "-rc" ]; then |
|
|
|
|
if [ -e ${CONFFILE} ]; then |
|
|
|
|
. ${CONFFILE} |
|
|
|
|
printf "${SELF}: Using config file %s\n" ${CONFFILE} |
|
|
|
|
else |
|
|
|
|
echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4 |
|
|
|
|
fi |
|
|
|
|
if [ "${2}" == "-keep" ]; then KEEP=1; fi |
|
|
|
|
#if [ "${1}" == "-rc" ]; then |
|
|
|
|
# if [ -e ${CONFFILE} ]; then |
|
|
|
|
# . ${CONFFILE} |
|
|
|
|
# printf "${SELF}: Using config file %s\n" ${CONFFILE} |
|
|
|
|
# else |
|
|
|
|
# echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4 |
|
|
|
|
# fi |
|
|
|
|
# if [ "${2}" == "-keep" ]; then KEEP=1; fi |
|
|
|
|
# command line args |
|
|
|
|
elif [ "${1}" ]; then |
|
|
|
|
RELENG_XORRISO="${1}" |
|
|
|
|
if [ "${2}" == "-keep" ]; then KEEP=1; fi |
|
|
|
|
#elif [ "${1}" ]; then |
|
|
|
|
# RELENG_XORRISO="${1}" |
|
|
|
|
# if [ "${2}" == "-keep" ]; then KEEP=1; fi |
|
|
|
|
# the rest |
|
|
|
|
else |
|
|
|
|
print_help && exit 5 |
|
|
|
|
fi |
|
|
|
|
#else |
|
|
|
|
# print_help && exit 5 |
|
|
|
|
#fi |
|
|
|
|
|
|
|
|
|
# data dir |
|
|
|
|
if [ -d "${GEN_DATA_DIR}" ]; then |
|
|
|
|
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} |
|
|
|
|
printf "\n${SELF}: use '${SELF} -cleanup' to remove.\n" |
|
|
|
|
exit 6 |
|
|
|
|
else |
|
|
|
|
mkdir "${GEN_DATA_DIR}" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ "${RELENG_XORRISO}" == "" ]; then |
|
|
|
|
echo -e "\n${SELF}: xorriso_cmd is required\n" |
|
|
|
|
exit 7 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ ! -x "${RELENG_XORRISO}" ]; then |
|
|
|
|
printf "${SELF}: Not found or not an executable: $RELENG_XORRISO\n" |
|
|
|
|
exit 8 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# all must be set at this point |
|
|
|
|
#if [ -d "${GEN_DATA_DIR}" ]; then |
|
|
|
|
# printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} |
|
|
|
|
# printf "\n${SELF}: use '${SELF} -cleanup' to remove.\n" |
|
|
|
|
# exit 6 |
|
|
|
|
#else |
|
|
|
|
# mkdir "${GEN_DATA_DIR}" |
|
|
|
|
#fi |
|
|
|
|
|
|
|
|
|
#if [ "${RELENG_XORRISO}" == "" ]; then |
|
|
|
|
# echo -e "\n${SELF}: xorriso_cmd is required\n" |
|
|
|
|
# exit 7 |
|
|
|
|
# fi |
|
|
|
|
|
|
|
|
|
#if [ ! -x "${RELENG_XORRISO}" ]; then |
|
|
|
|
# printf "${SELF}: Not found or not an executable: $RELENG_XORRISO\n" |
|
|
|
|
# exit 8 |
|
|
|
|
#fi |
|
|
|
|
|
|
|
|
|
# All must be set at this point |
|
|
|
|
printf "${SELF}: Config items:" |
|
|
|
|
printf "\n\txorriso_cmd=${RELENG_XORRISO}\n" |
|
|
|
|
|
|
|
|
|