ROCKNIX: update variable snafu

This commit is contained in:
spycat88
2025-11-05 23:26:54 +00:00
parent 589d48167f
commit c76389df2c

View File

@@ -215,24 +215,24 @@ EOF
# config.xml parsing
CONFIGXML="${PROJECT_DIR}/${PROJECT}/config.xml"
SUBDEVICES=$(xmlstarlet sel -t -m "//rocknix/${DEVICE}/*[@mkimage_options]" -v "name()" -n "${DTBXML}" 2>/dev/null | tr '\n' ' ')
SUBDEVICES=$(xmlstarlet sel -t -m "//rocknix/${DEVICE}/*[@mkimage_options]" -v "name()" -n "${CONFIGXML}" 2>/dev/null | tr '\n' ' ')
get_kernel_make_extracmd() {
local DTB_PREFIX
DTB_PREFIX=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/@dtb_prefix" "${DTBXML}" 2>/dev/null)
DTB_PREFIX=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/@dtb_prefix" "${CONFIGXML}" 2>/dev/null)
DTB_PREFIX="${DTB_PREFIX}/"
xmlstarlet sel -t -m "//rocknix/${DEVICE}//file" -o "${DTB_PREFIX}" -v "." -o ".dtb " "${DTBXML}" 2>/dev/null
xmlstarlet sel -t -m "//rocknix/${DEVICE}//file" -o "${DTB_PREFIX}" -v "." -o ".dtb " "${CONFIGXML}" 2>/dev/null
}
get_fdt() {
local FDT_FILENAME=""
if [[ -n "${SUBDEVICE}" ]]; then
FDT_FILENAME=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/${SUBDEVICE}/@fdt" "${DTBXML}" 2>/dev/null || true)
FDT_FILENAME=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/${SUBDEVICE}/@fdt" "${CONFIGXML}" 2>/dev/null || true)
fi
if [[ -z "${FDT_FILENAME}" ]]; then
FDT_FILENAME=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/@fdt" "${DTBXML}" 2>/dev/null || true)
FDT_FILENAME=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/@fdt" "${CONFIGXML}" 2>/dev/null || true)
fi
[ -n "${FDT_FILENAME}" ] && echo "${FDT_FILENAME}" || true
@@ -242,11 +242,11 @@ get_fdt_type() {
local FDT_TYPE=""
if [[ -n "${SUBDEVICE}" ]]; then
FDT_TYPE=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/${SUBDEVICE}/@fdt_type" "${DTBXML}" 2>/dev/null)
FDT_TYPE=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/${SUBDEVICE}/@fdt_type" "${CONFIGXML}" 2>/dev/null)
fi
if [[ -z "${FDT_TYPE}" ]]; then
FDT_TYPE=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/@fdt_type" "${DTBXML}" 2>/dev/null)
FDT_TYPE=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/@fdt_type" "${CONFIGXML}" 2>/dev/null)
fi
if [[ "${FDT_TYPE}" == "fdtdir" ]]; then
@@ -295,7 +295,7 @@ set menu_color_highlight=white/blue
EOF
xmlstarlet sel -t -m "//rocknix/${DEVICE}/file" \
-v "concat(@short, '|', @full, '|', .)" -n "${DTBXML}" 2>/dev/null | while IFS='|' read -r SHORT FULL DTB; do
-v "concat(@short, '|', @full, '|', .)" -n "${CONFIGXML}" 2>/dev/null | while IFS='|' read -r SHORT FULL DTB; do
cat << EOF
menuentry '${FULL}' \$menuentry_id_option '${SHORT}' {
@@ -308,7 +308,7 @@ EOF
done
xmlstarlet sel -t -m "//rocknix/${DEVICE}/file" \
-v "concat(@short, '|', @full, '|', .)" -n "${DTBXML}" 2>/dev/null | while IFS='|' read -r SHORT FULL DTB; do
-v "concat(@short, '|', @full, '|', .)" -n "${CONFIGXML}" 2>/dev/null | while IFS='|' read -r SHORT FULL DTB; do
cat << EOF
menuentry '${FULL} RECOVERY' \$menuentry_id_option '${SHORT}-recovery' {
@@ -324,11 +324,11 @@ mkimage_all() {
local OPTIONS_LIST=""
if [[ -n "${SUBDEVICE}" ]]; then
OPTIONS_LIST=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/${SUBDEVICE}/@mkimage_options" "${DTBXML}" 2>/dev/null)
OPTIONS_LIST=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/${SUBDEVICE}/@mkimage_options" "${CONFIGXML}" 2>/dev/null)
fi
if [[ -z "${OPTIONS_LIST}" ]]; then
OPTIONS_LIST=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/@mkimage_options" "${DTBXML}" 2>/dev/null)
OPTIONS_LIST=$(xmlstarlet sel -t -v "//rocknix/${DEVICE}/@mkimage_options" "${CONFIGXML}" 2>/dev/null)
fi
for step in $(echo "${OPTIONS_LIST}" | tr ',' ' '); do