Skip to content

Commit

Permalink
add scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rustysys-dev committed Oct 13, 2024
1 parent 27cbbf7 commit a5521a0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
10 changes: 9 additions & 1 deletion builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
)

type Builder struct {
rpmpack.RPMMetaData
BinDir string
DistDir string
rpmpack.RPMMetaData
Scripts Scripts
Files []PackageFile
}

Expand Down Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions scripts.go
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit a5521a0

Please sign in to comment.