#!/bin/sh

export XSHAR_REPO=oilshell/oil
export XSHAR_GIT_COMMIT=5751d5a73863c83ff688dd01332fe02b4adb7aaa

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
H4sIALVSuWcAA+08/XPbtpL9WX8Fnt0MyVSiP9Nk9KrkXOejvkscT+y+XsdP5dAkZDGmSB5B2dZ7
0/7tt7sASIKiJOea5N3cETOxJHCx2C8sFrtgFv6N2ClyPxGTNJ+52eKbz992oX1/eIife0+f7NHv
/d1d+oSuw/0nB9/sHT598v3+k729/YNvdvf2Dg4OvmG7X4CWpTYXhZ8z9jWm+t/Ytra2enX1swEr
5nnCpuksveYJT+eCJVH8zPVFGLOcZzkXPCmiNGFRUqRsyguea8jeAqypAekjbA+nmeTpjHneZA4T
cM9j0SxL84JlOSCC3iQgSAUW8tureRSHLqB2kQCP0Koxya0fz3lffXrVt6JtOFJlDLffpeE8hlFn
QHruz/psloYwZlJ+8Yp+jz2k3RSLDBDRBwxiopipv/jrht9n+YNxnSQw5CK94UmfnUfXiY+C6rNT
f8YvAL2jZDNbBFnmzhZxdKUZitPrPiv8a3EXFcFUwQFJUXKtQQJfAPa3kSh6PY+NcEiv1wNW2TtY
Aj/y88XsKo1tlKMzJHq3EQMfMlvL1mGD58BaTk+jCcnchVlth/1lVOrClZiGJc+5HwnOjoTgOWr4
VZ6nuW29us94UPCQSfA+u04L9khY7BFhcmh4zskYkXZFhavBCcgVBg/I3WYOEOpS94w3MIPAD2YF
gR/MiASWbEQFn2lWLvRqBLT5Zm6UifUI5OczDx8yyQB1gUVMK9OQ+JgvkBReMQYCwA675Bts0Rka
ZqsQ11kgg1VzOgZwnAYAS7ZsW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