#!/bin/sh
# DPHMS bwrap shim (payload v24). proot has no user namespaces, so real bwrap
# always dies ("unshare-all"), which crashes glycin's SVG loader and with it
# every GTK icon lookup. This shim skips bwrap's option list and execs the
# target program directly. It is only ever found first on PATH INSIDE the
# DPHMS container's desktop session; it does not touch the Android host.
while [ $# -gt 0 ]; do
  case "$1" in
    --setenv)              export "$2=$3"; shift 3 ;;
    --unsetenv)            unset "$2"; shift 2 ;;
    --clearenv|--unshare-all|--unshare-user|--unshare-ipc|--unshare-pid|--unshare-net|--unshare-uts|--unshare-cgroup|--share-net|--die-with-parent|--new-session|--as-pid-1|--unshare-user-try|--unshare-cgroup-try) shift ;;
    --ro-bind|--bind|--ro-bind-try|--bind-try|--dev-bind|--symlink|--chmod) shift 3 ;;
    --tmpfs|--dir) mkdir -p "$2" 2>/dev/null; shift 2 ;;
    --dev|--proc|--chdir|--seccomp|--dbus-fd|--uid|--gid|--hostname|--file|--bind-data|--lock-file|--sync-fd|--userns|--userns2|--pidns|--cap-add|--cap-drop|--exec-label|--file-label|--block-fd|--info-fd|--json-status-fd|--args) shift 2 ;;
    --) shift; break ;;
    -*) shift ;;
    *) break ;;
  esac
done
[ $# -gt 0 ] || exit 0
exec "$@"
