def build!(params)
self.scripts.each do |name, path|
case name
when "pre-install"
safesystem("cp #{path} ./preinstall")
File.chmod(0755, "./preinstall")
when "post-install"
safesystem("cp #{path} ./postinstall")
File.chmod(0755, "./postinstall")
when "pre-uninstall"
raise FPM::InvalidPackageConfiguration.new(
"pre-uninstall is not supported by Solaris packages"
)
when "post-uninstall"
raise FPM::InvalidPackageConfiguration.new(
"post-uninstall is not supported by Solaris packages"
)
end
end
Dir.mkdir("data")
safesystem("gzip -d data.tar.gz");
Dir.chdir("data") do
safesystem("tar -xf ../data.tar");
end
File.open("Prototype", "w") do |prototype|
prototype.puts("i pkginfo")
prototype.puts("i preinstall") if self.scripts["pre-install"]
prototype.puts("i postinstall") if self.scripts["post-install"]
IO.popen("pkgproto data=/").each_line do |line|
type, klass, path, mode, user, group = line.split
user = "root"
group = "root"
prototype.puts([type, klass, path, mode, user, group].join(" "))
end
end
safesystem("pkgmk -o -d .")
safesystem("pkgtrans -s . #{params[:output]} #{name}")
end