blob: 75507baca2735ef410544c611e341ad187fb5fbf [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Package seal implements the `pm seal` command
package seal
import (
"flag"
"fmt"
"os"
"path/filepath"
"go.fuchsia.dev/fuchsia/src/sys/pkg/bin/pm/build"
)
const usage = `Usage: %s seal
seal package metadata into a meta.far
`
// Run archives the meta/ directory into meta.far.
func Run(cfg *build.Config, args []string) error {
fs := flag.NewFlagSet("seal", flag.ExitOnError)
fs.Usage = func() {
fmt.Fprintf(os.Stderr, usage, filepath.Base(os.Args[0]))
fmt.Fprintln(os.Stderr)
fs.PrintDefaults()
}
if err := fs.Parse(args); err != nil {
return err
}
if len(fs.Args()) != 0 {
fmt.Fprintf(os.Stderr, "WARNING: unused arguments: %s\n", fs.Args())
}
_, err := build.Seal(cfg)
return err
}