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 1226 8f974f8f02198687dddb48884d0da065b6784cb7
parent 1225 7b6427524b8ce4726e7414370dffe5cc870b8052
child 1227 23ef409d62cf707f6b664ff7d934066a789d785c
push id1090
push userdougt@mozilla.com
push dateMon, 14 Dec 2009 20:27:06 +0000
reviewersmfinkle
bugs533528
Bug 533528 - If fennec is running, updates cause profile loss. r=mfinkle
build.mk
installer/Makefile.in
installer/debian/fennec.preinst.in
installer/debian/fennec.prerm.in
makefiles.sh
--- a/build.mk
+++ b/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/installer/Makefile.in
+++ b/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/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/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/makefiles.sh
+++ b/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"