Write empty object if "extras" is empty

Rawhide has no openh264 builds which results in writing an array with
an empty string as "extras" value. This breaks the installer.
This commit is contained in:
Janne Grunau 2023-10-07 16:36:02 +02:00 committed by ngompa
parent 928c859ad7
commit 402a8ff4c7

View File

@ -89,6 +89,11 @@ popd > /dev/null
openh264_rpms=$(rpmdistro-repoquery fedora "$release" gstreamer1-plugin-openh264 mozilla-openh264 openh264 --location) openh264_rpms=$(rpmdistro-repoquery fedora "$release" gstreamer1-plugin-openh264 mozilla-openh264 openh264 --location)
if [ -e "${openh264_rpms}"]; then
extras="{}"
else
extras="$(printf '%s\n' "${openh264_rpms}" | newlineToJson)"
cat > "${package}.json" <<EOF cat > "${package}.json" <<EOF
{ {
"name": "Fedora Linux ${pretty_release}", "name": "Fedora Linux ${pretty_release}",
@ -98,7 +103,7 @@ cat > "${package}.json" <<EOF
"package": "${package}.zip", "package": "${package}.zip",
"icon": "fedora.icns", "icon": "fedora.icns",
"supported_fw": ["13.5"], "supported_fw": ["13.5"],
"extras": $(printf '%s\n' "$openh264_rpms" | newlineToJson), "extras": ${extras},
"partitions": [ "partitions": [
{ {
"name": "EFI", "name": "EFI",