Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Unified Diff: chromeos-setimage

Issue 5122002: installer: fix the "umount: XXX not mounted" error message during postinst (Closed) Base URL: http://git.chromium.org/git/installer.git@master
Patch Set: add sync for losetup -d after mkfs.ext3 Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos-install ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos-setimage
diff --git a/chromeos-setimage b/chromeos-setimage
index d1be3321a64ccc6f4ffdede1fba95268a1ac3457..bc8e9e9e3fcae3364395751e2a5b6efc0016fd4e 100755
--- a/chromeos-setimage
+++ b/chromeos-setimage
@@ -113,21 +113,29 @@ ESP_LOOP=
ROOT_LOOP=
KERN_LOOP=
+# Cleans up a device and unmount if required.
cleanup_loop() {
local dev="$1"
- if [ -z "$dev" ]; then
+ local need_umount="$2"
+ if [ -z "${dev}" ]; then
return 0
fi
- (sudo umount "$dev" || true)
- (sudo losetup -d "$dev" || true)
+ if [ ${need_umount} -eq ${FLAGS_TRUE} ]; then
+ sudo umount -d "${dev}" || true
+ elif [ ${need_umount} -eq ${FLAGS_FALSE} ]; then
+ sudo losetup -d "${dev}" || true
+ else
+ echo "INTERNAL ERROR: unknown parameter for cleanup_loop: ${need_umount}" >&2
+ fi
}
cleanup() {
- cleanup_loop "${ESP_LOOP}"
+ # Currently only ESP may be mounted. KERN and ROOT are never mounted.
+ cleanup_loop "${ESP_LOOP}" "${FLAGS_TRUE}"
ESP_LOOP=
- cleanup_loop "${KERN_LOOP}"
+ cleanup_loop "${KERN_LOOP}" "${FLAGS_FALSE}"
KERN_LOOP=
- cleanup_loop "${ROOT_LOOP}"
+ cleanup_loop "${ROOT_LOOP}" "${FLAGS_FALSE}"
ROOT_LOOP=
# Failing to clean this up isn't the worst.
« no previous file with comments | « chromeos-install ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698