Martin L Roth has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/62939 )
Change subject: makechips.sh: Reformat script with shfmt ......................................................................
makechips.sh: Reformat script with shfmt
Signed-off-by: Martin Roth gaumless@gmail.com Change-Id: I92c1044f93e0322fe13ea3804371203e321293d9 --- M makechips.sh 1 file changed, 19 insertions(+), 17 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/39/62939/1
diff --git a/makechips.sh b/makechips.sh index e6080f2..602eb08 100755 --- a/makechips.sh +++ b/makechips.sh @@ -14,18 +14,21 @@
URL="https://www.dediprog.com/download/save/78.msi"
-if ! which curl > /dev/null; then +if ! which curl >/dev/null; then echo "Install curl to run this script." - exit 1; + exit 1 fi -if ! which msiextract > /dev/null; then +if ! which msiextract >/dev/null; then echo "Install msitools (https://wiki.gnome.org/msitools) to run this script." exit 1 fi
FILE=EM100Pro.msi TEMP=$(mktemp -d /tmp/makech.XXXXXX) -WD="$(cd "$(dirname "$(eval echo "$0")")" || exit 1; pwd)" +WD="$( + cd "$(dirname "$(eval echo "$0")")" || exit 1 + pwd +)" TD="${WD}/em100_home"
if [[ ! -f "${WD}/makedpfw" ]]; then @@ -41,41 +44,40 @@ curl -s $URL -o $FILE || exit 1 fi echo " Unpacking ..." -if ! msiextract $FILE > /dev/null ; then +if ! msiextract $FILE >/dev/null; then echo " Could not unpack Windows installer..." rm -rf "${TEMP}" exit 1 fi -VERSION="$( strings -e l Program\ Files/DediProg/EM100/EM100.exe | grep -A1 ProductVersion | grep EM100 )" +VERSION="$(strings -e l Program\ Files/DediProg/EM100/EM100.exe | grep -A1 ProductVersion | grep EM100)" echo " Detected SPI flash database "$VERSION""
echo " Creating configs..." mkdir -p "${TD}/configs" cp -a "${TEMP}"/Program\ Files/DediProg/EM100/config/EM100Pro/*.cfg "${TD}/configs" || exit 1 -echo -n "${VERSION}" > "${TD}/configs/VERSION" +echo -n "${VERSION}" >"${TD}/configs/VERSION"
echo " Extract firmware files..." mkdir -p "${TD}/firmware" -for i in "${TEMP}"/Program\ Files/DediProg/EM100/firmware/EM100ProFW_* -do - firmware="$( basename "$i" )" +for i in "${TEMP}"/Program\ Files/DediProg/EM100/firmware/EM100ProFW_*; do + firmware="$(basename "$i")" tuple=${firmware#EM100ProFW_} v=${tuple: -3} voltage=${v/V/.}V - mcu_version=${tuple: 1:1}.${tuple: 2:2} - fpga_version=${tuple: 4:1}.${tuple: 5:2} + mcu_version=${tuple:1:1}.${tuple:2:2} + fpga_version=${tuple:4:1}.${tuple:5:2}
"${WD}/makedpfw" -m "$i/2.bin" -M "${mcu_version}" -f "$i/1.bin" -F "${fpga_version}" \ - -o "${TD}/firmware/em100pro_fw_${mcu_version}_${fpga_version}_${voltage}.dpfw" || exit + -o "${TD}/firmware/em100pro_fw_${mcu_version}_${fpga_version}_${voltage}.dpfw" || exit done -echo -n "${VERSION}" > "${TD}/firmware/VERSION" +echo -n "${VERSION}" >"${TD}/firmware/VERSION"
cd "${TD}" || exit 1 LANG=C tar cJf configs.tar.xz --sort=name configs LANG=C tar cJf firmware.tar.xz --sort=name firmware -echo -n "Time: " > VERSION -date +%s >> VERSION -echo "Version: ${VERSION}" >> VERSION +echo -n "Time: " >VERSION +date +%s >>VERSION +echo "Version: ${VERSION}" >>VERSION cd "${WD}" || exit 1
rm -rf "${TEMP}"