michael@0: #!/bin/bash michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: unpack_build () { michael@0: unpack_platform="$1" michael@0: dir_name="$2" michael@0: pkg_file="$3" michael@0: locale=$4 michael@0: michael@0: mkdir -p $dir_name michael@0: pushd $dir_name > /dev/null michael@0: case $unpack_platform in michael@0: mac|mac-ppc|Darwin_ppc-gcc|Darwin_Universal-gcc3) michael@0: cd ../ michael@0: mkdir -p mnt michael@0: echo "mounting $pkg_file" michael@0: echo "y" | PAGER="/bin/cat" hdiutil attach -quiet -puppetstrings -noautoopen -mountpoint ./mnt "$pkg_file" > /dev/null michael@0: rsync -a ./mnt/* $dir_name/ michael@0: hdiutil detach mnt > /dev/null michael@0: cd $dir_name michael@0: ;; michael@0: win32|WINNT_x86-msvc) michael@0: 7z x ../"$pkg_file" > /dev/null michael@0: if [ -d core ] michael@0: then michael@0: mkdir bin/ michael@0: cp -rp core/* bin/ michael@0: cp -rp optional/* bin/ michael@0: else michael@0: for file in *.xpi michael@0: do michael@0: unzip -o $file > /dev/null michael@0: done michael@0: unzip -o ${locale}.xpi > /dev/null michael@0: fi michael@0: ;; michael@0: linux-i686|linux|Linux_x86-gcc|Linux_x86-gcc3) michael@0: if `echo $pkg_file | grep -q "tar.gz"` michael@0: then michael@0: tar xfz ../"$pkg_file" > /dev/null michael@0: elif `echo $pkg_file | grep -q "tar.bz2"` michael@0: then michael@0: tar xfj ../"$pkg_file" > /dev/null michael@0: else michael@0: echo "Unknown package type for file: $pkg_file" michael@0: exit 1 michael@0: fi michael@0: ;; michael@0: esac michael@0: michael@0: popd > /dev/null michael@0: michael@0: }