[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [builders/tor-browser-build] 05/32: Bug 40414: Improve the gatekeeper-bundling.sh script



This is an automated email from the git hooks/post-receive script.

boklm pushed a commit to branch master
in repository builders/tor-browser-build.

commit 74584a9ae3059d297c48072e3643453fd1d8188d
Author: Nicolas Vigier <boklm@xxxxxxxxxxxxxx>
AuthorDate: Fri Jan 14 13:35:41 2022 +0100

    Bug 40414: Improve the gatekeeper-bundling.sh script
    
    - use common config
    - add ddmg.sh
    - check if needed dependencies are installed
---
 tools/signing/ddmg.sh                | 41 ++++++++++++++++++++++++++++++++
 tools/signing/gatekeeper-bundling.sh | 46 ++++++++++++++++++++++++++----------
 tools/signing/set-config             |  8 +++++++
 3 files changed, 82 insertions(+), 13 deletions(-)

diff --git a/tools/signing/ddmg.sh b/tools/signing/ddmg.sh
new file mode 100755
index 0000000..45de211
--- /dev/null
+++ b/tools/signing/ddmg.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# This script is called from gatekeeper-bundling.sh, and creates a dmg
+# file from a directory
+#
+# Usage:
+#   ddmg.sh <dmg-file> <src-directory>
+
+set -e
+
+script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+source "$script_dir/functions"
+
+dest_file="$1"
+src_dir="$2"
+
+set +e
+find $src_dir -executable -exec chmod 0755 {} \; 2> /dev/null
+find $src_dir ! -executable -exec chmod 0644 {} \; 2> /dev/null
+
+find $src_dir -exec touch -m -t 200001010101 {} \; 2> /dev/null
+set -e
+
+dmg_tmpdir=$(mktemp -d)
+filelist="$dmg_tmpdir/filelist.txt"
+cd $src_dir
+find . -type f | sed -e 's/^\.\///' | sort | xargs -i echo "{}={}" > $filelist
+find . -type l | sed -e 's/^\.\///' | sort | xargs -i echo "{}={}" >> $filelist
+
+export LD_PRELOAD=$faketime_path
+export FAKETIME="2000-01-01 01:01:01"
+
+echo "Starting: " $(basename $dest_file)
+
+genisoimage -D -V "Tor Browser" -no-pad -R -apple -o "$dmg_tmpdir/tbb-uncompressed.dmg" -path-list $filelist -graft-points -gid 20 -dir-mode 0755 -new-dir-mode 0755
+
+dmg dmg "$dmg_tmpdir/tbb-uncompressed.dmg" "$dest_file"
+
+echo "Finished: " $(basename $dest_file)
+
+rm -Rf "$dmg_tmpdir"
diff --git a/tools/signing/gatekeeper-bundling.sh b/tools/signing/gatekeeper-bundling.sh
index 742bc61..9d3da01 100755
--- a/tools/signing/gatekeeper-bundling.sh
+++ b/tools/signing/gatekeeper-bundling.sh
@@ -30,20 +30,40 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-TORBROWSER_VERSION=$1
-if [ -z $TORBROWSER_VERSION ];
-then
-  echo "Please call this script with a Tor Browser version!"
-  exit 1
-fi
-BUNDLE_LOCALES="ar ca cs da de el en-US es-AR es-ES fa fr ga-IE he hu id is it ja ka ko mk nb-NO nl pl pt-BR ro ru sv-SE tr vi zh-CN zh-TW"
-builddir=/path/to/the/build/dir
-mkdir $builddir/$TORBROWSER_VERSION-signed
-for LANG in $BUNDLE_LOCALES
+set -e
+
+script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
+source "$script_dir/functions"
+
+which genisoimage > /dev/null || \
+  exit_error 'genisoimage is missing. You should install the genisoimage package.'
+test -f $faketime_path || \
+  exit_error "$faketime_path is missing"
+test -d $macos_stapled_dir || \
+  exit_error "The stapled macos zip files should be placed in directory $macos_stapled_dir"
+libdmg_file="$script_dir/../../out/libdmg-hfsplus/libdmg-hfsplus-dfd5e5cc3dc1-c9296e.tar.gz"
+test -f "$libdmg_file" || \
+  exit_error "$libdmg_file is missing." \
+             "You can build it with:" \
+             "  ./rbm/rbm build --target no_containers libdmg-hfsplus" \
+             "See var/deps in projects/libdmg-hfsplus/config for the list of build dependencies"
+
+test -d "$macos_signed_dir" || mkdir "$macos_signed_dir"
+tmpdir="$macos_stapled_dir/tmp"
+rm -Rf "$tmpdir"
+mkdir "$tmpdir"
+cp -rT "$script_dir/../../projects/tor-browser/Bundle-Data/mac-applications.dmg" "$tmpdir/dmg"
+
+tar -C "$tmpdir" -xf "$libdmg_file"
+export PATH="$PATH:$tmpdir/libdmg-hfsplus"
+
+for lang in $bundle_locales
 do
-  cd $builddir/dmg
-  unzip -q $builddir/$TORBROWSER_VERSION/tb-${TORBROWSER_VERSION}_$LANG-stapled.zip
+  cd $tmpdir/dmg
+  unzip -q $macos_stapled_dir/tb-${tbb_version}_$lang-stapled.zip
   cd ..
-  $builddir/ddmg.sh $builddir/$TORBROWSER_VERSION-signed/TorBrowser-${TORBROWSER_VERSION}-osx64_$LANG.dmg $builddir/dmg/
+  $script_dir/ddmg.sh $macos_signed_dir/TorBrowser-${tbb_version}-osx64_$lang.dmg $tmpdir/dmg/
   rm -rf 'dmg/Tor Browser.app'
 done
+
+rm -Rf "$tmpdir"
diff --git a/tools/signing/set-config b/tools/signing/set-config
index 70f1200..99e1bfa 100644
--- a/tools/signing/set-config
+++ b/tools/signing/set-config
@@ -1 +1,9 @@
 . "$script_dir/set-config.tbb-version"
+
+bundle_locales="ar ca cs da de el en-US es-AR es-ES fa fr ga-IE he hu id is it ja ka ko lt mk ms my nb-NO nl pl pt-BR ro ru sv-SE th tr vi zh-CN zh-TW"
+
+signed_dir="$script_dir/../../$tbb_version_type/signed"
+macos_stapled_dir="$signed_dir/$tbb_version-macos-stapled"
+macos_signed_dir="$signed_dir/$tbb_version-macos-signed"
+
+faketime_path=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits