$OpenBSD$ index 3684995..60c5a4b 100755 --- tools/update-packaging/make_incremental_update.sh.orig Fri Feb 20 15:40:39 2015 +++ tools/update-packaging/make_incremental_update.sh Fri Feb 20 15:40:39 2015 @@ -21,6 +21,7 @@ print_usage() { notice " -h show this help text" notice " -f clobber this file in the installation" notice " Must be a path to a file to clobber in the partial update." + notice " -q be less verbose" notice "" } @@ -47,6 +48,17 @@ check_for_forced_update() { ## "true" *giggle* return 0; fi + + # If the file in the skip list ends with /*, do a prefix match. + # This allows TorBrowser/Data/Browser/profile.default/extensions/https-everywhere@eff.org/* to be used to force all HTTPS Everywhere files to be updated. + f_suffix=${f##*/} + if [[ $f_suffix = "*" ]]; then + f_prefix="${f%\/\*}"; + if [[ $forced_file_chk == $f_prefix* ]]; then + ## 0 means "true" + return 0; + fi + fi done ## 'false'... because this is bash. Oh yay! return 1; @@ -57,13 +69,26 @@ if [ $# = 0 ]; then exit 1 fi -requested_forced_updates='Contents/MacOS/firefox' +# The last .xpi is NoScript. +ext_path='TorBrowser/Data/Browser/profile.default/extensions'; +# TODO: it would be better to pass this as a command line option. +exts='https-everywhere@eff.org/* tor-launcher@torproject.org.xpi torbutton@torproject.org.xpi uriloader@pdf.js.xpi {73a6fe31-595d-460b-a920-fcc0f8843232}.xpi' +requested_forced_updates='Contents/MacOS/TorBrowser.app/Contents/MacOS/firefox' +for ext in $exts; do + requested_forced_updates="$requested_forced_updates $ext_path/$ext" +done + + +# TODO: it would be better to pass this as a command line option. +directories_to_remove='TorBrowser/Data/Browser/profile.default/extensions/https-everywhere@eff.org' -while getopts "hf:" flag +while getopts "hqf:" flag do case "$flag" in h) print_usage; exit 0 ;; + q) QUIET=1 + ;; f) requested_forced_updates="$requested_forced_updates $OPTARG" ;; ?) print_usage; exit 1 @@ -102,6 +127,7 @@ if test $? -ne 0 ; then fi list_files oldfiles +list_symlinks oldsymlinks oldsymlink_targets list_dirs olddirs popd @@ -118,17 +144,31 @@ fi list_dirs newdirs list_files newfiles +list_symlinks newsymlinks newsymlink_targets popd # Add the type of update to the beginning of the update manifests. notice "" notice "Adding type instruction to update manifests" -> $updatemanifestv2 -> $updatemanifestv3 +> "$updatemanifestv2" +> "$updatemanifestv3" notice " type partial" -echo "type \"partial\"" >> $updatemanifestv2 -echo "type \"partial\"" >> $updatemanifestv3 +echo "type \"partial\"" >> "$updatemanifestv2" +echo "type \"partial\"" >> "$updatemanifestv3" + +# If removal of any old, existing directories is desired, emit the appropriate +# rmrfdir commands. +notice "" +notice "Adding directory removal instructions to update manifests" +for dir_to_remove in $directories_to_remove; do + # rmrfdir requires a trailing slash, so add one if missing. + if ! [[ "$dir_to_remove" =~ /$ ]]; then + dir_to_remove="${dir_to_remove}/" + fi + echo "rmrfdir \"$dir_to_remove\"" >> "$updatemanifestv2" + echo "rmrfdir \"$dir_to_remove\"" >> "$updatemanifestv3" +done notice "" notice "Adding file patch and add instructions to update manifests" @@ -147,7 +187,7 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do # removed-files is excluded by make_incremental_updates.py so it is excluded # here for consistency. - if [ `basename $f` = "removed-files" ]; then + if [ "`basename "$f"`" = "removed-files" ]; then continue 1 fi @@ -207,6 +247,24 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do fi done +# Remove and re-add symlinks +notice "" +notice "Adding symlink remove/add instructions to update manifests" +num_oldsymlinks=${#oldsymlinks[*]} +for ((i=0; $i<$num_oldsymlinks; i=$i+1)); do + link="${oldsymlinks[$i]}" + verbose_notice " remove: $link" + echo "remove \"$link\"" >> "$updatemanifestv2" + echo "remove \"$link\"" >> "$updatemanifestv3" +done + +num_newsymlinks=${#newsymlinks[*]} +for ((i=0; $i<$num_newsymlinks; i=$i+1)); do + link="${newsymlinks[$i]}" + target="${newsymlink_targets[$i]}" + make_addsymlink_instruction "$link" "$target" "$updatemanifestv2" "$updatemanifestv3" +done + # Newly added files notice "" notice "Adding file add instructions to update manifests" @@ -217,7 +275,7 @@ for ((i=0; $i<$num_newfiles; i=$i+1)); do # removed-files is excluded by make_incremental_updates.py so it is excluded # here for consistency. - if [ `basename $f` = "removed-files" ]; then + if [ "`basename "$f"`" = "removed-files" ]; then continue 1 fi @@ -249,8 +307,8 @@ notice "Adding file remove instructions to update manifests" for ((i=0; $i<$num_removes; i=$i+1)); do f="${remove_array[$i]}" notice " remove \"$f\"" - echo "remove \"$f\"" >> $updatemanifestv2 - echo "remove \"$f\"" >> $updatemanifestv3 + echo "remove \"$f\"" >> "$updatemanifestv2" + echo "remove \"$f\"" >> "$updatemanifestv3" done # Add remove instructions for any dead files. @@ -267,8 +325,8 @@ for ((i=0; $i<$num_olddirs; i=$i+1)); do # If this dir doesn't exist in the new directory remove it. if [ ! -d "$newdir/$f" ]; then notice " rmdir $f/" - echo "rmdir \"$f/\"" >> $updatemanifestv2 - echo "rmdir \"$f/\"" >> $updatemanifestv3 + echo "rmdir \"$f/\"" >> "$updatemanifestv2" + echo "rmdir \"$f/\"" >> "$updatemanifestv3" fi done