1#!/usr/bin/env sh2set -e34DOAS=${DOAS:-"doas"}56if [[ "$#" == "1" ]]; then7 _chroot="$1"8elif [ -z "$CHROOT" ] ; then9 >&2 echo '$CHROOT unset'10 exit 111fi1213if [ ! -d "$_chroot" ] ; then14 >&2 echo "Directory $_chroot not exists"15 exit 116fi171819for ent in "run" "dev/pts" "dev" "sys" proc; do20 if mountpoint -q "$_chroot/$ent" ; then21 $DOAS umount "$_chroot/$ent"22 else23 >&2 echo "WARNING: $_chroot/$ent is not mounted"24 fi25done2627exit 0