tools/toCOPY/cgcs_overlay/mount_wrappers/mock_cache_umount.sh
Dean Troyer 62bd0253f0 Add build tools
This includes Docker containers to perform the StarlingX build
and a set of scripts to maintain a local mirror of binary CentOS
and other packages required to populate the final ISO file.

Change-Id: I8140fd8fa2d00e7aa98c895a8e4962ab3748669d
2018-06-08 17:01:43 -05:00

61 lines
995 B
Bash
Executable File

#!/bin/bash
MOUNT_POINT=$1
id $USER | grep '(cgts)\|751(mock)' > /dev/null
if [ $? -ne 0 ]
then
echo "Only members of group cgts may use this tool."
exit 1
fi
MY_UID=`id -u $USER`
if [ $? -ne 0 ]
then
echo "failed to determine UID."
exit 1
fi
MY_GID=`getent group cgts | cut -d: -f3`
if [ $? -ne 0 ]
then
echo "failed to determine GID."
exit 1
fi
# echo "USER=$USER"
# echo "UID=$UID"
# echo "MY_UID=$MY_UID"
# echo "MY_GID=$MY_GID"
if [ ! -d $MOUNT_POINT ]
then
echo "'$MOUNT_POINT' is not a directory"
exit 1
fi
echo "$MOUNT_POINT" | grep -e '/mock/.*root/' > /dev/null
if [ $? -ne 0 ]
then
echo "'$MOUNT_POINT' does not match pattern 'mock*root'"
exit 1
fi
mount | grep "$USER" > /dev/null
if [ $? -ne 0 ]
then
echo "'$MOUNT_POINT' is not mounted by $USER"
exit 1
fi
# echo "umount $MOUNT_POINT"
umount $MOUNT_POINT
if [ $? -ne 0 ]
then
echo "failed to unmount '$MOUNT_POINT'"
exit 1
fi
echo "'$MOUNT_POINT' unmounted"
exit 0