[tor-commits] [flashproxy/master] don't clobber secret files during post-install, and don't remove them during pre-remove

infinity0 at torproject.org infinity0 at torproject.org
Thu Nov 21 13:18:46 UTC 2013


commit 720861831e03e5a7f9cd726dd3ea73c3e7f3f376
Author: Ximin Luo <infinity0 at gmx.com>
Date:   Wed Oct 9 23:36:10 2013 +0100

    don't clobber secret files during post-install, and don't remove them during pre-remove
---
 facilitator/INSTALL     |    5 +++++
 facilitator/Makefile.am |   26 +++++++++++++++-----------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/facilitator/INSTALL b/facilitator/INSTALL
index bd47adf..345d74a 100644
--- a/facilitator/INSTALL
+++ b/facilitator/INSTALL
@@ -29,3 +29,8 @@ instructions.
 Uninstall.
 
 	# make pre-remove uninstall post-remove
+
+This will leave behind some config files (e.g. secret keys and passwords). To
+get rid of those too, run this instead:
+
+	# make pre-purge uninstall post-purge
diff --git a/facilitator/Makefile.am b/facilitator/Makefile.am
index 348bfb0..0164d76 100644
--- a/facilitator/Makefile.am
+++ b/facilitator/Makefile.am
@@ -44,8 +44,10 @@ CLEANFILES = $(initscript_SCRIPTS)
 
 pre-install: meta-install-sanity install-user
 post-install: meta-install-sanity install-secrets install-symlinks install-daemon
-pre-remove: meta-install-sanity remove-daemon remove-symlinks remove-secrets
-post-remove: meta-install-sanity remove-user
+pre-remove: meta-install-sanity remove-daemon remove-symlinks
+post-remove: meta-install-sanity
+pre-purge: pre-remove remove-secrets
+post-purge: post-remove remove-user
 
 meta-install-sanity:
 	test "x$(DESTDIR)" = "x" || { echo >&2 \
@@ -80,14 +82,16 @@ remove-user:
 	    $(fpfacilitatoruser) ; } || true
 
 install-secrets:
-	install -m 600 /dev/null $(pkgconfdir)/reg-daemon.key
-	openssl genrsa 2048 | tee $(pkgconfdir)/reg-daemon.key | \
-	openssl rsa -pubout > $(pkgconfdir)/reg-daemon.pub
-	install -m 600 /dev/null $(pkgconfdir)/reg-email.pass
-	@echo >> $(pkgconfdir)/reg-email.pass \
-	  "Replace this file's contents with your Gmail app-specific password;"
-	@echo >> $(pkgconfdir)/reg-email.pass \
-	  "see gmail-howto.txt in this package's documentation for details."
+	test -f $(pkgconfdir)/reg-daemon.key || { \
+	  install -m 600 /dev/null $(pkgconfdir)/reg-daemon.key && \
+	  openssl genrsa 2048 | tee $(pkgconfdir)/reg-daemon.key | \
+	  openssl rsa -pubout > $(pkgconfdir)/reg-daemon.pub; }
+	test -f $(pkgconfdir)/reg-email.pass || { \
+	  install -m 600 /dev/null $(pkgconfdir)/reg-email.pass && \
+	  echo >> $(pkgconfdir)/reg-email.pass \
+	  "Replace this file's contents with your Gmail app-specific password;" && \
+	  echo >> $(pkgconfdir)/reg-email.pass \
+	  "see gmail-howto.txt in this package's documentation for details."; }
 
 remove-secrets:
 	rm -f $(pkgconfdir)/reg-*
@@ -122,6 +126,6 @@ if DO_INITSCRIPTS
 	done
 endif
 
-.PHONY: pre-install post-install pre-remove post-remove
+.PHONY: pre-install post-install pre-remove post-remove pre-purge post-purge
 .PHONY: install-user install-secrets install-symlinks install-daemon
 .PHONY: remove-user remove-secrets remove-symlinks remove-daemon





More information about the tor-commits mailing list