Bug 533528 - If fennec is running, updates cause profile loss. r=mfinkle
authorDoug Turner <dougt@mozilla.com>
Tue, 15 Dec 2009 00:23:55 -0800
changeset 65914 66dfa558bf860292005b22b4d8d98f4a94a7f770
parent 65913 82053541700d7031a24f12380fbae45294e6b6db
child 65915 35bb87f12acccdc328982f1d0080674d64a10a52
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs533528
Bug 533528 - If fennec is running, updates cause profile loss. r=mfinkle
mobile/build.mk
mobile/installer/Makefile.in
mobile/installer/debian/fennec.preinst.in
mobile/installer/debian/fennec.prerm.in
mobile/makefiles.sh
--- a/mobile/build.mk
+++ b/mobile/build.mk
@@ -62,14 +62,17 @@ ifeq ($(OS_ARCH),WINCE)
 else
 	@$(MAKE) -C mobile/installer
 endif
 
 install::
 	@echo "Mobile can't be installed directly."
 	@exit 1
 
+deb: package
+	@$(MAKE) -C mobile/installer deb
+
 upload::
 	@$(MAKE) -C mobile/installer upload
 
 ifeq ($(OS_TARGET),Linux)
 deb: installer
 endif
--- a/mobile/installer/Makefile.in
+++ b/mobile/installer/Makefile.in
@@ -105,17 +105,17 @@ else
 	@echo "Using system xulrunner..."
 endif
 
 ifeq ($(OS_TARGET),Linux)
 debian/control: $(srcdir)/debian/control.in $(LIBXUL_DIST)/bin/platform.ini
 	mkdir -p debian
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
         $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
-	
+
 debian/$(MOZ_APP_NAME).desktop: $(srcdir)/debian/$(MOZ_APP_NAME).desktop.in
 	mkdir -p debian
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
         $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
 
 debian/$(MOZ_APP_NAME).links: $(srcdir)/debian/$(MOZ_APP_NAME).links.in
 	mkdir -p debian
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
new file mode 100644
--- /dev/null
+++ b/mobile/installer/debian/fennec.preinst.in
@@ -0,0 +1,26 @@
+#! /bin/sh
+
+set -e
+
+RUNNING=`ps -ax | grep "fennec.*/fennec" | grep -v grep | wc -l`
+
+if [ $RUNNING -gt 0 ];
+then
+  dbus-send --system --type=method_call --dest=mozilla.fennec  /mozilla/fennec/request mozilla.fennec.quit
+  x=0
+  while [ $x -lt 10 ]
+  do
+    sleep 1
+    RUNNING=`ps -ax | grep "fennec.*/fennec" | grep -v grep | wc -l`
+
+    if [ $RUNNING -eq 0 ];
+    then
+      break
+    fi
+
+    x=`expr $x + 1`
+  done
+
+  pkill -9 fennec
+  sleep 1
+fi
new file mode 100644
--- /dev/null
+++ b/mobile/installer/debian/fennec.prerm.in
@@ -0,0 +1,26 @@
+#! /bin/sh
+
+set -e
+
+RUNNING=`ps -ax | grep "fennec.*/fennec" | grep -v grep | wc -l`
+
+if [ $RUNNING -gt 0 ];
+then
+  dbus-send --system --type=method_call --dest=mozilla.fennec  /mozilla/fennec/request mozilla.fennec.quit
+  x=0
+  while [ $x -lt 10 ]
+  do
+    sleep 1
+    RUNNING=`ps -ax | grep "fennec.*/fennec" | grep -v grep | wc -l`
+
+    if [ $RUNNING -eq 0 ];
+    then
+      break
+    fi
+
+    x=`expr $x + 1`
+  done
+
+  pkill -9 fennec
+  sleep 1
+fi
--- a/mobile/makefiles.sh
+++ b/mobile/makefiles.sh
@@ -53,9 +53,11 @@ mobile/locales/Makefile
 mobile/Makefile
 mobile/themes/hildon/Makefile
 mobile/themes/Makefile
 mobile/themes/wince/Makefile
 mobile/installer/debian/changelog
 mobile/installer/debian/compat
 mobile/installer/debian/files
 mobile/installer/debian/menu
+mobile/installer/debian/fennec.preinst
+mobile/installer/debian/fennec.prerm
 mobile/installer/debian/fennec.postinst"