Add all repos
This commit is contained in:
parent
faa12c60bc
commit
8a91c9b89b
369 changed files with 29047 additions and 28 deletions
34
zammad/package-auto-reinstall.patch
Normal file
34
zammad/package-auto-reinstall.patch
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
diff --git a/app/models/package.rb b/app/models/package.rb
|
||||
index 76f21fa..2915fa5 100644
|
||||
--- a/app/models/package.rb
|
||||
+++ b/app/models/package.rb
|
||||
@@ -493,4 +493,29 @@ execute all pending package migrations at once
|
||||
file.exclude?('..') && file.exclude?('%2e%2e')
|
||||
end
|
||||
private_class_method :allowed_file_path?
|
||||
+
|
||||
+ def self.auto_reinstall
|
||||
+ path = "#{@@root}/auto_install/"
|
||||
+ return if !File.exist?(path)
|
||||
+ data = []
|
||||
+ Dir.foreach(path) do |entry|
|
||||
+ if entry =~ /\.zpm/ && entry !~ /^\./
|
||||
+ data.push entry
|
||||
+ end
|
||||
+ end
|
||||
+ data.each do |file|
|
||||
+ json = _read_file("#{path}/#{file}", true)
|
||||
+ package = JSON.parse(json)
|
||||
+ installed_pkg = Package.find_by(name: package['name'])
|
||||
+ if installed_pkg.nil? or Gem::Version.new(installed_pkg.version) < Gem::Version.new(package["version"])
|
||||
+ # install new package or newer version
|
||||
+ install(string: json)
|
||||
+ elsif Gem::Version.new(installed_pkg.version) == Gem::Version.new(package["version"])
|
||||
+ # reinstall existing version
|
||||
+ install(string: json, reinstall: true)
|
||||
+ end
|
||||
+ end
|
||||
+ data
|
||||
+ end
|
||||
+
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue