Browse files

Detect prior install with .installed and not $SOURCE_DIR/

Before this change, after installation there was both
$SOURCE_DIR/ and $INSTALL_DIR/, and both
potentially containing sensitive information like passwords. The only
purpose of the former was to detect whether a Critic installation had
been done earlier from $SOURCE_DIR or not ( would then
suggest using instead) and no actual data needed to be in
the file. This change introduces a new, empty, file called
$SOURCE_DIR/.installed which will be used instead to abort
and suggest
  • Loading branch information...
mo committed Jul 15, 2013
1 parent ac3e9d8 commit c979a9acc832039a1da8bc898db8f091ad07f2a1
Showing with 6 additions and 5 deletions.
  1. +1 −0 .gitignore
  2. +4 −4
  3. +1 −1
@@ -1,4 +1,5 @@
@@ -80,9 +80,9 @@
arguments = parser.parse_args()
-if os.path.exists(os.path.join(installation.root_dir, "")):
+if os.path.exists(os.path.join(installation.root_dir, ".installed")):
print """
-ERROR: Found an file in the directory you're installing from.
+ERROR: Found an .installed file in the directory you're installing from.
This typically means that Critic is already installed on this system, and if so
then the script should be used to upgrade the installation rather than
@@ -152,8 +152,8 @@ def abort():
- with open(os.path.join(installation.root_dir, ""), "w") as install_data:
- json.dump(data, install_data)
+ with open(os.path.join(installation.root_dir, ".installed"), "w") as installed:
+ pass
for module in installation.modules:
@@ -155,7 +155,7 @@ def main():
# trickier to know if the user really wants to delete empty parent dirs.
rmdir_if_empty(["/var/log/critic", "/var/run/critic", "/var/cache/critic"])
- run_command(arguments, ["rm", "-f", os.path.join(installation.root_dir, "")])
+ run_command(arguments, ["rm", "-f", os.path.join(installation.root_dir, ".installed")])
print "SUCCESS: Uninstall complete."

0 comments on commit c979a9a

Please sign in to comment.