goes

package module
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2019 License: GPL-2.0, GPL-2.0-or-later Imports: 22 Imported by: 4

README

When imported by a machine main, package goes provides a monolithic embedded distro for Linux systems,

How is this pronounced?

We prefer "go e-s", aka. "go e[mbedded]-s[ystem]".

How is it monlithic?

The Live CD of most Linux distributions is an assembly of binary packages and base configuration. It may also include a guided self installer that copies its contents to the target along with other network acquired packages. These binary packages are built from interdependent source packages by a maintainer.

With goes, the package assembly, base configuration, and interdependency is handled by go build. The result is a single, thus monolithic, program including all of the commands that the maintainer intends to support on the target machine. This may include a guided self installer that, generally, doesn't require network install of anything else.

Alternatively, goes may run as a self-spawning daemons and interactive sub- commands within a minimal Linux distribution.

What are machines?

Machines are main packages that provide a goes command manifest, configuration, and customization before calling Goes.Main(). See https://github.com/platinasystems/goes-MACHINE for examples.

These machines are available at https://github.com/platinasystems/,

Most machines are built with just go build but some, like the bmc, may also use goes-build to build a properly configured kernel and embed itself as an initrd.

To install,

$ sudo ./goes-MACHINE install
...

To stop and remove,

$ sudo goes uninstall

To enable BASH completion after install,

. /usr/share/bash-completion/completions/goes

To run commands without install,

$ ./goes-MACHINE COMMAND [ARGS]...
...

To see the commands available on the installed MACHINE,

$ goes help

Or,

$ goes
goes> help

Then man any of the listed commands or man cli to see how to use the command line interface.

To debug,

$ gdb ./goes-MACHINE

Each goes/cmd provides apropos, completion, man, and usage. The command may also provide context sensitive help, README, and godoc.

See also errata.


© 2015-2019 Platina Systems, Inc. All rights reserved. Use of this source code is governed by this BSD-style LICENSE.

Documentation

Overview

Package goes, combined with a compatibly configured Linux kernel, provides a monolithic embedded system.

Index

Constants

View Source
const (
	VerboseQuiet = iota
	VerboseVerify
	VerboseDebug
)
View Source
const Version = "v1.4.0"

Version format :: v<MAJOR>.<MINOR>.<PATCH>[-rc<CANDIDATE>]

Variables

This section is empty.

Functions

func Replace

func Replace(s, name string) string

func Usage

func Usage(v Usager) string

Types

type Blocker

type Blocker interface {
	Block(*Goes, shellutils.List) (*shellutils.List, func(io.Reader, io.Writer, io.Writer, bool, bool) error, error)
}

type Function

type Function struct {
	Name       string
	Definition []string
	RunFun     func(stdin io.Reader, stdout io.Writer, stderr io.Writer, isFirst bool, isLast bool) error
}

type Goes

type Goes struct {
	// These uppercased fields may/should be assigned at instantiation
	NAME, USAGE  string
	APROPOS, MAN lang.Alt

	ByName map[string]cmd.Cmd

	Catline func(string) (string, error)

	Status    error
	Verbosity int

	EnvMap map[string]string

	FunctionMap map[string]Function
	// contains filtered or unexported fields
}

func (*Goes) Apropos

func (g *Goes) Apropos() lang.Alt

func (*Goes) Builtins

func (g *Goes) Builtins() map[string]func(...string) error

func (*Goes) Complete

func (g *Goes) Complete(args ...string) (completions []string)

func (*Goes) Fork

func (g *Goes) Fork(args ...string) *exec.Cmd

Fork returns an exec.Cmd ready to Run or Output this program with the given args.

func (*Goes) Goes

func (g *Goes) Goes(parent *Goes)

func (*Goes) Help

func (g *Goes) Help(args ...string) string

func (*Goes) Main

func (g *Goes) Main(args ...string) error

Run a command in the current context.

If len(args) == 1 and args[0] doesn't match a mapped command, this will run the "cli".

If the args has "-help", or "--help", this runs ByName("help").Main(args...) to print text.

Similarly for "-apropos", "-complete", "-man", and "-usage".

If the command is a daemon, this fork exec's itself twice to disassociate the daemon from the tty and initiating process.

func (*Goes) MakeListFunc

func (g *Goes) MakeListFunc(pipeline []piperun) (func(stdin io.Reader, stdout io.Writer, stderr io.Writer) error, error)

func (*Goes) MakePipefun

func (g *Goes) MakePipefun(pipeline []func(io.Reader, io.Writer, io.Writer, bool, bool) error, closers *[]io.Closer) (func(io.Reader, io.Writer, io.Writer) error, error)

func (*Goes) Man

func (g *Goes) Man() lang.Alt

func (*Goes) Names

func (g *Goes) Names() []string

func (*Goes) Path

func (g *Goes) Path() []string

set Path of sub-goes. e.g. "ip address"

func (*Goes) ProcessCommand

func (g *Goes) ProcessCommand(cl shellutils.Cmdline, closers *[]io.Closer) (func(stdin io.Reader, stdout io.Writer, stderr io.Writer, isFirst bool, isLast bool) error, error)

func (*Goes) ProcessList

func (g *Goes) ProcessList(ls shellutils.List) (*shellutils.List, *shellutils.Word, func(stdin io.Reader, stdout io.Writer, stderr io.Writer) error, error)

func (*Goes) ProcessPipeline

func (g *Goes) ProcessPipeline(ls shellutils.List) (*shellutils.List, *shellutils.Word, func(io.Reader, io.Writer, io.Writer) error, error)

func (*Goes) String

