Skip to content

Commit 5848e45

Browse files
authored
Fixed weird binary related sha1 issue
1 parent 41665e5 commit 5848e45

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

onie-mk-demo.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,18 @@ echo -n "."
122122
echo "Error: $sharch not found"
123123
clean_up 1
124124
}
125-
sha1=$(cat $sharch | sha1sum | awk '{print $1}')
126125
echo -n "."
127126
cp $installer_dir/sharch_body.sh $output_file || {
128127
echo "Error: Problems copying sharch_body.sh"
129128
clean_up 1
130129
}
131130

132131
# Replace variables in the sharch template
133-
sed -i -e "s/%%IMAGE_SHA1%%/$sha1/" $output_file
134132
echo -n "."
135133
tar_size="$(wc -c < "${sharch}")"
136134
cat $sharch >> $output_file
135+
sha1=$(sed -e '1,/^exit_marker$/d' "$output_file" | sha1sum | awk '{ print $1 }')
136+
sed -i -e "s/%%IMAGE_SHA1%%/$sha1/" $output_file
137137
sed -i -e "s|%%PAYLOAD_IMAGE_SIZE%%|${tar_size}|" ${output_file}
138138
echo "secure upgrade flags: SECURE_UPGRADE_MODE = $SECURE_UPGRADE_MODE, \
139139
SECURE_UPGRADE_DEV_SIGNING_KEY = $SECURE_UPGRADE_DEV_SIGNING_KEY, SECURE_UPGRADE_DEV_SIGNING_CERT = $SECURE_UPGRADE_DEV_SIGNING_CERT"
@@ -168,7 +168,7 @@ if [ "$SECURE_UPGRADE_MODE" = "dev" -o "$SECURE_UPGRADE_MODE" = "prod" ]; then
168168
# append signature to binary
169169
cat ${CMS_SIG} >> ${output_file}
170170
sudo rm -rf ${CMS_SIG}
171-
elif [ "$SECURE_UPGRADE_MODE" -ne "no_sign" ]; then
171+
elif [ "$SECURE_UPGRADE_MODE" != "no_sign" ]; then
172172
echo "SECURE_UPGRADE_MODE not defined or defined as $SECURE_UPGRADE_MODE - build without signing"
173173
fi
174174

0 commit comments

Comments
 (0)