Backed out 4 changesets (bug 1858627) for causing clipboard/paste failures. CLOSED...
[gecko.git] / tools / update-packaging / test / make_full_update.sh
blobcdcdae3c3b5ed638dabc5052e29da2be6e6bbacd
1 #!/bin/bash
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 # This tool generates full update packages for the update system.
8 # Author: Darin Fisher
10 # In here to use the local common.sh to allow the full mars to have unfiltered files
12 . $(dirname "$0")/common.sh
14 # -----------------------------------------------------------------------------
16 print_usage() {
17 notice "Usage: $(basename $0) [OPTIONS] ARCHIVE DIRECTORY"
20 if [ $# = 0 ]; then
21 print_usage
22 exit 1
25 if [ $1 = -h ]; then
26 print_usage
27 notice ""
28 notice "The contents of DIRECTORY will be stored in ARCHIVE."
29 notice ""
30 notice "Options:"
31 notice " -h show this help text"
32 notice ""
33 exit 1
36 # -----------------------------------------------------------------------------
38 archive="$1"
39 targetdir="$2"
40 # Prevent the workdir from being inside the targetdir so it isn't included in
41 # the update mar.
42 if [ $(echo "$targetdir" | grep -c '\/$') = 1 ]; then
43 # Remove the /
44 targetdir=$(echo "$targetdir" | sed -e 's:\/$::')
46 workdir="$targetdir.work"
47 updatemanifestv3="$workdir/updatev3.manifest"
48 targetfiles="updatev3.manifest"
50 mkdir -p "$workdir"
52 # Generate a list of all files in the target directory.
53 pushd "$targetdir"
54 if test $? -ne 0 ; then
55 exit 1
58 if [ ! -f "precomplete" ]; then
59 if [ ! -f "Contents/Resources/precomplete" ]; then
60 notice "precomplete file is missing!"
61 exit 1
65 list_files files
67 popd
69 # Add the type of update to the beginning of the update manifests.
70 > $updatemanifestv3
71 notice ""
72 notice "Adding type instruction to update manifests"
73 notice " type complete"
74 echo "type \"complete\"" >> $updatemanifestv3
76 notice ""
77 notice "Adding file add instructions to update manifests"
78 num_files=${#files[*]}
80 for ((i=0; $i<$num_files; i=$i+1)); do
81 f="${files[$i]}"
83 if check_for_add_if_not_update "$f"; then
84 make_add_if_not_instruction "$f" "$updatemanifestv3"
85 else
86 make_add_instruction "$f" "$updatemanifestv3"
89 dir=$(dirname "$f")
90 mkdir -p "$workdir/$dir"
91 $XZ $XZ_OPT --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$targetdir/$f" > "$workdir/$f"
92 copy_perm "$targetdir/$f" "$workdir/$f"
94 targetfiles="$targetfiles \"$f\""
95 done
97 # Append remove instructions for any dead files.
98 notice ""
99 notice "Adding file and directory remove instructions from file 'removed-files'"
100 append_remove_instructions "$targetdir" "$updatemanifestv3"
102 $XZ $XZ_OPT --compress --x86 --lzma2 --format=xz --check=crc64 --force "$updatemanifestv3" && mv -f "$updatemanifestv3.xz" "$updatemanifestv3"
104 eval "$MAR -C \"$workdir\" -c output.mar $targetfiles"
105 mv -f "$workdir/output.mar" "$archive"
107 # cleanup
108 rm -fr "$workdir"
110 notice ""
111 notice "Finished"
112 notice ""