require 'shellwords'
require 'tmpdir'
require 'yaml'
+require 'json'
class SyncDirDef
DEFAULT_EXCLUDE = %w[/proc/* /sys/* /dev/mqueue /dev/hugepages /run/* /var/lib/os-prober/mount /swap /dev/shm/* /var/lib/lxcfs/*]
end
end
+ def write_json
+ jdef = []
+ dirs.each_with_index do |dir, idx|
+ jdef.push({
+ "Description" => dir.path == '/' ? 'root' : dir.path[1..-1].tr('/', '-'),
+ "Format" => "raw",
+ "UserBucket" => {
+ "S3Bucket" => "Change-to-your-buket-name",
+ "S3Key" => "/src-disks/#{img_path_base}_#{idx}.img"
+ }
+ })
+ end
+ File.write "#{img_path_base}.json", JSON.pretty_generate(jdef)
+ end
+
+
def run
create_disk
create_fs
sync_dirs
fix_boot
+ write_json
puts "Image creation has been complated (#{name})"
end
-
end
if $0 == __FILE__