#!/bin/sh

export XSHAR_REPO=oilshell/oil
export XSHAR_GIT_COMMIT=cd08ff3ca6048975c3d571aec3d2ea3b0d05bb2d

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
H4sIABhC0mcAA+07a3PbRpL5zF8xK8UF0CFBSZYfxQ3tU+RHtGvLKkvZXEqnoCBgKMICARwGlMTd
Sn77dffMABgAJKVL7LuqxVTZIoGenn5Pd89w6V2LkeuGcZi7rpMuv/kCYwfGs/19/Lv7/Okufd/b
2aG/anyzu/8cQPZ3nj179s3O7u7O0yffsJ0vQUx9LETuZYx9jaX+P44l6v+Kx66fpl9I/Zv0v/9s
/3lN/zvPn+53+v8aY2trq1eqnw1ZvshihlbheCKIWMbTjAse514eJjEL4zxhh99918N50yyZM9ed
LmAOd10WztMky1maARQ8jX2c0lNgAb+5XIRR4MBqDuJ3Cb+aY59kyVXmzQdsngQAOy0+uHzArvNl
ygc9dp9BsMUkNx+wY2/OzxABE/k8l/+790VHwDDpKIb/rvldmhFu+pD3JW/zJUhPczJfRuFl5blD
D/Tb3LsSt2HuzwYsSq6UbIDQML7SIL4n8l7PZRMJ0QMZsHc8Rg5sgBywaX9MtG/jRD5mdsEpLeX8
nIU5z/ps+JIdJzHvEfBPJy5AAVL4nx4AFbOSHMTcZ57A1fm4EE04pQdqBe6AFPpjQ3BT5xaXsy3Q
udXvFe94VJ97mmer5v4QXsHbx+vnvw9FfXHJEQpMQhHMQPHab18LQb63zJcV8TpnKOD2qS9rFFYl
hSPzQsHZgRA8Q8t/k2VJRoIttXjigZHbbUosrXSNFjWhqaMsoWcQyB4J+MdSJwZklVXfgLXaaLJt
xiNNeZPxIBTIGv+0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