func (g *Goes) String() string

func (*Goes) Usage

func (g *Goes) Usage() string

type Usager

type Usager interface {
	Usage() string
}

Directories

Path Synopsis
cmd
cat
cd
cli
cli/internal/liner
Package liner is a wrapper to Peter Harris' <pharris@opentext.com> "Go line editor" <github.com:peterh/liner>.
Package liner is a wrapper to Peter Harris' <pharris@opentext.com> "Go line editor" <github.com:peterh/liner>.
cli/internal/notliner
Package notliner provides an alternative command.Prompter for shell scripts and tty's unsupported by liner.
Package notliner provides an alternative command.Prompter for shell scripts and tty's unsupported by liner.
cp
dhcpcd
Package dhcpcd is a simple dhcp client
Package dhcpcd is a simple dhcp client
env
gpio
Package gpio provides cli command to query/configure GPIO pins.
Package gpio provides cli command to query/configure GPIO pins.
i2c
Package i2c provides cli command to access i2c devices.
Package i2c provides cli command to access i2c devices.
i2cd
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
install
Package install provides the named command that installs this executable to /usr/bin/NAME; creates /etc/init.d/NAME and /etc/default/goes; then a bunch of other stuff.
Package install provides the named command that installs this executable to /usr/bin/NAME; creates /etc/init.d/NAME and /etc/default/goes; then a bunch of other stuff.
ip
ip/internal/group
Cache parse of /etc/iproute2/group
Cache parse of /etc/iproute2/group
ip/route/show
ip route show (default) | flush | get | save | restore
ip route show (default) | flush | get | save | restore
ipmigod
Package ipmigod provides an IPMI protocol daemon.
Package ipmigod provides an IPMI protocol daemon.
ipmigod/internal
Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec implementation Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec implementation Package contains IPMI 2.0 spec protocol definitions
Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec implementation Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec protocol definitions Package contains IPMI 2.0 spec implementation Package contains IPMI 2.0 spec protocol definitions
ln
log
ls
platina/mk1/bmc/ledgpiod
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk1/bmc/ucd9090d
Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk1/bmc/upgrade
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk1/toggle
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk2/lc1/bmc/ledgpiod
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk2/lc1/bmc/ucd9090d
Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk2/lc1/bmc/upgrade
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk2/mc1/bmc/ledgpiod
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk2/mc1/bmc/ucd9090d
Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip Package ucd9090d provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk2/mc1/bmc/upgrade
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
platina/mk2/toggle
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
Package ucd9090 provides access to the UCD9090 Power Sequencer/Monitor chip
ps
pwd
redisd
Package redisd provides a redis server daemon that is started by /sbin/init or /usr/sbin/goesd *before* all other daemons.
Package redisd provides a redis server daemon that is started by /sbin/init or /usr/sbin/goesd *before* all other daemons.
reload
Package reload provides the named command that sends SIGHUP to all of the daemons associated with this executable.
Package reload provides the named command that sends SIGHUP to all of the daemons associated with this executable.
rm
start
Package start provides the named command that runs a redis server followed by all of the configured daemons.
Package start provides the named command that runs a redis server followed by all of the configured daemons.
stop
Package stop provides the named command that kills all of the daemons associated with this executable.
Package stop provides the named command that kills all of the daemons associated with this executable.
telnetd
This telnet daemon is only run from an embedded machine's /init, not /usr/bin/goes start
This telnet daemon is only run from an embedded machine's /init, not /usr/bin/goes start
test/sleeper
Package sleeper provides a test ticker daemon.
Package sleeper provides a test ticker daemon.
uninstall
Package uninstall provides the named command that stops and removes /usr/bin/goes and it's associated files.
Package uninstall provides the named command that stops and removes /usr/bin/goes and it's associated files.
uptimed
Package uptimed publishes the system uptime every 60 seconds to the local redis server.
Package uptimed publishes the system uptime every 60 seconds to the local redis server.
watchdog
Watchdog is only run by an embedded machine's /init, not by /usr/bin/goes start
Watchdog is only run by an embedded machine's /init, not by /usr/bin/goes start
internal
assert
Package assert provides various assertions.
Package assert provides various assertions.
cmdline
Package cmdline maps /proc/cmdline
Package cmdline maps /proc/cmdline
fields
Slice a string into args while combining single, double, or backslash escaped spaced arguments, e.g.: echo hello\ beautiful\ world echo "hello 'beautiful world'" echo 'hello \"beautiful world\"'
Slice a string into args while combining single, double, or backslash escaped spaced arguments, e.g.: echo hello\ beautiful\ world echo "hello 'beautiful world'" echo 'hello \"beautiful world\"'
fit
Package fit parses Flattened Image Tree image tree blob files.
Package fit parses Flattened Image Tree image tree blob files.
flags
Package flags parses boolean options from command arguments.
Package flags parses boolean options from command arguments.
group
Package group provides an /etc/group parser.
Package group provides an /etc/group parser.
kill
Package kill provides a method to signal process groups.
Package kill provides a method to signal process groups.
nl
nocomment
Package nocomment strips a string trailing '#' prefaced comments along with its leading whitespace.
Package nocomment strips a string trailing '#' prefaced comments along with its leading whitespace.
pin
pizza
Slice args at boundary.
Slice args at boundary.
prog
Package prog provides methods that return the current program base and full name along with it's minimal PATH.
Package prog provides methods that return the current program base and full name along with it's minimal PATH.
url
Package url returns reader/writers for a given url.
Package url returns reader/writers for a given url.
Package lang provides text in alternative languages.
Package lang provides text in alternative languages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL