aboutsummaryrefslogtreecommitdiff
path: root/tools/tools/tinybsd
diff options
context:
space:
mode:
authorRemko Lodder <remko@FreeBSD.org>2008-03-20 12:56:49 +0000
committerRemko Lodder <remko@FreeBSD.org>2008-03-20 12:56:49 +0000
commit17928d115389203f296be915712d8e00c3de0e48 (patch)
tree5c331d609cab619a3308ba4649e227fb8571d40e /tools/tools/tinybsd
parent8ab1ead1c061274b3f002fa3df5a3d4eeed64266 (diff)
downloadsrc-17928d115389203f296be915712d8e00c3de0e48.tar.gz
src-17928d115389203f296be915712d8e00c3de0e48.zip
Alert properly when we have stale mounts left after interupting
a tinybsd build. If we do not do this, we can accidentally remove critical files from directories like /lib (if mounted). PR: misc/121763 Submitted by: Richard Arends < richard at unixguru dot nl > MFC after: 3 days
Notes
Notes: svn path=/head/; revision=177453
Diffstat (limited to 'tools/tools/tinybsd')
-rwxr-xr-xtools/tools/tinybsd/tinybsd20
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/tools/tinybsd/tinybsd b/tools/tools/tinybsd/tinybsd
index 7f368bb0b77c..912a7974ac96 100755
--- a/tools/tools/tinybsd/tinybsd
+++ b/tools/tools/tinybsd/tinybsd
@@ -248,12 +248,20 @@ rotate_buidlog() {
}
remove_workdir() {
- chflags -R noschg ${WORKDIR}
- echo "${TS} Removing "${WORKDIR}
- rm -rf ${WORKDIR}
- echo "${TS} Removing Build Kernel Directory"
- rm -rf /usr/obj/usr/src/sys/${KERNCONF}
- echo "${TS} done."
+ # Before removing check if there is not a mount under $WORKDIR anymore
+ MOUNT_CHECK=`mount|egrep "on ${WORKDIR}"`
+
+ if [ ! -z "${MOUNT_CHECK}" ]; then
+ echo "There are mounts under the workdir (${WORKDIR}). Please umount them before running this script"
+ exit 1
+ else
+ chflags -R noschg ${WORKDIR}
+ echo "${TS} Removing "${WORKDIR}
+ rm -rf ${WORKDIR}
+ echo "${TS} Removing Build Kernel Directory"
+ rm -rf /usr/obj/usr/src/sys/${KERNCONF}
+ echo "${TS} done."
+ fi
}