catalyst-auto: fix quoting in a number of places
This commit is contained in:
parent
6fd55163c0
commit
12b23fa07e
|
@ -77,9 +77,9 @@ run_cmd() {
|
||||||
|
|
||||||
if [ $verbose = 1 ]; then
|
if [ $verbose = 1 ]; then
|
||||||
echo "*** Running command: ${cmd}"
|
echo "*** Running command: ${cmd}"
|
||||||
${cmd} 2>&1 | tee ${logfile}
|
${cmd} 2>&1 | tee "${logfile}"
|
||||||
else
|
else
|
||||||
${cmd} &> ${logfile}
|
${cmd} &> "${logfile}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,13 +174,13 @@ EMAIL_FROM="catalyst@${HOSTNAME:-$(hostname)}"
|
||||||
EMAIL_SUBJECT_PREPEND="[${SUBARCH}-auto]"
|
EMAIL_SUBJECT_PREPEND="[${SUBARCH}-auto]"
|
||||||
|
|
||||||
doneconfig=0
|
doneconfig=0
|
||||||
for config_file in ${config_files[@]}; do
|
for config_file in "${config_files[@]}"; do
|
||||||
# Make sure all required values were specified
|
# Make sure all required values were specified
|
||||||
if [ -z "${config_file}" -o ! -e "${config_file}" ]; then
|
if [ -z "${config_file}" -o ! -e "${config_file}" ]; then
|
||||||
usage "ERROR: You must specify a valid config file to use: '$config_file' is not valid"
|
usage "ERROR: You must specify a valid config file to use: '$config_file' is not valid"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
source ${config_file}
|
source "${config_file}"
|
||||||
doneconfig=1
|
doneconfig=1
|
||||||
done
|
done
|
||||||
if [[ $doneconfig -eq 0 ]]; then
|
if [[ $doneconfig -eq 0 ]]; then
|
||||||
|
@ -202,7 +202,7 @@ if [[ ${lastrun} -ne 0 ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DATESTAMP=$(date +%Y%m%d)
|
DATESTAMP=$(date +%Y%m%d)
|
||||||
TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" catalyst-auto.${DATESTAMP}.XXXXXX)
|
TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" "catalyst-auto.${DATESTAMP}.XXXXXX")
|
||||||
|
|
||||||
# Nuke any previous tmpdirs to keep them from accumulating.
|
# Nuke any previous tmpdirs to keep them from accumulating.
|
||||||
if [[ ${preclean} -eq 1 ]]; then
|
if [[ ${preclean} -eq 1 ]]; then
|
||||||
|
@ -225,7 +225,7 @@ if ! run_cmd "pre_build" "${TMPDIR}/log/pre_build.log"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${SPECS_DIR}
|
cd "${SPECS_DIR}" || exit 1
|
||||||
|
|
||||||
for a in "" ${SETS}; do
|
for a in "" ${SETS}; do
|
||||||
if [ -z "${a}" ]; then
|
if [ -z "${a}" ]; then
|
||||||
|
@ -237,40 +237,40 @@ for a in "" ${SETS}; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for i in ${!specs_var} ${!optional_specs_var}; do
|
for i in ${!specs_var} ${!optional_specs_var}; do
|
||||||
cp --parents ${i} ${TMPDIR}/specs/
|
cp --parents "${i}" "${TMPDIR}"/specs/
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
find ${KCONFIG_DIR} -type f -exec cp {} ${TMPDIR}/kconfig \;
|
find "${KCONFIG_DIR}" -type f -exec cp {} "${TMPDIR}"/kconfig \;
|
||||||
|
|
||||||
cd ${TMPDIR}/specs
|
cd "${TMPDIR}/specs" || exit 1
|
||||||
|
|
||||||
# Fix up specs with datestamp
|
# Fix up specs with datestamp
|
||||||
for i in $(find -name '*.spec'); do
|
for i in $(find -name '*.spec'); do
|
||||||
# Grab current version_stamp and source_subpath
|
# Grab current version_stamp and source_subpath
|
||||||
old_version_stamp=$(grep version_stamp ${i} | sed -e 's|^version_stamp: *||')
|
old_version_stamp=$(grep version_stamp "${i}" | sed -e 's|^version_stamp: *||')
|
||||||
old_source_subpath=$(grep source_subpath ${i} | sed -e 's|^source_subpath: *||')
|
old_source_subpath=$(grep source_subpath "${i}" | sed -e 's|^source_subpath: *||')
|
||||||
|
|
||||||
new_version_stamp=$(echo "${old_version_stamp}" | sed -e 's|^\(.*-\)\?.*$|\1'${DATESTAMP}'|')
|
new_version_stamp=$(echo "${old_version_stamp}" | sed -e "s|^\(.*-\)\?.*$|\1${DATESTAMP}|")
|
||||||
new_source_subpath=$(echo "${old_source_subpath}" | sed -e 's|'${old_version_stamp}'|'${new_version_stamp}'|')
|
new_source_subpath=$(echo "${old_source_subpath}" | sed -e "s|${old_version_stamp}|${new_version_stamp}|")
|
||||||
|
|
||||||
sed -i 's|^version_stamp:.*$|version_stamp: '${new_version_stamp}'|' ${i}
|
sed -i "s|^version_stamp:.*$|version_stamp: ${new_version_stamp}|" "${i}"
|
||||||
sed -i 's|^snapshot:.*$|snapshot: '${DATESTAMP}'|' ${i}
|
sed -i "s|^snapshot:.*$|snapshot: ${DATESTAMP}|" "${i}"
|
||||||
|
|
||||||
# We don't want to mangle the source_subpath for our stage1 spec
|
# We don't want to mangle the source_subpath for our stage1 spec
|
||||||
if ! grep -q '^target: *stage[14]$' ${i}; then
|
if ! grep -q '^target: *stage[14]$' "${i}"; then
|
||||||
sed -i 's|^source_subpath:.*$|source_subpath: '${new_source_subpath}'|' ${i}
|
sed -i "s|^source_subpath:.*$|source_subpath: ${new_source_subpath}|" "${i}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i '/^livecd\/iso/s|'${old_version_stamp}'|'${new_version_stamp}'|' ${i}
|
sed -i "/^livecd\/iso/s|${old_version_stamp}|${new_version_stamp}|" "${i}"
|
||||||
sed -i '/^livecd\/volid/s|'${old_version_stamp}'|'${new_version_stamp}'|' ${i}
|
sed -i "/^livecd\/volid/s|${old_version_stamp}|${new_version_stamp}|" "${i}"
|
||||||
|
|
||||||
kconfig_lines=$(grep '^boot/kernel/[^/]\+/config:' ${i})
|
kconfig_lines=$(grep '^boot/kernel/[^/]\+/config:' "${i}")
|
||||||
if [ -n "${kconfig_lines}" ]; then
|
if [ -n "${kconfig_lines}" ]; then
|
||||||
echo "${kconfig_lines}" | while read line; do
|
echo "${kconfig_lines}" | while read line; do
|
||||||
key=$(echo "${line}" | cut -d: -f1)
|
key=$(echo "${line}" | cut -d: -f1)
|
||||||
filename=$(basename $(echo "${line}" | cut -d: -f2))
|
filename=$(basename $(echo "${line}" | cut -d: -f2))
|
||||||
sed -i "s|^${key}:.*\$|${key}: ${TMPDIR}/kconfig/${filename}|" ${i}
|
sed -i "s|^${key}:.*\$|${key}: ${TMPDIR}/kconfig/${filename}|" "${i}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ for a in "" ${SETS}; do
|
||||||
|
|
||||||
for i in ${!specs_var}; do
|
for i in ${!specs_var}; do
|
||||||
LOGFILE="${TMPDIR}/log/$(echo "${i}" | sed -e 's:/:_:' -e 's:\.spec$::').log"
|
LOGFILE="${TMPDIR}/log/$(echo "${i}" | sed -e 's:/:_:' -e 's:\.spec$::').log"
|
||||||
run_cmd "${timeprefix} catalyst -a -p -c ${CATALYST_CONFIG} -f ${i}" ${LOGFILE}
|
run_cmd "${timeprefix} catalyst -a -p -c ${CATALYST_CONFIG} -f ${i}" "${LOGFILE}"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
build_failure=1
|
build_failure=1
|
||||||
send_email "Catalyst fatal build error - ${i}" "" "${LOGFILE}"
|
send_email "Catalyst fatal build error - ${i}" "" "${LOGFILE}"
|
||||||
|
@ -330,7 +330,7 @@ for a in "" ${SETS}; do
|
||||||
|
|
||||||
for i in ${!optional_specs_var}; do
|
for i in ${!optional_specs_var}; do
|
||||||
LOGFILE="${TMPDIR}/log/$(echo "${i}" | sed -e 's:/:_:' -e 's:\.spec$::').log"
|
LOGFILE="${TMPDIR}/log/$(echo "${i}" | sed -e 's:/:_:' -e 's:\.spec$::').log"
|
||||||
run_cmd "${timeprefix} catalyst -a -p -c ${CATALYST_CONFIG} -f ${i}" ${LOGFILE}
|
run_cmd "${timeprefix} catalyst -a -p -c ${CATALYST_CONFIG} -f ${i}" "${LOGFILE}"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
build_failure=1
|
build_failure=1
|
||||||
send_email "Catalyst non-fatal build error - ${i}" "" "${LOGFILE}"
|
send_email "Catalyst non-fatal build error - ${i}" "" "${LOGFILE}"
|
||||||
|
|
Loading…
Reference in a new issue