Bug 464858 - intermittent / recurring fail of test_db_update_v1.js. bustagefix.
[wine-gecko.git] / tools / update-packaging / unwrap_full_update.sh
blob140bdf71ad8a8e69dcb78e83a825f5781c3f0214
1 #!/bin/sh
3 # This tool unpacks a full update package generated by make_full_update.sh
4 # Author: Darin Fisher
7 # -----------------------------------------------------------------------------
8 # By default just assume that these tools exist on our path
9 MAR=${MAR:-mar}
10 BZIP2=${BZIP2:-bzip2}
12 # -----------------------------------------------------------------------------
14 print_usage() {
15 echo "Usage: $(basename $0) [OPTIONS] ARCHIVE"
18 if [ $# = 0 ]; then
19 print_usage
20 exit 1
23 if [ $1 = -h ]; then
24 print_usage
25 echo ""
26 echo "The contents of ARCHIVE will be unpacked into the current directory."
27 echo ""
28 echo "Options:"
29 echo " -h show this help text"
30 echo ""
31 exit 1
34 # -----------------------------------------------------------------------------
36 archive="$1"
38 # Generate a list of all files in the archive.
39 files=($($MAR -t "$archive" | cut -d' ' -f3))
41 # Extract the files, creating subdirectories. The resulting files are bzip2
42 # compressed, so we need to walk the list of files, and decompress them.
43 $MAR -x "$archive"
45 num_files=${#files[*]}
47 # Skip first "file" since it is actually the column header string "NAME" that
48 # does not correspond to an actual file in the archive.
49 for ((i=1; $i<$num_files; i=$i+1)); do
50 eval "f=${files[$i]}"
52 echo " decompressing $f"
54 mv -f "$f" "$f.bz2"
55 $BZIP2 -d "$f.bz2"
56 done