From 99de6f801fca0595ab132c59b25e74a9f288ac1f Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 1 Feb 2016 00:48:43 +0100 Subject: [PATCH] Do not backup files in install if the same is already in fs. --- app/models/package.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/package.rb b/app/models/package.rb index fb82af66a..620495f86 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -403,8 +403,13 @@ returns def self._write_file(file, permission, data) location = "#{@@root}/#{file}" - # rename existing file + # rename existing file if not already the same file if File.exist?(location) + content_fs = _read_file(file) + if content_fs == data + logger.debug "NOTICE: file '#{location}' already exists, skip install" + return true + end backup_location = location + '.save' logger.info "NOTICE: backup old file '#{location}' to #{backup_location}" File.rename(location, backup_location)