Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-doc
Path: blob/main/documentation/tools/global-pgpkeys-creator.rb
18081 views
1
#!/usr/bin/env ruby
2
3
=begin
4
5
BSD 2-Clause License
6
Copyright (c) 2020-2026, The FreeBSD Project
7
Copyright (c) 2020-2026, Sergio Carlavilla <[email protected]>
8
9
This script will merge all the pgpkeys into one single file
10
11
=end
12
13
def getAllPGPKeys()
14
return Dir.glob('./static/pgpkeys/*.key').sort
15
end
16
17
def processAllPGPKeys(keysFiles, pgpKeysFile)
18
keysFiles.each{ |keyFile|
19
processPGPKey(keyFile, pgpKeysFile)
20
}
21
end
22
23
def processPGPKey(keyFile, pgpKeysFile)
24
File.readlines(keyFile).each do |line|
25
if # remove script comment and AsciiDoc syntax
26
not line.include? "// sh addkey.sh" and
27
not line.include? "[.literal-block-margin]" and
28
not line.include? "...."
29
pgpKeysFile.puts(line)
30
end
31
end
32
end
33
34
# Main method
35
keysFiles = getAllPGPKeys()
36
37
pgpKeysFile = File.new("./static/pgpkeys/pgpkeys.txt", "w")
38
39
processAllPGPKeys(keysFiles, pgpKeysFile)
40
41