Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions bin/freight-cache
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ LIB="$(cd "$(dirname "$(dirname "$0")")/lib/freight" && pwd)"
# If `GPG_DIGEST_ALGO` is unset, force it to the freight default of SHA512
[ -z "$GPG_DIGEST_ALGO" ] && GPG_DIGEST_ALGO="SHA512"

# Create a working directory on the same device as the Freight cache.
# make sure the cache-directory exists
mkdir -p "$VARCACHE"
TMP="$(mktemp -d "$VARCACHE/work.$$.XXXXXXXXXX")"

# Create a temporary working directory for extracting files
mkdir -p "$TEMPDIR"
TMP="$(mktemp -d "$TEMPDIR/work.$$.XXXXXXXXXX")"
# shellcheck disable=SC2064
trap "rm -rf \"$TMP\"" EXIT INT TERM

Expand Down
7 changes: 6 additions & 1 deletion bin/freight-init
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

# Initialize a Freight directory (similar to git init).

#/ Usage: freight init -g<email> [--libdir=<libdir>] [--cachedir=<cachedir>] [--archs=<archs>] [--origin=<origin>] [--label=<label>] [-v] [-h] [<dirname>]
#/ Usage: freight init -g<email> [--libdir=<libdir>] [--cachedir=<cachedir>] [--tempdir=<tempdir>] [--archs=<archs>] [--origin=<origin>] [--label=<label>] [-v] [-h] [<dirname>]
#/ -g<email>, --gpg=<email> GPG key to use
#/ -c<conf>, --conf=<conf> config file to create (default etc/freight.conf)
#/ --libdir=<libdir> library directory (default var/lib/freight)
#/ --cachedir=<cachedir> cache directory (default var/cache/freight)
#/ --tempdir=<tempdir> temp directory (default same as cachedir)
#/ --archs=<archs> architectures to support (default "i386 amd64")
#/ --origin=<origin> Debian archive Origin field (default "Freight")
#/ --label=<label> Debian archive Label field (default "Freight")
Expand Down Expand Up @@ -56,6 +57,8 @@ while [ "$#" -gt 0 ]; do
--libdir=*) VARLIB="$(echo "$1" | cut -c"10-")" shift ;;
--cachedir) VARCACHE="$2" shift 2 ;;
--cachedir=*) VARCACHE="$(echo "$1" | cut -c"12-")" shift ;;
--tempdir) TEMPDIR="$2" shift 2 ;;
--tempdir=*) TEMPDIR="$(echo "$1" | cut -c"12-")" shift ;;
--archs) ARCHS="$2" shift 2 ;;
--archs=*) ARCHS="$(echo "$1" | cut -c"9-")" shift ;;
--origin) ORIGIN="$2" shift 2 ;;
Expand All @@ -80,6 +83,7 @@ DIRNAME="$(cd "${1:-"."}" && pwd)"
# follows the FHS style.
VARLIB="${VARLIB:-"$DIRNAME/var/lib"}"
VARCACHE="${VARCACHE:-"$DIRNAME/var/cache"}"
TEMPDIR="${TEMPDIR:-"$DIRNAME/var/cache"}"

# Create the directory where `CONF` will be placed. This is likely given
# relative to `DIRNAME` so change to that directory to make things easy.
Expand All @@ -91,6 +95,7 @@ mkdir -p "$(dirname "$CONF")"
cat >"$CONF" <<EOF
VARLIB="$VARLIB"
VARCACHE="$VARCACHE"
TEMPDIR="$TEMPDIR"
GPG="$GPG"
EOF
[ "$ARCHS" ] && echo "ARCHS=\"$ARCHS\"" >>"$CONF"
Expand Down
6 changes: 6 additions & 0 deletions etc/freight.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
VARLIB="/var/lib/freight"
VARCACHE="/var/cache/freight"

# The dir used for temp files when regenerating the cache. It's efficient
# to set this to the same value as VARCACHE, but that will expose temp files
# for a short period of time to the outside world. To avoid this, set it
# to something else (for example /tmp)
TEMPDIR="/var/cache/freight"

# Default `Origin`, `Label`, `NotAutomatic`, and
# `ButAutomaticUpgrades` fields for `Release` files.
ORIGIN="Freight"
Expand Down
2 changes: 2 additions & 0 deletions lib/freight/conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# web server's document root should be `$VARCACHE`.
VARLIB="/var/lib/freight"
VARCACHE="/var/cache/freight"
TEMPDIR="/var/cache/freight"

