3 # Code shared by update packaging scripts.
7 # -----------------------------------------------------------------------------
8 # By default just assume that these tools exist on our path
11 MBSDIFF
=${MBSDIFF:-mbsdiff}
13 # -----------------------------------------------------------------------------
29 if [ -x "$reference" ]; then
36 make_add_instruction
() {
38 is_extension
=$
(echo "$f" |
grep -c 'extensions/.*/')
39 if [ $is_extension = "1" ]; then
40 # Use the subdirectory of the extensions folder as the file to test
41 # before performing this add instruction.
42 testdir
=$
(echo "$f" |
sed 's/\(extensions\/[^\/]*\)\/.*/\1/')
43 echo "add-if \"$testdir\" \"$f\""
49 make_patch_instruction
() {
51 is_extension
=$
(echo "$f" |
grep -c 'extensions/.*/')
52 is_search_plugin
=$
(echo "$f" |
grep -c 'searchplugins/.*')
53 if [ $is_extension = "1" ]; then
54 # Use the subdirectory of the extensions folder as the file to test
55 # before performing this add instruction.
56 testdir
=$
(echo "$f" |
sed 's/\(extensions\/[^\/]*\)\/.*/\1/')
57 echo "patch-if \"$testdir\" \"$f.patch\" \"$f\""
58 elif [ $is_search_plugin = "1" ]; then
59 echo "patch-if \"$f\" \"$f.patch\" \"$f\""
61 echo "patch \"$f.patch\" \"$f\""
65 append_remove_instructions
() {
67 if [ -f "$dir/removed-files" ]; then
69 listfile
="$dir/removed-files"
70 elif [ -f "$dir/Contents/MacOS/removed-files" ]; then
71 prefix
=Contents
/MacOS
/
72 listfile
="$dir/Contents/MacOS/removed-files"
74 if [ -n "$listfile" ]; then
75 # Map spaces to pipes so that we correctly handle filenames with spaces.
76 files
=($
(cat "$listfile" |
tr " " "|"))
77 num_files
=${#files[*]}
78 for ((i
=0; $i<$num_files; i
=$i+1)); do
79 # Trim whitespace (including trailing carriage returns)
80 f
=$
(echo ${files[$i]} |
tr "|" " " |
sed 's/^ *\(.*\) *$/\1/' |
tr -d '\r')
81 # Exclude any blank lines or any lines ending with a slash, which indicate
82 # directories. The updater doesn't know how to remove entire directories.
84 if [ $
(echo "$f" |
grep -c '\/$') = 0 ]; then
85 echo "remove \"$prefix$f\""
87 notice
"ignoring remove instruction for directory: $f"
94 # List all files in the current directory, stripping leading "./"
95 # Skip the channel-prefs.js file as it should not be included in any
96 # generated MAR files (see bug 306077). Pass a variable name and it will be
102 ! -name "channel-prefs.js" \
103 ! -name "update.manifest" \
104 ! -name "temp-filelist" \
105 |
sed 's/\.\/\(.*\)/\1/' \
106 |
sort > "temp-filelist"
108 eval "${1}[$count]=\"$file\""
110 done < "temp-filelist"