| OLD | NEW |
| 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 # This script is used to generate an HFS file system with several types of | 7 # This script is used to generate an HFS file system with several types of |
| 8 # files of different sizes. | 8 # files of different sizes. |
| 9 | 9 |
| 10 set -e | 10 set -eu |
| 11 | 11 |
| 12 FILESYSTEM_TYPE="$1" | 12 FILESYSTEM_TYPE="$1" |
| 13 RAMDISK_SIZE="$2" | 13 RAMDISK_SIZE="$2" |
| 14 OUT_FILE="$3" | 14 OUT_FILE="$3" |
| 15 | 15 |
| 16 VOLUME_NAME="SafeBrowsingDMG" | 16 VOLUME_NAME="SafeBrowsingDMG" |
| 17 UNICODE_FILENAME="Tĕsẗ 🐐 " | 17 UNICODE_FILENAME="Tĕsẗ 🐐 " |
| 18 | 18 |
| 19 if [[ ! $FILESYSTEM_TYPE ]]; then | 19 if [[ ! $FILESYSTEM_TYPE ]]; then |
| 20 echo "Need to specify a filesystem type. See \`diskutil listfilesystems'." | 20 echo "Need to specify a filesystem type. See \`diskutil listfilesystems'." |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 touch .metadata_never_index | 39 touch .metadata_never_index |
| 40 | 40 |
| 41 mkdir -p first/second/third/fourth/fifth | 41 mkdir -p first/second/third/fourth/fifth |
| 42 | 42 |
| 43 pushd first | 43 pushd first |
| 44 pushd second | 44 pushd second |
| 45 pushd third | 45 pushd third |
| 46 pushd fourth | 46 pushd fourth |
| 47 pushd fifth | 47 pushd fifth |
| 48 | 48 |
| 49 dd if=/dev/random of=random bs=1 count=768 | 49 dd if=/dev/random of=random bs=1 count=768 &> /dev/null |
| 50 | 50 |
| 51 popd # fourth | 51 popd # fourth |
| 52 | 52 |
| 53 touch "Hello World" | 53 touch "Hello World" |
| 54 touch "hEllo wOrld" # No-op on case-insensitive filesystem. | 54 touch "hEllo wOrld" # No-op on case-insensitive filesystem. |
| 55 | 55 |
| 56 popd # third | 56 popd # third |
| 57 | 57 |
| 58 ln -s fourth/fifth/random symlink-random | 58 ln -s fourth/fifth/random symlink-random |
| 59 | 59 |
| 60 popd # second | 60 popd # second |
| 61 | 61 |
| 62 echo "Poop" > "${UNICODE_FILENAME}" | 62 echo "Poop" > "${UNICODE_FILENAME}" |
| 63 ditto --hfsCompression "${UNICODE_FILENAME}" goat-output.txt | 63 ditto --hfsCompression "${UNICODE_FILENAME}" goat-output.txt |
| 64 | 64 |
| 65 popd # first | 65 popd # first |
| 66 | 66 |
| 67 ln "second/${UNICODE_FILENAME}" unicode_name | 67 ln "second/${UNICODE_FILENAME}" unicode_name |
| 68 | 68 |
| 69 popd # volume root | 69 popd # volume root |
| 70 | 70 |
| 71 echo "This is a test HFS+ filesystem generated by" \ | 71 echo "This is a test HFS+ filesystem generated by" \ |
| 72 "chrome/test/data/safe_browsing/dmg/make_hfs.sh." > README.txt | 72 "chrome/test/data/safe_browsing/dmg/make_hfs.sh." > README.txt |
| 73 | 73 |
| 74 popd # Original PWD | 74 popd # Original PWD |
| 75 | 75 |
| 76 # Unmount the volume, copy the raw device to a file, and then destroy it. | 76 # Unmount the volume, copy the raw device to a file, and then destroy it. |
| 77 diskutil unmount ${RAMDISK_VOLUME} | 77 diskutil unmount ${RAMDISK_VOLUME} |
| 78 dd if=${RAMDISK_VOLUME} of="${OUT_FILE}" | 78 dd if=${RAMDISK_VOLUME} of="${OUT_FILE}" &> /dev/null |
| 79 diskutil eject ${RAMDISK_VOLUME} | 79 diskutil eject ${RAMDISK_VOLUME} |
| OLD | NEW |