mirror of
https://github.com/goreleaser/nfpm
synced 2024-06-10 06:16:12 +02:00
2210695091
Implements #507. * Adds ipk support for keywords used by OpenWRT and Yocto. * MD5sum is explicitly excluded due to insecurity. * SHA256Sum excluded due packages not being individually signed, instead, the feed of packages is checksummed and signed externally. * Adds code to nfpm package to automatically enumerate the supported packaging types where possible.
60 lines
1.5 KiB
Go
60 lines
1.5 KiB
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
goversion "github.com/caarlos0/go-version"
|
|
_ "github.com/goreleaser/nfpm/v2/apk" // apk packager
|
|
_ "github.com/goreleaser/nfpm/v2/arch" // archlinux packager
|
|
_ "github.com/goreleaser/nfpm/v2/deb" // deb packager
|
|
_ "github.com/goreleaser/nfpm/v2/ipk" // ipk packager
|
|
_ "github.com/goreleaser/nfpm/v2/rpm" // rpm packager
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func Execute(version goversion.Info, exit func(int), args []string) {
|
|
newRootCmd(version, exit).Execute(args)
|
|
}
|
|
|
|
type rootCmd struct {
|
|
cmd *cobra.Command
|
|
exit func(int)
|
|
}
|
|
|
|
func (cmd *rootCmd) Execute(args []string) {
|
|
cmd.cmd.SetArgs(args)
|
|
|
|
if err := cmd.cmd.Execute(); err != nil {
|
|
fmt.Println(err.Error())
|
|
cmd.exit(1)
|
|
}
|
|
}
|
|
|
|
func newRootCmd(version goversion.Info, exit func(int)) *rootCmd {
|
|
root := &rootCmd{
|
|
exit: exit,
|
|
}
|
|
cmd := &cobra.Command{
|
|
Use: "nfpm",
|
|
Short: "Packages apps on RPM, Deb, APK, Arch Linux, and ipk formats based on a YAML configuration file",
|
|
Long: `nFPM is a simple and 0-dependencies apk, arch, deb, ipk and rpm linux packager written in Go.`,
|
|
Version: version.String(),
|
|
SilenceUsage: true,
|
|
SilenceErrors: true,
|
|
Args: cobra.NoArgs,
|
|
ValidArgsFunction: cobra.NoFileCompletions,
|
|
}
|
|
cmd.SetVersionTemplate("{{.Version}}")
|
|
|
|
cmd.AddCommand(
|
|
newInitCmd().cmd,
|
|
newPackageCmd().cmd,
|
|
newDocsCmd().cmd,
|
|
newManCmd().cmd,
|
|
newSchemaCmd().cmd,
|
|
)
|
|
|
|
root.cmd = cmd
|
|
return root
|
|
}
|