| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS 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 # Script to archive build results. Used by the buildbots. | 7 # Script to archive build results. Used by the buildbots. |
| 8 | 8 |
| 9 # Load common constants. This should be the first executable line. | 9 # Load common constants. This should be the first executable line. |
| 10 # The path to common.sh should be relative to your script's location. | 10 # The path to common.sh should be relative to your script's location. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 echo "archive to file: $ZIPFILE" | 85 echo "archive to file: $ZIPFILE" |
| 86 | 86 |
| 87 rm -rf "$OUTDIR" | 87 rm -rf "$OUTDIR" |
| 88 mkdir -p "$OUTDIR" | 88 mkdir -p "$OUTDIR" |
| 89 | 89 |
| 90 # Modify image for test if flag set. | 90 # Modify image for test if flag set. |
| 91 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] | 91 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] |
| 92 then | 92 then |
| 93 echo "Modifying image for test" | 93 echo "Modifying image for test" |
| 94 cp "${FLAGS_from}/rootfs.image" "${FLAGS_from}/rootfs_test.image" | 94 cp "${FLAGS_from}/rootfs.image" "${FLAGS_from}/rootfs_test.image" |
| 95 "${SCRIPTS_DIR}/mod_image_for_test.sh" --image \ | 95 "${SCRIPTS_DIR}/mod_image_for_test.sh" --board $FLAGS_board --image \ |
| 96 "${FLAGS_from}/rootfs_test.image" | 96 "${FLAGS_from}/rootfs_test.image" |
| 97 fi | 97 fi |
| 98 | 98 |
| 99 # Zip the build | 99 # Zip the build |
| 100 echo "Compressing and archiving build..." | 100 echo "Compressing and archiving build..." |
| 101 cd "$FLAGS_from" | 101 cd "$FLAGS_from" |
| 102 zip -r "$ZIPFILE" * | 102 zip -r "$ZIPFILE" * |
| 103 cd - | 103 cd - |
| 104 | 104 |
| 105 # Update LATEST file | 105 # Update LATEST file |
| 106 echo "$LAST_CHANGE" > "${FLAGS_to}/LATEST" | 106 echo "$LAST_CHANGE" > "${FLAGS_to}/LATEST" |
| 107 | 107 |
| 108 # Make sure files are readable | 108 # Make sure files are readable |
| 109 chmod 644 "$ZIPFILE" "${FLAGS_to}/LATEST" | 109 chmod 644 "$ZIPFILE" "${FLAGS_to}/LATEST" |
| 110 chmod 755 "$OUTDIR" | 110 chmod 755 "$OUTDIR" |
| 111 | 111 |
| 112 # Purge old builds if necessary | 112 # Purge old builds if necessary |
| 113 if [ $FLAGS_keep_max -gt 0 ] | 113 if [ $FLAGS_keep_max -gt 0 ] |
| 114 then | 114 then |
| 115 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." | 115 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." |
| 116 cd "$FLAGS_to" | 116 cd "$FLAGS_to" |
| 117 # +2 because line numbers start at 1 and need to skip LATEST file | 117 # +2 because line numbers start at 1 and need to skip LATEST file |
| 118 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` | 118 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` |
| 119 cd - | 119 cd - |
| 120 fi | 120 fi |
| 121 | 121 |
| 122 echo "Done." | 122 echo "Done." |
| OLD | NEW |