os/makeinitrd.rb

15 lines
338 B
Ruby
Raw Normal View History

2019-02-09 12:52:45 -06:00
folder=ARGV[0]
output=ARGV[1]
outf=File.open(output,"w")
for name in Dir.glob("#{folder}/*")
name=File.basename(name)
contents=File.read("#{folder}/#{name}")
outf.print [name.length].pack("L")
outf.print name
outf.print "\0"
outf.print [contents.length].pack("L")
outf.print contents
end
outf.print [0].pack("L")
outf.close