Skip to content

Commit ef724f7

Browse files
orazioedoardosilverweed
authored andcommitted
Fix hdiutil not retrying due to set -e
1 parent f6f5538 commit ef724f7

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

makeapp_osx.sh

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,26 @@ sed -i '' "s/CHANGEME_SW_VERSION/$sw_version/" "BOOM Remake.app/Contents/Info.pl
4141
echo -n "APPL????" > "BOOM Remake.app/Contents/PkgInfo"
4242

4343
hdiutil_attempts=0
44+
hdiutil_code_busy=16
4445
hdiutil_max_attempts=10
4546

4647
while true; do
47-
hdiutil create -fs HFS+ -srcfolder "BOOM Remake.app" -volname "BOOM Remake $sw_version" "BOOM-Remake-$sw_version-mac.dmg"
48-
exit_code=$?
49-
(( hdiutil_attempts++ ))
48+
if hdiutil create -fs HFS+ -srcfolder "BOOM Remake.app" -volname "BOOM Remake $sw_version" "BOOM-Remake-$sw_version-mac.dmg"; then
49+
break
50+
else
51+
exit_code=$?
52+
hdiutil_attempts=$(( hdiutil_attempts+1 ))
53+
fi
5054

51-
case "$exit_code" in
52-
0)
53-
break
54-
;;
55-
16)
56-
if [ "$hdiutil_attempts" -eq "$hdiutil_max_attempts" ]; then
57-
exit 16
58-
else
59-
sleep $((1 * (2 ** hdiutil_attempts)))
60-
fi
55+
if [ "$exit_code" -ne "$hdiutil_code_busy" ]; then
56+
exit "$exit_code"
57+
fi
6158

62-
;;
63-
*)
64-
exit "$exit_code"
65-
;;
66-
esac
59+
if [ "$hdiutil_attempts" -eq "$hdiutil_max_attempts" ]; then
60+
exit "$hdiutil_code_busy"
61+
else
62+
sleep $((1 * (2 ** hdiutil_attempts)))
63+
fi
6764
done
6865

6966
rm -r "BOOM Remake.app"

0 commit comments

Comments
 (0)