# Default architectures.
# shellcheck disable=SC2034
Expand Down Expand Up @@ -55,5 +56,6 @@ fi
# Normalize directory names.
VARLIB=${VARLIB%%/}
VARCACHE=${VARCACHE%%/}
TEMPDIR=${TEMPDIR%%/}

# vim: et:ts=4:sw=4
31 changes: 6 additions & 25 deletions man/man1/freight-add.1
Original file line number Diff line number Diff line change
@@ -1,62 +1,43 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "FREIGHT\-ADD" "1" "September 2016" "" "Freight"
.
.\" generated with Ronn-NG/v0.8.0
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0
.TH "FREIGHT\-ADD" "1" "September 2022" "" "Freight"
.SH "NAME"
\fBfreight\-add\fR \- add a package to Freight
.
.SH "SYNOPSIS"
\fBfreight add\fR [\fB\-c\fR \fIconf\fR] [\fB\-v\fR] [\fB\-h\fR] \fIpackage\fR \fImanager\fR/\fIdistro\fR[/\fIcomponent\fR][\.\.\.]
.
\fBfreight add\fR [\fB\-c\fR \fIconf\fR] [\fB\-v\fR] [\fB\-h\fR] \fIpackage\fR \fImanager\fR/\fIdistro\fR[/\fIcomponent\fR][\|\.\|\.\|\.]
.SH "DESCRIPTION"
\fBfreight\-add\fR registers \fIpackage\fR with one or more \fImanager\fR/\fIdistro\fR[/\fIcomponent\fR] pairs (or triples)\. Currently, \fBapt\fR is the only supported \fImanager\fR and \fIpackage\fR must be one of \fI*\.deb\fR, \fI*\.ddeb\fR, \fI*\.dsc *\.debian\.tar\.gz *\.orig\.tar\.gz\fR, \fI*\.dsc *\.diff\.gz *\.orig\.tar\.gz\fR, or \fI*\.dsc *\.tar\.gz\fR\. \fIdistro\fR may be any arbitrary value but is best suited to naming a particular version of the target operating system (for example, "wheezy" or "precise")\. \fIcomponent\fR is optional and for \fBapt\fR defaults to \fBmain\fR\.
.
\fBfreight\-add\fR registers \fIpackage\fR with one or more \fImanager\fR/\fIdistro\fR[/\fIcomponent\fR] pairs (or triples)\. Currently, \fBapt\fR is the only supported \fImanager\fR and \fIpackage\fR must be one of \fI*\.deb\fR, \fI*\.ddeb\fR, \fI*\.dsc *\.debian\.tar\.* *\.orig\.tar\.*\fR, \fI*\.dsc *\.diff\.* *\.orig\.tar\.*\fR, \fI*\.dsc *\.tar\.*\fR, or \fI*\.dsc *\.git\fR\. \fIdistro\fR may be any arbitrary value but is best suited to naming a particular version of the target operating system (for example, "wheezy" or "precise")\. \fIcomponent\fR is optional and for \fBapt\fR defaults to \fBmain\fR\.
.P
The package files are organized in the Freight library so \fBfreight\-cache\fR(1) has an easy time of creating package repositories for each \fImanager\fR/\fIdistro\fR[/\fIcomponent\fR] later\.
.
.SH "OPTIONS"
.
.TP
\fB\-c\fR \fIconf\fR, \fB\-\-conf=\fR\fIconf\fR
Use an alternate configuration file\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Verbose mode\.
.
.TP
\fB\-e\fR, \fB\-\-add\-error\fR
Raises an error if the package to add is already registered\.
.
.TP
\fB\-h\fR, \fB\-\-help\fR
Show a help message\.
.
.SH "FILES"
.
.TP
\fI/etc/freight\.conf\fR, \fI~/\.freight\.conf\fR, \fIetc/freight\.conf\fR, \fI\.freight\.conf\fR
The default configuration files\. See \fBfreight\fR(5)\.
.
.SH "ENVIRONMENT VARIABLES"
.
.TP
\fBFREIGHT_CONF\fR
The pathname of an alternate configuration file\. See \fBfreight\fR(5)\.
.
.TP
\fBFREIGHT_ADD_ERROR\fR
If not empty acts as \-\-add\-error option\.
.
.SH "THEME SONG"
The New Pornographers \- "All the Old Showstoppers"
.
.SH "AUTHOR"
Richard Crowley \fIr@rcrowley\.org\fR
.
Richard Crowley \fI\%mailto:r@rcrowley\.org\fR
.SH "SEE ALSO"
Part of \fBfreight\fR(1)\.
.
.P
\fBfreight\-cache\fR(1) builds package repositories from the intermediate "Freight library" managed by \fBfreight\-add\fR\.
34 changes: 5 additions & 29 deletions man/man1/freight-cache.1
Original file line number Diff line number Diff line change
@@ -1,80 +1,56 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "FREIGHT\-CACHE" "1" "March 2016" "" "Freight"
.
.\" generated with Ronn-NG/v0.8.0
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0
.TH "FREIGHT\-CACHE" "1" "September 2022" "" "Freight"
.SH "NAME"
\fBfreight\-cache\fR \- (re)builds package repositories
.
.SH "SYNOPSIS"
\fBfreight cache\fR [\fB\-k\fR] [\fB\-g\fR \fIemail\fR] [\fB\-p\fR \fIpassphrase file\fR] [\fB\-c\fR \fIconf\fR] [\fB\-v\fR] [\fB\-h\fR] [\fImanager\fR/\fIdistro\fR][\.\.\.]
.
\fBfreight cache\fR [\fB\-k\fR] [\fB\-g\fR \fIemail\fR] [\fB\-p\fR \fIpassphrase file\fR] [\fB\-c\fR \fIconf\fR] [\fB\-v\fR] [\fB\-h\fR] [\fImanager\fR/\fIdistro\fR][\|\.\|\.\|\.]
.SH "DESCRIPTION"
\fBfreight\-cache\fR converts each \fImanager\fR/\fIdistro\fR given into a package repository (only Debian archives are supported currently)\. The \fImanager\fR indicates the type of repository (again, \fBapt\fR is the only supported value)\. The \fIdistro\fR is an arbitrary string that should match a release of the target operating system (for example, "lenny" or "lucid")\. If none are given, \fBfreight\-cache\fR converts all \fImanager\fR/\fIdistro\fR pairs found in \fB$VARLIB\fR\.
.
.P
Packages are read from the Freight library (\fB$VARLIB\fR in the configuration, see \fBfreight\fR(5)) and organized into a working repository in the Freight cache (\fB$VARCACHE\fR in the configuration)\.
.
.P
Serving the repositories is left as an exercise for the reader\. The Freight cache is the only directory that needs to be exposed, so create a virtual host with \fB$VARCACHE\fR as its document root and everything will be fine\.
.
.P
From version 0\.0\.8 onwards, distros in an APT repository no longer share the contents of the \fBpool/\fR\. After upgrading to this version and running \fBfreight\-cache\fR for all your distros, it is safe and recommended to \fBrm \-rf $VARCACHE/pool/main\fR to reset link counts to the proper value\.
.
.SH "OPTIONS"
.
.TP
\fB\-k\fR, \fB\-\-keep\fR
Keep unreferenced versions of packages\. This is different than keeping multiple versions of a package in the repository, which is supported without any special options\.
.
.TP
\fB\-g\fR \fIemail\fR, \fB\-\-gpg=\fR\fIemail\fR
Use an alternate GPG key\. May be given multiple times\.
.
.TP
\fB\-p\fR \fIpassphrase file\fR, \fB\-\-passphrase\-file=\fR\fIpassphrase file\fR
Use an alternate file containing the GPG key passphrase\. This file should obviously be protected and only readable by the user running Freight\.
.
.TP
\fB\-a\fR \fIdigest algorithm\fR, \fB\-\-digest\-algo=\fR\fIdigest algorithm\fR
Message digest algorithm that GPG should use to sign the repository, e\.g SHA512
.
.TP
\fB\-c\fR \fIconf\fR, \fB\-\-conf=\fR\fIconf\fR
Use an alternate configuration file\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Verbose mode\.
.
.TP
\fB\-h\fR, \fB\-\-help\fR
Show a help message\.
.
.SH "FILES"
.
.TP
\fI/etc/freight\.conf\fR, \fI~/\.freight\.conf\fR, \fIetc/freight\.conf\fR, \fI\.freight\.conf\fR
The default configuration files\. See \fBfreight\fR(5)\.
.
.TP
\fI$VARCACHE\fR\fB/pubkey\.gpg\fR
The exported public key used for signing each release\.
.
.SH "ENVIRONMENT VARIABLES"
.
.TP
\fBFREIGHT_CONF\fR
The pathname of an alternate configuration file\. See \fBfreight\fR(5)\.
.
.SH "THEME SONG"
The New Pornographers \- "All the Old Showstoppers"
.
.SH "AUTHOR"
Richard Crowley \fIr@rcrowley\.org\fR
.
Richard Crowley \fI\%mailto:r@rcrowley\.org\fR
.SH "SEE ALSO"
Part of \fBfreight\fR(1)\.
.
.P
\fBfreight\-add\fR(1) adds packages to the intermediate "Freight library" that is used by \fBfreight\-cache\fR to build the actual repositories\.
26 changes: 5 additions & 21 deletions man/man1/freight-clear-cache.1
Original file line number Diff line number Diff line change
@@ -1,51 +1,35 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "FREIGHT\-CLEAR\-CACHE" "1" "March 2016" "" "Freight"
.
.\" generated with Ronn-NG/v0.8.0
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0
.TH "FREIGHT\-CLEAR\-CACHE" "1" "September 2022" "" "Freight"
.SH "NAME"
\fBfreight\-clear\-cache\fR \- clears existing package repositories
.
.SH "SYNOPSIS"
\fBfreight clear\-cache\fR [\fB\-c\fR \fIconf\fR] [\fB\-v\fR] [\fB\-h\fR] [\fImanager\fR/\fIdistro\fR][\.\.\.]
.
\fBfreight clear\-cache\fR [\fB\-c\fR \fIconf\fR] [\fB\-v\fR] [\fB\-h\fR] [\fImanager\fR/\fIdistro\fR][\|\.\|\.\|\.]
.SH "DESCRIPTION"
\fBfreight\-clear\-cache\fR clears the cache generated during \fBfreight\-cache\fR runs so that it can be regenerated on the next \fBfreight\-cache\fR invocation\.
.
.SH "OPTIONS"
.
.TP
\fB\-c\fR \fIconf\fR, \fB\-\-conf=\fR\fIconf\fR
Use an alternate configuration file\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Verbose mode\.
.
.TP
\fB\-h\fR, \fB\-\-help\fR
Show a help message\.
.
.SH "FILES"
.
.TP
\fI/etc/freight\.conf\fR, \fI~/\.freight\.conf\fR, \fIetc/freight\.conf\fR, \fI\.freight\.conf\fR
The default configuration files\. See \fBfreight\fR(5)\.
.
.SH "ENVIRONMENT VARIABLES"
.
.TP
\fBFREIGHT_CONF\fR
The pathname of an alternate configuration file\. See \fBfreight\fR(5)\.
.
.SH "THEME SONG"
The New Pornographers \- "All the Old Showstoppers"
.
.SH "AUTHOR"
Richard Crowley \fIr@rcrowley\.org\fR
.
Richard Crowley \fI\%mailto:r@rcrowley\.org\fR
.SH "SEE ALSO"
Part of \fBfreight\fR(1)\.
.
.P
\fBfreight\-cache\fR(1) can be used to build the repository again\.
34 changes: 8 additions & 26 deletions man/man1/freight-init.1
Original file line number Diff line number Diff line change
@@ -1,72 +1,54 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "FREIGHT\-INIT" "1" "March 2016" "" "Freight"
.
.\" generated with Ronn-NG/v0.8.0
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0
.TH "FREIGHT\-INIT" "1" "September 2022" "" "Freight"
.SH "NAME"
\fBfreight\-init\fR \- initialize a Freight directory
.
.SH "SYNOPSIS"
\fBfreight init\fR [\fB\-\-libdir\fR \fIvarlib\fR] [\fB\-\-cachedir\fR \fIvarcache\fR] [\fB\-\-archs\fR \fIarchs\fR] [\fB\-\-origin\fR \fIorigin\fR] [\fB\-\-label\fR \fIlabel\fR] [\fB\-v\fR] [\fB\-h\fR] \fB\-g\fR \fIgpg\fR \fIdirname\fR
.
\fBfreight init\fR [\fB\-\-libdir\fR \fIvarlib\fR] [\fB\-\-cachedir\fR \fIvarcache\fR] [\fB\-\-tempdir\fR \fItempdir\fR] [\fB\-\-archs\fR \fIarchs\fR] [\fB\-\-origin\fR \fIorigin\fR] [\fB\-\-label\fR \fIlabel\fR] [\fB\-v\fR] [\fB\-h\fR] \fB\-g\fR \fIgpg\fR \fIdirname\fR
.SH "DESCRIPTION"
\fBfreight\-init\fR will setup a directory to be used by Freight\. It will generate small wrappers around the original Freight commands\. Use \fBfreight\-add\fR(1) and \fBfreight\-cache\fR(1) to work against the \fBVARLIB\fR and \fBVARCACHE\fR given to \fBfreight init\fR\.
.
.P
The benefit of using \fBfreight\-init\fR is to automate the setup of Freight and to configure all data to be stored in one directory\.
.
.P
Configuration is stored in \fIdirname\fR\fB/etc/freight\.conf\fR\.
.
.SH "OPTIONS"
.
.TP
\fB\-g\fR \fIgpg\fR, \fB\-\-gpg=\fR\fIgpg\fR
GPG key\. May be given multiple times\.
.
.TP
\fB\-\-libdir=\fR\fIvarlib\fR
VARLIB directory to use\. Defaults to \fIdirname\fR\fB/var/lib\fR
.
.TP
\fB\-\-cachedir=\fR\fIvarcache\fR
VARCACHE directory to use\. Defaults to \fIdirname\fR\fB/var/cache\fR
.
.TP
\fB\-\-tempdir=\fR\fItempdir\fR
Directory for temporary files\. Defaults to dirname_\fB/var/cache\fR
.TP
\fB\-\-archs=\fR\fIarchs\fR
Architectures to generate archives for\. Defaults to \fBi386 amd64\fR
.
.TP
\fB\-\-origin=\fR\fIorigin\fR
Debian archive Origin field value\. Defaults to \fBFreight\fR
.
.TP
\fB\-\-label=\fR\fIlabel\fR
Debian archive Label field value\. Defaults to \fBFreight\fR
.
.TP
\fB\-\-suite=\fR\fIsuite\fR
Debian archive Suite field value\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Verbose mode\.
.
.TP
\fB\-h\fR, \fB\-\-help\fR
Show a help message\.
.
.SH "FILES"
.
.TP
\fI/etc/freight\.conf\fR, \fI~/\.freight\.conf\fR, \fIetc/freight\.conf\fR, \fI\.freight\.conf\fR
The default configuration files\. See \fBfreight\fR(5)\.
.
.SH "THEME SONG"
The New Pornographers \- "All the Old Showstoppers"
.
.SH "AUTHOR"
Jens Braeuer \fIbraeuer\.jens@googlemail\.com\fR
.
Jens Braeuer \fI\%mailto:braeuer\.jens@googlemail\.com\fR
.SH "SEE ALSO"
Part of \fBfreight\fR(1)\.
4 changes: 3 additions & 1 deletion man/man1/freight-init.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ freight-init(1) -- initialize a Freight directory

## SYNOPSIS

`freight init` [`--libdir` _varlib_] [`--cachedir` _varcache_] [`--archs` _archs_] [`--origin` _origin_] [`--label` _label_] [`-v`] [`-h`] `-g` _gpg_ _dirname_
`freight init` [`--libdir` _varlib_] [`--cachedir` _varcache_] [`--tempdir` _tempdir_] [`--archs` _archs_] [`--origin` _origin_] [`--label` _label_] [`-v`] [`-h`] `-g` _gpg_ _dirname_

## DESCRIPTION

Expand All @@ -21,6 +21,8 @@ Configuration is stored in _dirname_`/etc/freight.conf`.
VARLIB directory to use. Defaults to _dirname_`/var/lib`
* `--cachedir=`_varcache_:
VARCACHE directory to use. Defaults to _dirname_`/var/cache`
* `--tempdir=`_tempdir:
Directory for temporary files. Defaults to _dirname_`/var/cache`
* `--archs=`_archs_:
Architectures to generate archives for. Defaults to `i386 amd64`
* `--origin=`_origin_:
Expand Down
Loading