Earthbound: Difference between revisions
(update page) |
(→Configuration file: add schema) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 3: | Line 3: | ||
|image=Earthbound.jpg | |image=Earthbound.jpg | ||
|by=Alexander Nicholi | |by=Alexander Nicholi | ||
|langs={{wp|Unix shell|POSIX <tt>sh</tt>}} | |langs={{wp|ANSI C}}, {{wp|Unix shell|POSIX <tt>sh</tt>}} for bootstrapping | ||
|lic=[ | |lic=[//www.gnu.org/licenses/gpl-2.0.html GPLv2 only] | ||
}}'''Earthbound''' is a network- and system-agnostic software procurement system, designed to obtain and consume software packages in various formats and manage them in concert together at once. | }}'''Earthbound''' is a network- and system-agnostic software procurement system, designed to obtain and consume software packages in various formats and manage them in concert together at once. | ||
| Line 16: | Line 16: | ||
===Configuration file=== | ===Configuration file=== | ||
Earthbound uses | Earthbound uses an INI file structure to define a collection of files of interest along with their hashes and details on where they may be found. It uses the following [//gist.github.com/nicholatian/05cae747b0d3a8928c85c12d65187ff3 INI schema]: | ||
<div class="mw-code">caseinsens<span style="color:rgba(24,24,24,0.667)">=</span>0 | |||
mscomments<span style="color:rgba(24,24,24,0.667)">=</span>0 | |||
<div class="mw-code"><span style="color:rgba(24,24,24,0.333)"># is used for comments, not ;<br/># must be at the start of a logical line<br/>	 # leading space is OK though</span><br/><span style="color:hsl(212,60%,40%)">[</span><span style="color:hsl(212,55%,55%)">file1.c</span><span style="color:hsl(212,60%,40%)">]</span><br/>sha2sum<span style="color:rgba(24,24,24,0.667)">=</span>70d181c0bebbac369cddb65e6304e55a8efdcef50589154faf30390fdc6a1427<br/><span style="color:rgba(24,24,24,0.333)"># at least one is required, but multiple may be given<br/># if so, all hashes are checked</span><br/>sha3sum<span style="color:rgba(24,24,24,0.667)">=</span>4e9e5320e30e44ff31463806d5578fbfdc9212f32d2e9dd41998d0a8aaf830c9<br/><span style="color:rgba(24,24,24,0.333)"># all of these URLs are candidates and may be tried in any order</span><br/>source<span style="color:rgba(24,24,24,0.667)">=</span>https<span></span>://www.example.com/file1.c<br/>source<span style="color:rgba(24,24,24,0.667)">=</span>https<span></span>://www.example.de/ | <span style="color:hsl(212,60%,40%)">[</span><span style="color:hsl(212,55%,55%)">file+</span><span style="color:hsl(212,60%,40%)">]</span><br/>val<span style="color:rgba(24,24,24,0.667)">=</span>^[A-Za-z0-9_][A-Za-z0-9_\-\+]*(\.[A-Za-z0-9_\-\+]+)?$<br/><br/><span style="color:hsl(212,60%,40%)">[</span><span style="color:hsl(212,55%,55%)">file:sha2sum?</span><span style="color:hsl(212,60%,40%)">]</span><br/>val<span style="color:rgba(24,24,24,0.667)">=</span>^[0-9A-Fa-f]{64}$<br/><br/><span style="color:hsl(212,60%,40%)">[</span><span style="color:hsl(212,55%,55%)">file:sha3sum?</span><span style="color:hsl(212,60%,40%)">]</span><br/>val<span style="color:rgba(24,24,24,0.667)">=</span>^[0-9A-Fa-f]{64}$<br/><br/><span style="color:hsl(212,60%,40%)">[</span><span style="color:hsl(212,55%,55%)">file:source+</span><span style="color:hsl(212,60%,40%)">]</span><br/>val<span style="color:rgba(24,24,24,0.667)">=</span>^(https?|scp|rsync)://([a-z0-9\-]+\.)+[a-z0-9\-]+/.*$</div> | ||
Here is an example configuration that sources a single file from multiple potential mirrors called <code>file1.c</code>: | |||
<div class="mw-code"><span style="color:rgba(24,24,24,0.333)"># is used for comments, not ;<br/># must be at the start of a logical line<br/>	 # leading space is OK though</span><br/><span style="color:hsl(212,60%,40%)">[</span><span style="color:hsl(212,55%,55%)">file1.c</span><span style="color:hsl(212,60%,40%)">]</span><br/>sha2sum<span style="color:rgba(24,24,24,0.667)">=</span>70d181c0bebbac369cddb65e6304e55a8efdcef50589154faf30390fdc6a1427<br/><span style="color:rgba(24,24,24,0.333)"># at least one is required, but multiple may be given<br/># if so, all hashes are checked</span><br/>sha3sum<span style="color:rgba(24,24,24,0.667)">=</span>4e9e5320e30e44ff31463806d5578fbfdc9212f32d2e9dd41998d0a8aaf830c9<br/><span style="color:rgba(24,24,24,0.333)"># all of these URLs are candidates and may be tried in any order</span><br/>source<span style="color:rgba(24,24,24,0.667)">=</span>https<span></span>://www.example.com/file1.c<br/>source<span style="color:rgba(24,24,24,0.667)">=</span>https<span></span>://www.example.de/file.c<br/>source<span style="color:rgba(24,24,24,0.667)">=</span>ftp<span></span>://ftp.example.ch/srv/file_1.c<br/><span style="color:rgba(24,24,24,0.333)"># sourcing files in archives uses the # symbol like DOM IDs</span><br/>source<span style="color:rgba(24,24,24,0.667)">=</span>https<span></span>://cdn.example.com/package.tar.gz#/subdir/file.c</div> | |||
For Earthbound's INI files, the following schema rules apply: | For Earthbound's INI files, the following schema rules apply: | ||
| Line 24: | Line 30: | ||
# only ASCII is permitted, except within comments, where the high bit may be set to passively allow UTF-8 | # only ASCII is permitted, except within comments, where the high bit may be set to passively allow UTF-8 | ||
# all URIs must be valid UTF-8 and legalised into ASCII via {{wp|percent-encoding}} | # all URIs must be valid UTF-8 and legalised into ASCII via {{wp|percent-encoding}} | ||
# file names are specified as the contents of the section name in whole | # file names are specified as the contents of the section name in whole | ||
# file names cannot constitute paths; no directory component is permitted | # file names cannot constitute paths; no directory component is permitted | ||
Given an INI like the one above, Earthbound offers several benefits: | |||
# it will select the source URL using arbitrary algorithms which take advantage of the lack of ordering or precedence to choose the best download site | |||
# when multiple source files may download from the same URL sans the <code>#</code> suffix, the package only needs to be downloaded once | |||
[[Category:Byblos components]] | [[Category:Byblos components]] | ||
Latest revision as of 10:55, 13 April 2025
| Earthbound | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Created by | Alexander Nicholi | ||||||||||
| Written in | ANSI C, POSIX sh for bootstrapping | ||||||||||
| Licence | GPLv2 only | ||||||||||
Earthbound is a network- and system-agnostic software procurement system, designed to obtain and consume software packages in various formats and manage them in concert together at once.
Background and purpose
Earthbound is part of the developmental quartet alongside Inbound, Outbound and Rebound. It arose out of the need to acquire and integrate upstream software sources in a way that presumes as little as practical about the file structure or network availability of the source. Initially, this meant upstream cryptography libraries for Hinterlib which cannot be brought in-tree since doing so would undermine the confidence of the routines' security.
Design
Earthbound only concerns itself with what we will call files of interest. These are files, often source code, that may come in from anywhere over the network, that were selected by the downstream developer to contain in good faith the data they need. Earthbound keeps SHA-3 hashes of these files of interest and uses them to verify the files' authenticity.
Beyond acquisition, Earthbound has a know-nothing approach, giving developers total discretion on what to do with these files after they have been downloaded and verified. This is true to its purpose of software procurement, which exalts the Unix philosophy of doing one thing and doing it well.
Configuration file
Earthbound uses an INI file structure to define a collection of files of interest along with their hashes and details on where they may be found. It uses the following INI schema:
mscomments=0
[file+]val=^[A-Za-z0-9_][A-Za-z0-9_\-\+]*(\.[A-Za-z0-9_\-\+]+)?$
[file:sha2sum?]
val=^[0-9A-Fa-f]{64}$
[file:sha3sum?]
val=^[0-9A-Fa-f]{64}$
[file:source+]
val=^(https?|scp|rsync)://([a-z0-9\-]+\.)+[a-z0-9\-]+/.*$
Here is an example configuration that sources a single file from multiple potential mirrors called file1.c:
# must be at the start of a logical line
# leading space is OK though
[file1.c]
sha2sum=70d181c0bebbac369cddb65e6304e55a8efdcef50589154faf30390fdc6a1427
# at least one is required, but multiple may be given
# if so, all hashes are checked
sha3sum=4e9e5320e30e44ff31463806d5578fbfdc9212f32d2e9dd41998d0a8aaf830c9
# all of these URLs are candidates and may be tried in any order
source=https://www.example.com/file1.c
source=https://www.example.de/file.c
source=ftp://ftp.example.ch/srv/file_1.c
# sourcing files in archives uses the # symbol like DOM IDs
source=https://cdn.example.com/package.tar.gz#/subdir/file.c
For Earthbound's INI files, the following schema rules apply:
- all key–value pairs must appear under a section heading (there is no "global section")
- only ASCII is permitted, except within comments, where the high bit may be set to passively allow UTF-8
- all URIs must be valid UTF-8 and legalised into ASCII via percent-encoding
- file names are specified as the contents of the section name in whole
- file names cannot constitute paths; no directory component is permitted
Given an INI like the one above, Earthbound offers several benefits:
- it will select the source URL using arbitrary algorithms which take advantage of the lack of ordering or precedence to choose the best download site
- when multiple source files may download from the same URL sans the
#suffix, the package only needs to be downloaded once