OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 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 # A simple shell script for creating a chrome zip from an output directory. | 7 # A simple shell script for creating a chrome zip from an output directory. |
8 # Pass the path to the output directory you wish to package. | 8 # Pass the path to the output directory you wish to package. |
9 | 9 |
10 if [ $# = 0 ]; then | 10 if [ $# = 0 ]; then |
11 echo "usage: make_zip.sh path/to/release/dir [output-name]" | 11 echo "usage: make_zip.sh path/to/release/dir [output-name]" |
12 exit 1 | 12 exit 1 |
13 fi | 13 fi |
14 | 14 |
15 tools_dir=$(dirname "$0") | 15 tools_dir=$(dirname "$0") |
16 release_dir="$1" | 16 release_dir="$1" |
17 | 17 |
18 files=$(cat "$tools_dir/FILES") | 18 files=$(sed -n "s/^ *'filename': '\(.*\)',$/\1/ p" "$tools_dir/FILES.cfg") |
19 | 19 |
20 output=${2:-chrome-win32} | 20 output=${2:-chrome-win32} |
21 rm -fr $output $output.zip | 21 rm -fr $output $output.zip |
22 mkdir $output | 22 mkdir $output |
23 | 23 |
24 # Get the absolute path of the output directory. We need it when copying | 24 # Get the absolute path of the output directory. We need it when copying |
25 # files. | 25 # files. |
26 output_abs=`cygpath -a $output` | 26 output_abs=`cygpath -a $output` |
27 | 27 |
28 # Use cp --parents to copy full relative directory. Since we need the | 28 # Use cp --parents to copy full relative directory. Since we need the |
29 # relative directory for the zip, change into the release dir. | 29 # relative directory for the zip, change into the release dir. |
30 pushd "$release_dir" | 30 pushd "$release_dir" |
31 # The file names in FILES may contain whitespace, e.g. 'First Run'. | 31 # The file names in FILES may contain whitespace, e.g. 'First Run'. |
32 # Change IFS setting so we only split words with '\n' | 32 # Change IFS setting so we only split words with '\n' |
33 IFS_Default=$IFS | 33 IFS_Default=$IFS |
34 IFS=$'\n' | 34 IFS=$'\n' |
35 for f in ${files[@]}; do | 35 for f in ${files[@]}; do |
36 cp -r --parents "$f" "$output_abs" | 36 cp -r --parents "$f" "$output_abs" |
37 done | 37 done |
38 IFS=$IFS_Default | 38 IFS=$IFS_Default |
39 popd | 39 popd |
40 | 40 |
41 zip -r $output.zip $output | 41 zip -r $output.zip $output |
OLD | NEW |