Bug 596580: Fix mozJSSubScriptLoader's version finding. (r=brendan)
[mozilla-central.git] / tools / update-packaging / make_full_update.sh
blob07206ac79ac8d02653eb94d79b6f3ea88a14adc5
1 #!/bin/bash
3 # This tool generates full update packages for the update system.
4 # Author: Darin Fisher
7 . $(dirname "$0")/common.sh
9 # -----------------------------------------------------------------------------
11 print_usage() {
12 notice "Usage: $(basename $0) [OPTIONS] ARCHIVE DIRECTORY"
15 if [ $# = 0 ]; then
16 print_usage
17 exit 1
20 if [ $1 = -h ]; then
21 print_usage
22 notice ""
23 notice "The contents of DIRECTORY will be stored in ARCHIVE."
24 notice ""
25 notice "Options:"
26 notice " -h show this help text"
27 notice ""
28 exit 1
31 # -----------------------------------------------------------------------------
33 archive="$1"
34 targetdir="$2"
35 workdir="$targetdir.work"
36 manifest="$workdir/update.manifest"
37 targetfiles="update.manifest"
39 mkdir -p "$workdir"
41 # Generate a list of all files in the target directory.
42 pushd "$targetdir"
43 if test $? -ne 0 ; then
44 exit 1
47 # On Mac, force a top-level file so that OS X reloads the Info.plist
48 # and launches the right architecture for the OS version, bug 600098
49 if [[ -d Contents ]]; then
50 touch force_plist_reload
53 list_files files
55 popd
57 > $manifest
59 num_files=${#files[*]}
61 for ((i=0; $i<$num_files; i=$i+1)); do
62 f="${files[$i]}"
64 notice "processing $f"
66 make_add_instruction "$f" >> $manifest
68 dir=$(dirname "$f")
69 mkdir -p "$workdir/$dir"
70 $BZIP2 -cz9 "$targetdir/$f" > "$workdir/$f"
71 copy_perm "$targetdir/$f" "$workdir/$f"
73 targetfiles="$targetfiles \"$f\""
74 done
76 # Append remove instructions for any dead files.
77 append_remove_instructions "$targetdir" >> $manifest
79 $BZIP2 -z9 "$manifest" && mv -f "$manifest.bz2" "$manifest"
81 eval "$MAR -C \"$workdir\" -c output.mar $targetfiles"
82 mv -f "$workdir/output.mar" "$archive"
84 # cleanup
85 rm -fr "$workdir"