URI: 
       tpackage.sh - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
       tpackage.sh (2262B)
       ---
            1 #!/usr/bin/env bash
            2 
            3 cdrkit_version=1.1.11
            4 cdrkit_download_path=http://distro.ibiblio.org/fatdog/source/600/c
            5 cdrkit_file_name=cdrkit-${cdrkit_version}.tar.bz2
            6 cdrkit_sha256_hash=b50d64c214a65b1a79afe3a964c691931a4233e2ba605d793eb85d0ac3652564
            7 cdrkit_patches=cdrkit-deterministic.patch
            8 genisoimage=genisoimage-$cdrkit_version
            9 
           10 libdmg_url=https://github.com/theuni/libdmg-hfsplus
           11 
           12 
           13 export LD_PRELOAD=$(locate libfaketime.so.1)
           14 export FAKETIME="2000-01-22 00:00:00"
           15 export PATH=$PATH:~/bin
           16 
           17 . $(dirname "$0")/base.sh
           18 
           19 if [ -z "$1" ]; then
           20     echo "Usage: $0 Electrum.app"
           21     exit -127
           22 fi
           23 
           24 mkdir -p ~/bin
           25 
           26 if ! which ${genisoimage} > /dev/null 2>&1; then
           27         mkdir -p /tmp/electrum-macos
           28         cd /tmp/electrum-macos
           29         info "Downloading cdrkit $cdrkit_version"
           30         wget -nc ${cdrkit_download_path}/${cdrkit_file_name}
           31         tar xvf ${cdrkit_file_name}
           32 
           33         info "Patching genisoimage"
           34         cd cdrkit-${cdrkit_version}
           35         patch -p1 < ../cdrkit-deterministic.patch
           36 
           37         info "Building genisoimage"
           38         cmake . -Wno-dev
           39         make genisoimage
           40         cp genisoimage/genisoimage ~/bin/${genisoimage}
           41 fi
           42 
           43 if ! which dmg > /dev/null 2>&1; then
           44     mkdir -p /tmp/electrum-macos
           45         cd /tmp/electrum-macos
           46         info "Downloading libdmg"
           47     LD_PRELOAD= git clone ${libdmg_url}
           48     cd libdmg-hfsplus
           49     info "Building libdmg"
           50     cmake .
           51     make
           52     cp dmg/dmg ~/bin
           53 fi
           54 
           55 ${genisoimage} -version || fail "Unable to install genisoimage"
           56 dmg -|| fail "Unable to install libdmg"
           57 
           58 plist=$1/Contents/Info.plist
           59 test -f "$plist" || fail "Info.plist not found"
           60 VERSION=$(grep -1 ShortVersionString $plist |tail -1|gawk 'match($0, /<string>(.*)<\/string>/, a) {print a[1]}')
           61 echo $VERSION
           62 
           63 rm -rf /tmp/electrum-macos/image > /dev/null 2>&1
           64 mkdir /tmp/electrum-macos/image/
           65 cp -r $1 /tmp/electrum-macos/image/
           66 
           67 build_dir=$(dirname "$1")
           68 test -n "$build_dir" -a -d "$build_dir" || exit
           69 cd $build_dir
           70 
           71 ${genisoimage} \
           72     -no-cache-inodes \
           73     -D \
           74     -l \
           75     -probe \
           76     -V "Electrum" \
           77     -no-pad \
           78     -r \
           79     -dir-mode 0755 \
           80     -apple \
           81     -o Electrum_uncompressed.dmg \
           82     /tmp/electrum-macos/image || fail "Unable to create uncompressed dmg"
           83 
           84 dmg dmg Electrum_uncompressed.dmg electrum-$VERSION.dmg || fail "Unable to create compressed dmg"
           85 rm Electrum_uncompressed.dmg
           86 
           87 echo "Done."
           88 sha256sum electrum-$VERSION.dmg