Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: chrome/test/data/safe_browsing/dmg/generate_test_data.sh

Issue 2926473002: Mac Archive Type Sniffing (Closed)
Patch Set: matching style Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # Copyright 2015 The Chromium Authors. All rights reserved. 3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 set -eu 7 set -eu
8 8
9 THIS_DIR=$(dirname "$0") 9 THIS_DIR=$(dirname "$0")
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 touch "${FAKE_APP}/../Info.plist" 77 touch "${FAKE_APP}/../Info.plist"
78 78
79 mkdir "${DMG_SOURCE}/.hidden" 79 mkdir "${DMG_SOURCE}/.hidden"
80 cp "${THIS_DIR}/../mach_o/lib64.dylib" "${DMG_SOURCE}/.hidden/" 80 cp "${THIS_DIR}/../mach_o/lib64.dylib" "${DMG_SOURCE}/.hidden/"
81 81
82 hdiutil create -srcfolder "${DMG_SOURCE}" \ 82 hdiutil create -srcfolder "${DMG_SOURCE}" \
83 -format UDZO -layout SPUD -volname "Mach-O in DMG" -ov \ 83 -format UDZO -layout SPUD -volname "Mach-O in DMG" -ov \
84 "${OUT_DIR}/mach_o_in_dmg" 84 "${OUT_DIR}/mach_o_in_dmg"
85 85
86 rm -rf "${DMG_SOURCE}" 86 rm -rf "${DMG_SOURCE}"
87
88 # Copy of Mach-O DMG with 'koly' signature overwritten #######################
89 cp "${OUT_DIR}/mach_o_in_dmg.dmg" \
90 "${OUT_DIR}/mach_o_in_dmg_no_koly_signature.dmg"
Robert Sesek 2017/06/12 16:38:39 nit: indent continuation lines by 4 spaces so it's
mortonm 2017/06/12 18:31:16 Done.
91 # Gets size of Mach-O DMG copy.
92 SIZE=`stat -f%z "${OUT_DIR}/mach_o_in_dmg_no_koly_signature.dmg"`
93 # Overwrites 'koly' with '????'.
94 printf '\xa1\xa1\xa1\xa1' | dd conv=notrunc \
95 of="${OUT_DIR}/mach_o_in_dmg_no_koly_signature.dmg" bs=1 seek=$(($SIZE - 512))
96
97 # Copy of Mach-O DMG with extension changed to .txt.
98 cp "${OUT_DIR}/mach_o_in_dmg.dmg" "${OUT_DIR}/mach_o_in_dmg.txt"
99
100 # Copy of Mach-O DMG with extension changed to .txt and no 'koly' signature ##
101 cp "${OUT_DIR}/mach_o_in_dmg_no_koly_signature.dmg" \
102 "${OUT_DIR}/mach_o_in_dmg_no_koly_signature.txt"
103
Robert Sesek 2017/06/12 16:38:39 nit: extra blank line
mortonm 2017/06/12 18:31:16 Done.
87 } 104 }
88 105
89 # Silence any stdout, but keep stderr. 106 # Silence any stdout, but keep stderr.
90 generate_test_data > /dev/null 107 generate_test_data > /dev/null
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698