diff --git a/builder.go b/builder.go index 191ede9..4a96a37 100644 --- a/builder.go +++ b/builder.go @@ -13,9 +13,10 @@ import ( ) type Builder struct { - rpmpack.RPMMetaData BinDir string DistDir string + rpmpack.RPMMetaData + Scripts Scripts Files []PackageFile } @@ -118,6 +119,13 @@ func (b *Builder) Package() error { } } + r.AddPretrans(b.Scripts.PreTransact) + r.AddPosttrans(b.Scripts.PostTransact) + r.AddPrein(b.Scripts.PreInstall) + r.AddPostin(b.Scripts.PostInstall) + r.AddPreun(b.Scripts.PreUninstall) + r.AddPostun(b.Scripts.PostUninstall) + // TODO: need to verify before write? if err := r.Write(out); err != nil { return err diff --git a/scripts.go b/scripts.go new file mode 100644 index 0000000..784047f --- /dev/null +++ b/scripts.go @@ -0,0 +1,13 @@ +package rpmbuild + +// Scripts are shell (/bin/sh) executable commands and not a filename +// +// TODO: add post processing if necessary... +type Scripts struct { + PreTransact string + PostTransact string + PreInstall string + PostInstall string + PreUninstall string + PostUninstall string +}