| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 echo "archive to file: $ZIPFILE" | 69 echo "archive to file: $ZIPFILE" |
| 70 | 70 |
| 71 rm -rf "$OUTDIR" | 71 rm -rf "$OUTDIR" |
| 72 mkdir -p "$OUTDIR" | 72 mkdir -p "$OUTDIR" |
| 73 | 73 |
| 74 # Modify image for test if flag set. | 74 # Modify image for test if flag set. |
| 75 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] | 75 if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] |
| 76 then | 76 then |
| 77 echo "Modifying image for test" | 77 echo "Modifying image for test" |
| 78 cp "${DEFAULT_FROM}/rootfs.image" "${DEFAULT_FROM}/rootfs_test.image" | 78 cp "${DEFAULT_FROM}/rootfs.image" "${DEFAULT_FROM}/rootfs_test.image" |
| 79 . "${SCRIPTS_DIR}/mod_image_for_test.sh" --image rootfs_test.image | 79 "${SCRIPTS_DIR}/mod_image_for_test.sh" --image \ |
| 80 cd - | 80 "${DEFAULT_FROM}/rootfs_test.image" |
| 81 fi | 81 fi |
| 82 | 82 |
| 83 # Zip the build | 83 # Zip the build |
| 84 echo "Compressing and archiving build..." | 84 echo "Compressing and archiving build..." |
| 85 cd "$DEFAULT_FROM" | 85 cd "$DEFAULT_FROM" |
| 86 zip -r "$ZIPFILE" * | 86 zip -r "$ZIPFILE" * |
| 87 cd - | 87 cd - |
| 88 | 88 |
| 89 # Update LATEST file | 89 # Update LATEST file |
| 90 echo "$LAST_CHANGE" > "${FLAGS_to}/LATEST" | 90 echo "$LAST_CHANGE" > "${FLAGS_to}/LATEST" |
| 91 | 91 |
| 92 # Make sure files are readable | 92 # Make sure files are readable |
| 93 chmod 644 "$ZIPFILE" "${FLAGS_to}/LATEST" | 93 chmod 644 "$ZIPFILE" "${FLAGS_to}/LATEST" |
| 94 chmod 755 "$OUTDIR" | 94 chmod 755 "$OUTDIR" |
| 95 | 95 |
| 96 # Purge old builds if necessary | 96 # Purge old builds if necessary |
| 97 if [ $FLAGS_keep_max -gt 0 ] | 97 if [ $FLAGS_keep_max -gt 0 ] |
| 98 then | 98 then |
| 99 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." | 99 echo "Deleting old builds (all but the newest ${FLAGS_keep_max})..." |
| 100 cd "$FLAGS_to" | 100 cd "$FLAGS_to" |
| 101 # +2 because line numbers start at 1 and need to skip LATEST file | 101 # +2 because line numbers start at 1 and need to skip LATEST file |
| 102 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` | 102 rm -rf `ls -t1 | tail --lines=+$(($FLAGS_keep_max + 2))` |
| 103 cd - | 103 cd - |
| 104 fi | 104 fi |
| 105 | 105 |
| 106 echo "Done." | 106 echo "Done." |
| OLD | NEW |