@@ -122,51 +122,48 @@ echo -n "."
122
122
echo " Error: $sharch not found"
123
123
clean_up 1
124
124
}
125
+ sha1=$( cat $sharch | sha1sum | awk ' {print $1}' )
125
126
echo -n " ."
126
127
cp $installer_dir /sharch_body.sh $output_file || {
127
128
echo " Error: Problems copying sharch_body.sh"
128
129
clean_up 1
129
130
}
130
131
131
132
# Replace variables in the sharch template
133
+ sed -i -e " s/%%IMAGE_SHA1%%/$sha1 /" $output_file
132
134
echo -n " ."
133
135
tar_size=" $( wc -c < " ${sharch} " ) "
134
- 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
137
136
sed -i -e " s|%%PAYLOAD_IMAGE_SIZE%%|${tar_size} |" ${output_file}
137
+ cat $sharch >> $output_file
138
138
echo " secure upgrade flags: SECURE_UPGRADE_MODE = $SECURE_UPGRADE_MODE , \
139
139
SECURE_UPGRADE_DEV_SIGNING_KEY = $SECURE_UPGRADE_DEV_SIGNING_KEY , SECURE_UPGRADE_DEV_SIGNING_CERT = $SECURE_UPGRADE_DEV_SIGNING_CERT "
140
140
141
141
if [ " $SECURE_UPGRADE_MODE " = " dev" -o " $SECURE_UPGRADE_MODE " = " prod" ]; then
142
142
CMS_SIG=" ${tmp_dir} /signature.sig"
143
-
144
143
echo " $0 Creating CMS signature for ${output_file} with ${key_file} . Output file ${CMS_SIG} "
145
144
DIR=" $( dirname " $0 " ) "
146
-
147
145
scripts_dir=" ${DIR} /scripts"
148
146
if [ " $SECURE_UPGRADE_MODE " = " dev" ]; then
149
147
. ${scripts_dir} /sign_image_dev.sh
150
- sign_image_dev ${cert_file} ${key_file} ${output_file} ${CMS_SIG} || {
148
+ sign_image_dev ${cert_file} ${key_file} ${output_file} ${CMS_SIG} || {
151
149
echo " CMS sign error $? "
152
150
sudo rm -rf ${CMS_SIG}
153
151
clean_up 1
154
152
}
155
153
else # "$SECURE_UPGRADE_MODE" has to be equal to "prod"
156
154
. ${scripts_dir} /sign_image_${platform} .sh
157
- sign_image_prod ${output_file} ${CMS_SIG} || {
155
+ sign_image_prod ${output_file} ${CMS_SIG} || {
158
156
echo " CMS sign error $? "
159
157
sudo rm -rf ${CMS_SIG}
160
158
clean_up 1
161
159
}
162
160
fi
163
-
164
161
[ -f " $CMS_SIG " ] || {
165
162
echo " Error: CMS signature not created - exiting without signing"
166
163
clean_up 1
167
164
}
168
165
# append signature to binary
169
- cat ${CMS_SIG} >> ${output_file}
166
+ cat ${CMS_SIG} >> ${output_file}
170
167
sudo rm -rf ${CMS_SIG}
171
168
elif [ " $SECURE_UPGRADE_MODE " != " no_sign" ]; then
172
169
echo " SECURE_UPGRADE_MODE not defined or defined as $SECURE_UPGRADE_MODE - build without signing"
0 commit comments