blob: e03d84517c9f6d55d9f6e08ab52faaed1b5c34e8 [file] [log] [blame]
// Copyright 2019 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.
// +build !build_with_native_toolchain
// The Fuchsia Go Grand Unified Binary is a binary that contains several other
// binaries, so done in order to reduce the amount of disk space and shared
// memory required to run Fuchsia subsystems written in Go. This combination
// saves >=50% of storage and ram cost on a running system at boot/update time.
package main
import (
func main() {
// The new fuchsia build templates do not support renaming a binary and properly
// including its dependent libraries in a package. As a workaround, we leave the
// binary name untouched and check the second argument if the first argument is
// the default binary name.
// TODO( Remove this workaround.
if len(os.Args) != 0 && filepath.Base(os.Args[0]) == "grand_unified_binary" {
os.Args[0] = ""
os.Args = os.Args[1:]
if len(os.Args) < 1 {
log.Println("software delivery grand unified binary: cannot determine binary, no argv 0")
name := filepath.Base(os.Args[0])
name = strings.SplitN(name, ".", 2)[0]
switch name {
case "pkgsvr":
case "amberctl", "amber_ctl":
case "netstack":
case "ifconfig":
log.Printf("software delivery grand unified binary: unknown inner binary name: %s (%s)", name, os.Args[0])