unification cont.
This commit is contained in:
parent
fee30698aa
commit
d7fd007786
@ -27,6 +27,7 @@ cleanup() {
|
||||
# directory before removing whatever self-generated stuff
|
||||
if [ -d "${GEN_DATA_DIR}" ]; then
|
||||
cd "${START_DIR_DONT_CHANGE}" || exit 2
|
||||
chmod +w -R ${GEN_DATA_DIR}
|
||||
rm -rf ${GEN_DATA_DIR}
|
||||
printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}
|
||||
else
|
||||
|
@ -12,6 +12,15 @@ if [ ! -x $RELENG_XORRISO ]; then
|
||||
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
|
||||
|
||||
export prog=${SELF}
|
||||
export xorriso=${RELENG_XORRISO}
|
||||
export workdir=${GEN_DATA_DIR}
|
||||
|
@ -2,101 +2,118 @@
|
||||
|
||||
set -e
|
||||
|
||||
START_DIR_DONT_CHANGE=`pwd`
|
||||
SELF=$(basename "$0")
|
||||
|
||||
# START_DIR_DONT_CHANGE=`pwd`
|
||||
# SELF=$(basename "$0")
|
||||
# required config items
|
||||
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}
|
||||
|
||||
. inc/releng_getopts.inc
|
||||
|
||||
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
|
||||
|
||||
TMP_DATA_DIR=releng_generated_data
|
||||
IMG_EXTRACT_DIR=${GEN_DATA_DIR}/${SELF}_extracted_tree
|
||||
|
||||
# to be set by the config file
|
||||
RELENG_XORRISO=""
|
||||
# RELENG_XORRISO=""
|
||||
|
||||
RELENG_DIR="${IMG_EXTRACT_DIR}"
|
||||
RELENG_ISOLINUX_BIN="isolinux/isolinux.bin"
|
||||
RELENG_BOOT_CAT="isolinux/boot.cat"
|
||||
RELENG_IMG=t1
|
||||
|
||||
KEEP=0
|
||||
# KEEP=0
|
||||
RES=""
|
||||
|
||||
REMOTE_URL="http://cdimage.debian.org/cdimage/daily-builds/daily/current/i386/iso-cd"
|
||||
REMOTE_IMG="debian-testing-i386-businesscard.iso"
|
||||
|
||||
#####
|
||||
print_help() {
|
||||
cat << HLP
|
||||
Usage:
|
||||
${SELF} -help
|
||||
|
||||
#print_help() {
|
||||
# cat << HLP
|
||||
#Usage:
|
||||
# ${SELF} -help
|
||||
#
|
||||
# using a config file ${CONFFILE}
|
||||
${SELF} -rc [-keep]
|
||||
|
||||
# ${SELF} -rc [-keep]
|
||||
#
|
||||
# without using a config file
|
||||
${SELF} /absolute/or/relative/path/to/xorriso [-keep]
|
||||
# ${SELF} /absolute/or/relative/path/to/xorriso [-keep]
|
||||
|
||||
# cleanup test generated data directory and exit
|
||||
${SELF} -cleanup
|
||||
HLP
|
||||
}
|
||||
# ${SELF} -cleanup
|
||||
#HLP
|
||||
#}
|
||||
|
||||
#####
|
||||
cleanup() {
|
||||
if [ ${KEEP} -eq 0 ]; then
|
||||
# safety net, just in case -> we want to be in the starting
|
||||
# directory before removing whatever self-generated stuff
|
||||
if [ -d "${GEN_DATA_DIR}" ]; then
|
||||
cd "${START_DIR_DONT_CHANGE}" || exit 15
|
||||
chmod +w -R ${GEN_DATA_DIR}
|
||||
rm -rf ${GEN_DATA_DIR}
|
||||
printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}
|
||||
else
|
||||
printf "${SELF}: ${GEN_DATA_DIR} does not exist. Nothing to clean.\n"
|
||||
fi
|
||||
else
|
||||
printf "${SELF}: Leaving (self-generated) %s\n" ${GEN_DATA_DIR}
|
||||
fi
|
||||
}
|
||||
#cleanup() {
|
||||
# if [ ${KEEP} -eq 0 ]; then
|
||||
# # safety net, just in case -> we want to be in the starting
|
||||
# # directory before removing whatever self-generated stuff
|
||||
# if [ -d "${GEN_DATA_DIR}" ]; then
|
||||
# cd "${START_DIR_DONT_CHANGE}" || exit 15
|
||||
# chmod +w -R ${GEN_DATA_DIR}
|
||||
# rm -rf ${GEN_DATA_DIR}
|
||||
# printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}
|
||||
# else
|
||||
# printf "${SELF}: ${GEN_DATA_DIR} does not exist. Nothing to clean.\n"
|
||||
# fi
|
||||
# else
|
||||
# printf "${SELF}: Leaving (self-generated) %s\n" ${GEN_DATA_DIR}
|
||||
# fi
|
||||
#}
|
||||
|
||||
# cleanup
|
||||
if [ "${1}" == "-cleanup" ]; then
|
||||
cleanup
|
||||
exit 0
|
||||
fi
|
||||
#if [ "${1}" == "-cleanup" ]; then
|
||||
# cleanup
|
||||
# exit 0
|
||||
#fi
|
||||
|
||||
# help
|
||||
if [ ! "${1}" ]; then
|
||||
print_help && exit 3
|
||||
#if [ ! "${1}" ]; then
|
||||
# print_help && exit 3
|
||||
# config file
|
||||
elif [ "${1}" == "-rc" -a "${2}" == "-keep" ]; then
|
||||
KEEP=1
|
||||
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
|
||||
elif [ "${1}" == "-rc" -a ! "${2}" ]; then
|
||||
KEEP=0
|
||||
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
|
||||
#elif [ "${1}" == "-rc" -a "${2}" == "-keep" ]; then
|
||||
# KEEP=1
|
||||
# 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
|
||||
#elif [ "${1}" == "-rc" -a ! "${2}" ]; then
|
||||
# KEEP=0
|
||||
# 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
|
||||
# cmdline option
|
||||
elif [ -x "${1}" -a "${2}" == "-keep" ]; then
|
||||
RELENG_XORRISO="${1}"
|
||||
KEEP=1
|
||||
elif [ -x "${1}" ]; then
|
||||
RELENG_XORRISO="${1}"
|
||||
KEEP=0
|
||||
#elif [ -x "${1}" -a "${2}" == "-keep" ]; then
|
||||
# RELENG_XORRISO="${1}"
|
||||
# KEEP=1
|
||||
#elif [ -x "${1}" ]; then
|
||||
# RELENG_XORRISO="${1}"
|
||||
# KEEP=0
|
||||
# the rest
|
||||
else
|
||||
print_help && exit 5
|
||||
fi
|
||||
#else
|
||||
# print_help && exit 5
|
||||
#fi
|
||||
|
||||
#
|
||||
if [ "${RELENG_XORRISO}" == "" -o "${RELENG_DIR}" == "" -o "${RELENG_IMG}" == "" ]; then
|
||||
@ -104,19 +121,19 @@ if [ "${RELENG_XORRISO}" == "" -o "${RELENG_DIR}" == "" -o "${RELENG_IMG}" == ""
|
||||
exit 6
|
||||
fi
|
||||
|
||||
if [ ! -x "${RELENG_XORRISO}" ]; then
|
||||
printf "${SELF}: $RELENG_XORRISO not found or not an executable.\n"
|
||||
exit 7
|
||||
fi
|
||||
#if [ ! -x "${RELENG_XORRISO}" ]; then
|
||||
# printf "${SELF}: $RELENG_XORRISO not found or not an executable.\n"
|
||||
# exit 7
|
||||
#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 8
|
||||
else
|
||||
mkdir "${GEN_DATA_DIR}"
|
||||
fi
|
||||
#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 8
|
||||
#else
|
||||
# mkdir "${GEN_DATA_DIR}"
|
||||
#fi
|
||||
|
||||
# All must be set at this point
|
||||
printf "${SELF}: Config items:"
|
||||
|
@ -11,6 +11,15 @@ if [ ! -x $RELENG_XORRISO ]; then
|
||||
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
|
||||
|
||||
printf "\n$0: FAIL: === TEPLATE === RENAME ME TO releng_<title>\n"
|
||||
exit 31
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user