diff --git a/packages/bsp/h3disp b/packages/bsp/h3disp index 8170c53aa1..b4c89646c0 100644 --- a/packages/bsp/h3disp +++ b/packages/bsp/h3disp @@ -390,7 +390,7 @@ PatchScriptBin() { fi fi - # resolve symlink to modify the original instead of the link + # check for symlink ScriptBin="$(readlink -f "${Path2ScriptBin}/script.bin")" # create temp file @@ -427,14 +427,20 @@ PatchScriptBin() { FexChange "${MyTmpFile}" "hdmi_para" "hdmi_cts_compatibility" "0" fi - # convert temporary fex file back to script.bin - fex2bin "${MyTmpFile}" "${ScriptBin}" 2>/dev/null + # convert temporary fex file back to script.bin. We delete symlinks to + # prevent future board support package updates overwriting h3disp changes + rm "${Path2ScriptBin}/script.bin" + fex2bin "${MyTmpFile}" "${Path2ScriptBin}/script.bin" 2>/dev/null if [ $? -ne 0 ]; then - mv "${Path2ScriptBin}/script.bin.bak" "${ScriptBin}" - echo -e "Aborted\nWriting script.bin went wrong. Nothing changed." >&2 - echo -e "You may look at ${MyTmpFile} to see if there is an error there." >&2 - logger "Writing script.bin went wrong. Nothing changed" - exit 1 + mv "${Path2ScriptBin}/script.bin.bak" "${ScriptBin}" + if [ "${ScriptBin}" != "${Path2ScriptBin}/script.bin" ]; then + cd "${Path2ScriptBin}" + ln -sf "${ScriptBin}" script.bin + fi + echo -e "Aborted\nWriting script.bin went wrong. Nothing changed." >&2 + echo -e "You may look at ${MyTmpFile} to see if there is an error there." >&2 + logger "Writing script.bin went wrong. Nothing changed" + exit 1 else rm "${MyTmpFile}" fi } # PatchScriptBin