#!/bin/sh
# Phoebus `sys` launcher (Debian-Live appliance).
set -eu
here="$(cd "$(dirname "$0")/.." && pwd)"
stage="${TMPDIR:-/tmp}/phoebus-payload"
if [ ! -x "$stage/bin/sys" ]; then
    mkdir -p "$stage"
    cp -a "$here/." "$stage/"
fi
export PATH="$stage/tools/usr/sbin:$stage/tools/usr/bin:$stage/bin:$PATH"
export LD_LIBRARY_PATH="$stage/tools/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec "$stage/bin/sys" "$@"
