f4d17450 |
#!/bin/bash
#################################################
# Title: mk-unmount-disk #
# Date: 2014-11-26 #
# Version: 1.0 #
# Author: mbassiouny@vmware.com #
# Options: #
################################################# |
cad80a3b |
# Overview
# This unmount the mounted directories after installing photon
# End |
f4d17450 |
# |
cad80a3b |
set -o errexit # exit if error...insurance ;
set -o nounset # exit if variable not initalized
set +h # disable hashall |
f4d17450 |
source config.inc |
cad80a3b |
PRGNAME=${0##*/} # script name minus the path
LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}" # set log file name
#LOGFILE=/dev/null # uncomment to disable log file
[ ${EUID} -eq 0 ] || fail "${PRGNAME}: Need to be root user: FAILURE"
[ -z ${BUILDROOT} ] && fail "${PRGNAME}: BUILDROOT not set: FAILURE" |
f4d17450 |
|
c3771c35 |
if mountpoint ${BUILDROOT}/run >/dev/null 2>&1; then umount ${BUILDROOT}/run; fi
if mountpoint ${BUILDROOT}/sys >/dev/null 2>&1; then umount ${BUILDROOT}/sys; fi
if mountpoint ${BUILDROOT}/proc >/dev/null 2>&1; then umount ${BUILDROOT}/proc; fi |
6eae06bc |
if mountpoint ${BUILDROOT}/dev >/dev/null 2>&1; then umount -R ${BUILDROOT}/dev; fi |
c3771c35 |
while [[ $# > 0 ]]
do
key="$1"
shift
case $key in
-p|--partitionmountpoint)
PARTITION="$1"
MOUNTPOINT="$2"
shift 2
# make sure the directory exists
if mountpoint ${BUILDROOT}${MOUNTPOINT} >/dev/null 2>&1; then umount ${BUILDROOT}${MOUNTPOINT}; fi
;;
*)
# unknown option
;;
esac
done |
f4d17450 |
exit 0 |