Merge "Allow empty zip file in extra files in install command." into tm-dev
diff --git a/android/makevars.go b/android/makevars.go
index ece7091..a74185a 100644
--- a/android/makevars.go
+++ b/android/makevars.go
@@ -472,7 +472,8 @@
 			fmt.Fprintf(buf, "\tchmod +x $@\n")
 		}
 		if extraFiles := install.extraFiles; extraFiles != nil {
-			fmt.Fprintf(buf, "\tunzip -qDD -d '%s' '%s'\n", extraFiles.dir.String(), extraFiles.zip.String())
+			fmt.Fprintf(buf, "\t( unzip -qDD -d '%s' '%s' 2>&1 | grep -v \"zipfile is empty\"; exit $${PIPESTATUS[0]} ) || \\\n", extraFiles.dir.String(), extraFiles.zip.String())
+			fmt.Fprintf(buf, "\t  ( code=$$?; if [ $$code -ne 0 -a $$code -ne 1 ]; then exit $$code; fi )\n")
 		}
 		fmt.Fprintln(buf)
 	}
diff --git a/android/module.go b/android/module.go
index ab68e24..7285a2f 100644
--- a/android/module.go
+++ b/android/module.go
@@ -3208,8 +3208,9 @@
 
 			extraCmds := ""
 			if extraZip != nil {
-				extraCmds += fmt.Sprintf(" && unzip -qDD -d '%s' '%s'",
+				extraCmds += fmt.Sprintf(" && ( unzip -qDD -d '%s' '%s' 2>&1 | grep -v \"zipfile is empty\"; exit $${PIPESTATUS[0]} )",
 					extraZip.dir.String(), extraZip.zip.String())
+				extraCmds += " || ( code=$$?; if [ $$code -ne 0 -a $$code -ne 1 ]; then exit $$code; fi )"
 				implicitDeps = append(implicitDeps, extraZip.zip)
 			}