Add flock call for exclusive access as it seems to fail otherwise.

This commit is contained in:
Sebastian Roth
2021-03-07 09:36:27 -06:00
parent 4c5cdcffd8
commit 5256dca4ca

View File

@@ -91,7 +91,7 @@ restoreSfdiskPartitions() {
[[ -z $disk ]] && handleError "No disk passed (${FUNCNAME[0]})\n Args Passed: $*"
[[ -z $file ]] && handleError "No file to receive from passed (${FUNCNAME[0]})\n Args Passed: $*"
applySfdiskPartitions "$disk" "$file"
fdisk $disk < /usr/share/fog/lib/EOFRESTOREPART >/dev/null 2>&1
flock $disk fdisk $disk < /usr/share/fog/lib/EOFRESTOREPART >/dev/null 2>&1
[[ ! $? -eq 0 ]] && majorDebugEcho "fdisk failed in (${FUNCNAME[0]})"
}
# $1 is the name of the disk drive