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
This commit is contained in:
parent
8ab1ead1c0
commit
17928d1153
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user