#! /bin/sh set +e # intentional ROOT="${1:-/chroot/sid}" is_mountpoint () { grep -q "^[^ ]* $1 " /proc/mounts } maybe_umount () { if is_mountpoint "$ROOT/${1#/}"; then sudo umount "$ROOT/${1#/}" fi } maybe_umount /home/cjwatson/src maybe_umount /home/cjwatson/.keychain if [ "$GPG_AGENT_INFO" ]; then maybe_umount "$(dirname "$GPG_AGENT_INFO")" fi if [ "$SSH_AUTH_SOCK" ]; then maybe_umount "$(dirname "$SSH_AUTH_SOCK")" fi maybe_umount /tmp/.ICE-unix maybe_umount /tmp/.X11-unix maybe_umount /dev/pts maybe_umount /dev maybe_umount /sys maybe_umount /proc