Adjust h3disp behaviour to modifiy script.bin symlink

https://forum.armbian.com/topic/5770-recent-armbian-updates-break-3-things-2-fixed/?do=findComment&comment=44679
This commit is contained in:
ThomasKaiser 2017-11-27 15:03:02 +01:00
parent 8a2a938f78
commit 3cc5ffb5e4

View File

@ -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