#!/bin/sh

export XSHAR_REPO=oilshell/oil
export XSHAR_GIT_COMMIT=e021c9b309f3d993e654c2c549900fee9c5ef09d

name=$(basename $0)  # e.g. hello-xshar.xshar
default_dir=/tmp/$name.$$

# User can override this, and then _build/oils.sh can use SKIP_REBUILD to make
# it faster.  Multiple runs without compiling.

export XSHAR_DIR=${XSHAR_DIR:-$default_dir}

change_dir() {
  mkdir -p "$XSHAR_DIR"
  cd "$XSHAR_DIR"
}

extract_data() {
  base64 -d <<'XSHAR_DATA' | tar -x -z
H4sIAE/gumcAA+08/XPbNrL9WX8Fzm6GZCpRtmPHGV+VPNf5qN9LHE/sXq/jczk0CVmMKZKPoGzr
btq//e0uAJKgKMl5TXI3d8RMLAlcLPYLi8UumLl/I4ZF7idinOZTN5t/8/nbFrSnu7v4ub2/t02/
d7a26BO6dnf2nnyzvbu/93Rvb39/D+C2t5/sPf2GbX0BWhbaTBR+ztjXmOpfsW1sbPTq6mcDVszy
hE3SaXrNE57OBEui+JnrizBmOc9yLnhSRGnCoqRI2YQXPNeQvTlYUwPSR9geTjPO0ynzvPEMJuCe
x6JpluYFy3JABL1JQJAKLOS3V7MoDl1A7SIBHqFVY5JbP57xvvr0qm9F23Ckyhhuv0vDWQyjToH0
3J/22TQNYcy4/OIV/R57SLsp5hkgog8YxEQxVX/x1w2/z/IH4zpOYMh5esOTPjuLrhMfBdVnJ/6U
nwN6R8lmOg+yzJ3O4+hKMxSn131W+NfiLiqCiYIDkqLkWoMEvgDsbyNR9HoeG+GQXq8HrLJ3sAR+
4Gfz6VUa2yhH54Do3UQM/IDZWrYOGzwH1nJ6Go1J5i7MajvsT6NSF67EdFDynPuR4OxQCJ6jhl/l
eZrb1qv7jAcFD5kE77PrtGCPhMUeESaHhuecjBFpV1S4GpyAXGHwgNyt5wChLnTP5RpmEPjBrCDw
gxmRwJKNqOBTzcq5Xo2ANl/PjTKxHoH8dOrhQyYZoC6wiEllGhIf8wWSwivGQADYYZd8gy06B4bZ
KsR1Fshg1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