Chromium Code Reviews| Index: chromeos-setimage |
| diff --git a/chromeos-setimage b/chromeos-setimage |
| index d1be3321a64ccc6f4ffdede1fba95268a1ac3457..dbaadc399692572659aeb01419ec4d8fc32179c1 100755 |
| --- a/chromeos-setimage |
| +++ b/chromeos-setimage |
| @@ -115,19 +115,23 @@ KERN_LOOP= |
| cleanup_loop() { |
| local dev="$1" |
| + local cleanup_command="$2" |
| if [ -z "$dev" ]; then |
| return 0 |
| fi |
| - (sudo umount "$dev" || true) |
| + if [ -n "$cleanup_command" ]; then |
| + (sudo "$cleanup_command" "$dev" || true) |
| + fi |
| (sudo losetup -d "$dev" || true) |
| } |
| cleanup() { |
| - cleanup_loop "${ESP_LOOP}" |
| + # Currently only ESP may be mounted. KERN and ROOT are never mounted. |
| + cleanup_loop "${ESP_LOOP}" "umount" |
| ESP_LOOP= |
| - cleanup_loop "${KERN_LOOP}" |
| + cleanup_loop "${KERN_LOOP}" "" |
|
Will Drewry
2010/11/18 09:20:15
Do you need to specify empty $2s here?
Hung-Te
2010/11/18 09:49:02
Although it may be not necessary, I think an expli
|
| KERN_LOOP= |
| - cleanup_loop "${ROOT_LOOP}" |
| + cleanup_loop "${ROOT_LOOP}" "" |
| ROOT_LOOP= |
| # Failing to clean this up isn't the worst. |