#!/bin/sh

export XSHAR_REPO=oilshell/oil
export XSHAR_GIT_COMMIT=bc8ff527792741d2bbe5c6ea2d35045f00c68292

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
H4sIAPSMumcAA+08a3PbOJL5rF+BtSdFMiNRfuVR3lFyHucxvnMcV+zZuSmvh0WTkMWYInkEZVu7
NfPbr7sBkARFSc5Nkr26I6piSWCj0S80Gt1g5v6NGBa5n4hxmk/dbP7oy7ctaM/29vBz+/nTbfq9
s7VFn9C1t/N099H23vOnz55uPdvZ2X20tb29u/v8Edv6CrQstJko/JyxbzHV/8a2sbHRq6ufDVgx
yxM2SafpNU94OhMsieIXri/CmOU8y7ngSRGlCYuSImUTXvBcQ/bmYE0NSB9hezjNOE+nzPPGM5iA
ex6LplmaFyzLARH0JgFBKrCQ317Nojh0AbWLBHiEVo1Jbv14xvvq06u+FW3DkSpjuP0+DWcxjDoF
0nN/2mfTNIQx4/KLV/R77CHtpphngIg+YBATxVT9xV83/D7LH4zrKIEh5+kNT/rsLLpOfBRUn534
U34O6B0lm+k8yDJ3Oo+jK81QnF73WeFfi7uoCCYKDkiKkmsNEvgCsB9Houj1PDbCIb1eD1hl72EJ
/MjP5tOrNLZRjs4+0buJGPg+s7VsHTZ4Cazl9DQak8xdmNV22F9GpS5ciWm/5Dn3I8HZgRA8Rw2/
yfM0t6039xkPCh4yCd5n12nBHguLPSZMDg3PORkj0q6ocDU4AbnC4AG5W88BQl3onss1zCDwg1lB
4AczIoElG1HBp5qVc70aAW2+nhtlYj0C+fnUw4dMMkBdYBGTyjQkPuYLJIVXjIEAsMMu+QZbdPYN
s1WI6yyQwao5HQM4TgOAJVu2r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