#!/bin/bash

printf "%b" "${GRN}Unmounting virtual kernel filesystems${RST}...\n"
if mountpoint "${LFS}"/dev/pts >/dev/null 2>&1; then
	sudo umount "${LFS}"/dev/pts
else
	printf "%b" "  ${IYLW}${LFS}/dev/pts${IGRN} is already unmounted${RST}\n"
fi
if mountpoint "${LFS}"/dev >/dev/null 2>&1; then
	sudo umount "${LFS}"/dev
else
	printf "%b" "  ${IYLW}${LFS}/dev${IGRN} is already unmounted${RST}\n"
fi
if mountpoint "${LFS}"/proc >/dev/null 2>&1; then
	sudo umount "${LFS}"/proc
else
	printf "%b" "  ${IYLW}${LFS}/proc${IGRN} is already unmounted${RST}\n"
fi
if mountpoint "${LFS}"/sys >/dev/null 2>&1; then
	sudo umount "${LFS}"/sys
else
	printf "%b" "  ${IYLW}${LFS}/sys${IGRN} is already unmounted${RST}\n"
fi
if mountpoint "${LFS}"/run >/dev/null 2>&1; then
	sudo umount "${LFS}"/run
else
	printf "%b" "  ${IYLW}${LFS}/run${IGRN} is already unmounted${RST}\n"
fi