The purpose of this manual is to properly document the crew command with a rundown of function and/or variable usage. Note that this manual does not include documentation of ruby functions and variables. A basic understanding of ruby, shell and Linux is a prerequisite for package development.
#
's are used as placeholders/wild-cards within this Manual.
Chromebrew is a third-party package manager that interacts with ChromeOS using the shell
and ruby
programming languages. The crew
command provided by Chromebrew implements a simple means to install and maintain packages native to the operating system using scripts found in /usr/local/lib/crew/packages
. Each script contains the instructions to build and install a package. The crew
command can also be used to update and remove packages.
The crew build life-cycle consists of the stages as follows:
fetch
- During the fetch phasecrew
usescurl --ssl
to fetch the packageextract
- Once the the package has been fetched,crew
extracts the packageself.prebuild
- Onlysed
commands should be run during this stage - if provided- During this stage
crew
cd
's into the extracted directory, and stays there until thepreinstall
stage
- During this stage
self.patch
- Onlypatch
commands should be used during this stage - If providedself.build
- Package is compiled and/or configuredself.check
- Package is then checked - If providedself.preinstall
- Pre-install checks/edits are done - If providedself.install
- Commands to install to#{CREW_DEST_DIR}
are run- ONLY required function
self.postinstall
- Post-install checks/edits are done - If provided- Package
- Only binary packages call this stage
- Contents are checked and packaged, then installed to
#{CREW_PREFIX}
- Contents are checked and packaged, then installed to
- Only binary packages call this stage
Binary packages follow a different set of rules then source packages.
crew build
is used to build binaries Only the functionsself.preinstall
andself.postinstall
are run during a binary package install.crew
requires a few things to exist in the archive in order to install a binary package.
dlist
a list of directories used/installed to by the packagefilelist
a list of all files included in the package
The required package variables are as follows: - Rundown
class # < Package
- The#
must be name of the name of your package . It must start with a capital and be the same as the filename. (#.rb
)description
- Is the description of the package.homepage
- Is the homepage of the package.version
- Is the package version.compatibility
- Which architectures the package can operate on.source_url
Is the URL where the source package can be found.Moresource_sha256
- The checksum for the package which will be downloaded from thesource_url
.
Preset constants are shown below:
Most of these constants can displayed using the
crew const
command
#{CREW_PREFIX}
- The prefix used bycrew
- Equal to/usr/local
#{CREW_LIB_PREFIX}
- TheLIB
prefix used bycrew
- Equal to#{CREW_PREFIX}/lib
-#{CREW_PREFIX}/lib64
onamd64
#{CREW_DEST_DIR}
- TheDESTDIR
variable used bycrew
- Equal to#{CREW_PREFIX}/tmp/crew/dest
#{CREW_DEST_PREFIX}
- TheDESTDIR
variable prefix used bycrew
- Equal to#{CREW_DEST_DIR}/usr/local
#{CREW_OPTIONS}
- The preset options for./congifure
- Equals#{CREW_MAN_PREFIX}
- Useful for building man pages - Equal to#{CREW_PREFIX}/share/man
#{CREW_DEST_LIB_PREFIX}
- TheDESTDIR
LIB
prefix - Equal to#{CREW_DEST_PREFIX}/lib
-#{CREW_DEST_PREFIX}/lib64
onamd64
#{CREW_DEST_HOME}
- TheDESTDIR
home variable - Equal to#{CREW_DEST}/#{HOME}
#{HOME}
- Variable used bycrew
for$HOME
#{ARCH}
- Variable used bycrew
for$(arch)
#{CREW_NPROC}
- Variable used bycrew
for$(nproc)
Required functions are as follows: - Rundown
def self.build
- Contains commands used to build/compile the software.def self.install
- Should be used for# install
but is not required to be defined. - [Rundown]
Optional functions are as follows:
self.prebuild
- Can be used to define functions(Or commands) that should be used to edit various files.def self.patch
- Can be used to define functions(Or commands) that should be used topatch
various files.def self.preinstall
- Can be used to define functions(Or commands) that should happenpre
-install.def self.check
- Can be used to define functions(Or commands) that should be used to check the compile binary.def self.postinstall
- Can be used to define functions(Or commands) that should happenpost
-install.is_fake
- Can be used to label package as meta.
The rundown of what each function and variable are/(can be) used for follows.
A simple example ruby script can be found on the Wiki.
require 'package' # must occur within each `.rb`
# Notice the newline
class Template < Package # Notice the capitals, EG: 'I3' - would be used for an 'i3' package
description 'The template script' # Notice the indent, should contain no more than one line of text
homepage '#' # Notice the same indent, EG: 'https://i3wm.org/' - Would be used for an 'i3' Package
version 'version#-revision#' # EG: 4.18.2-1 - Where '4.18.2' is the version and '1' is the revision - Omit revision on new packages
compatibility '#' # Can contain 'all', or a list of supported architectures each separated by a space
source_url '#' # The URL from which the source of the package can be downloaded
source_sha256 '#' # The `sha256` checksum of the downloaded source package
# Notice the newline
depends_on '#' # Soft where this package depends on
depends_on '#' => :build # Only required when the package
is built from source
# Notice the newline
def self.preflight # For preflight checks, not required
system '#' # Replace '#' with a disk space check, for example
end
def self.prebuild # For sed operations, not required
system '#' # Replace '#' with a sed operation
end
def self.patch # For patch operations, not required
system '#' # Replace '#' with a patch operation
end
def self.build # Contains the commands which compile the package, required if package con be compiled
system '#' # Replace '#' with commands to compile the package
system '#' # Should contain something like, "./configure --prefix=/usr/local"
system '#' # Use in case additions commands are required
system '#' # Should contain something like, "'make -j$(nproc)'"
end
def self.check # For commands to check the build quality, called by 'crew build'
system '#'
end
def self.preinstall # For pre-install conditions, not required
system '#'
end
def self.install # For make install, required if package can be installed
system '#' # Should contain something like, "'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'"
end
def self.postinstall # For post-install messages or operations, not required
system '#'
end
end
Arch: Chromebrew packages for x86_64
, i686
, armv7l
, and aarch64
.
More: Must come from an official source, not a distro's source archive. Should contain the version number(Which must be equal to the version variable) https
is preferred over http
or ftp
- When possible.
NOTE: All rules can have exceptions, if REQUIRED, exceptions to the rules should be avoided at all costs.
CREW_OPTIONS
: Equal to --prefix=/usr/local --libdir=/usr/local/lib --mandir=/usr/local/share/man --build=armv7l-cros-linux-gnueabihf --host=armv7l-cros-linux-gnueabihf --target=#{CREW_BUILD}
Any additionally required resources for ChromeOS or ChromeBooks can be found here
Still can't find something? Have a look in Issues
Or post a issue
This Manual is heavily based off void-packages/Manual.md