forked from vmware/photon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmk-unmount-disk.sh
executable file
·31 lines (30 loc) · 1.43 KB
/
mk-unmount-disk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#################################################
# Title: mk-unmount-disk #
# Date: 2014-11-26 #
# Version: 1.0 #
# Author: [email protected] #
# Options: #
#################################################
# Overview
# This unmount the mounted directories after installing photon
# End
#
set -o errexit # exit if error...insurance ;
set -o nounset # exit if variable not initalized
set +h # disable hashall
source config.inc
source function.inc
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 ${PARENT} ] && fail "${PRGNAME}: PARENT not set: FAILURE"
[ -z ${BUILDROOT} ] && fail "${PRGNAME}: BUILDROOT not set: FAILURE"
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
if mountpoint ${BUILDROOT}/dev/pts >/dev/null 2>&1; then umount ${BUILDROOT}/dev/pts; fi
if mountpoint ${BUILDROOT}/dev >/dev/null 2>&1; then umount ${BUILDROOT}/dev; fi
if mountpoint ${BUILDROOT} >/dev/null 2>&1; then umount ${BUILDROOT}; fi
exit 0