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