1#!/bin/sh2# umount all mountpoints of an existing alpine chroot.34set -e56if [ $# -lt 1 ]; then7 echo "USAGE: ${0##*/} CHROOT..." 1>&28 exit 19fi1011if [ $(id -u) -ne 0 ]; then12 echo "${0##*/} has to be started as root." 1>&213 exit 114fi1516for chroot in $@; do17 for mountpoint in /dev /sys /run /proc; do18 busybox mountpoint -q "${chroot}/${mountpoint}" && \19 umount -l "${chroot}/${mountpoint}"20 done2122 for mountpoint in $(mount | cut -d " " -f3 | grep "^${chroot}"); do23 umount -l "${mountpoint}"24 done25done