This repository has been archived on 2026-05-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
disco/client/bin/disco-fs-unmount

35 lines
805 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
if [ "$NOOP" == "" ]; then
DISCOROOT=/var/disco/testfs/real
else
DISCOROOT=/var/disco/testfs/noop
fi
mount | grep $DISCOROOT > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "disco chroot is not mounted"
exit 1
fi
#Unmount the proc/sys mirrors if they were mounted
mount | grep " on ${DISCOROOT}/chroot/proc" >/dev/null 2>&1
if [ $? -eq 0 ]; then
umount ${DISCOROOT}/chroot/proc
fi
mount | grep " on ${DISCOROOT}/chroot/sys" >/dev/null 2>&1
if [ $? -eq 0 ]; then
umount ${DISCOROOT}/chroot/sys
fi
umount ${DISCOROOT}/chroot
umount ${DISCOROOT}/rootfs
mount | grep $DISCOROOT > /dev/null 2>&1
if [ $? -eq 0 ]; then
# Sometimes required
umount ${DISCOROOT}/rootfs
fi
rm -rf ${DISCOROOT}/scratchfs/* ${DISCOROOT}/scratchfs/.unionfs
rm -rf ${DISCOROOT}/dev/*
exit 0