config: revert partial format conversion
back in v4.0~a6-1 a transition process was started to move the live-build
config to a new format. the new format was INI style, and required
parsing functions to read/write values, compared to the existing format
which was just shell script code setting variables.
this partial transition is the explanation for the existence of the
`New_configuration()` function, and understanding this is important to
understanding the purpose of it - it is not in fact intended for creating
a new configuration, it is just related to the new config format
transition.
the positives of the new format were that it was somewhat cleaner looking,
while the negative was the terrible relative efficiency.
the file `config/build` was created to hold options in this new format.
the transition was only ever completed for a handful of config options:
- architecture
- archive areas and parent archive areas
- live image name
- live image type
a 'configuration version' attribute was also saved, which is not used by
anything.
the bootstrap-mirror and parent-bootstrap-mirror attributes are pointlessly
stored in it seemingly resulting from work done in v4.0~a17-1. (they are
also stored in another config file from which the value is actually used).
it in fact seems to have been a source of confusion for Raphaël in
authoring 44b9b0a650
, since the new
`[parent]-distribution-{chroot|binary}` options it introduced were stored
both in `config/bootstrap` and in `config/build`, while only used from the
former. i expect, understandably, that he thought that `config/build` was
just an information file.
Gbp-Dch: Short
This commit is contained in:
parent
bf63762721
commit
c441c39efe
|
@ -9,69 +9,9 @@
|
|||
## under certain conditions; see COPYING for details.
|
||||
|
||||
|
||||
New_configuration ()
|
||||
{
|
||||
## Runtime
|
||||
|
||||
if [ $(which dpkg) ]
|
||||
then
|
||||
CURRENT_IMAGE_ARCHITECTURE="$(dpkg --print-architecture)"
|
||||
else
|
||||
case "$(uname -m)" in
|
||||
x86_64)
|
||||
CURRENT_IMAGE_ARCHITECTURE="amd64"
|
||||
;;
|
||||
|
||||
i?86)
|
||||
CURRENT_IMAGE_ARCHITECTURE="i386"
|
||||
;;
|
||||
|
||||
*)
|
||||
Echo_warning "Unable to determine current architecture, using ${CURRENT_IMAGE_ARCHITECTURE}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## Configuration
|
||||
|
||||
LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-$(Get_configuration config/build Configuration-Version)}"
|
||||
LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-${LIVE_BUILD_VERSION}}"
|
||||
export LIVE_CONFIGURATION_VERSION
|
||||
|
||||
LIVE_IMAGE_NAME="${LIVE_IMAGE_NAME:-$(Get_configuration config/build Name)}"
|
||||
LIVE_IMAGE_NAME="${LIVE_IMAGE_NAME:-live-image}"
|
||||
export LIVE_IMAGE_NAME
|
||||
|
||||
# (FIXME: Support and default to 'any')
|
||||
LB_ARCHITECTURE="${LB_ARCHITECTURE:-$(Get_configuration config/build Architecture)}"
|
||||
LB_ARCHITECTURE="${LB_ARCHITECTURE:-${CURRENT_IMAGE_ARCHITECTURE}}"
|
||||
export LB_ARCHITECTURE
|
||||
|
||||
# For backwards compat with custom hooks and conditional includes
|
||||
LB_ARCHITECTURES=${LB_ARCHITECTURE}
|
||||
export LB_ARCHITECTURES
|
||||
|
||||
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-$(Get_configuration config/build Archive-Areas)}"
|
||||
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main}"
|
||||
LB_ARCHIVE_AREAS="$(echo "${LB_ARCHIVE_AREAS}" | tr "," " ")"
|
||||
export LB_ARCHIVE_AREAS
|
||||
|
||||
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-$(Get_configuration config/build Parent-Archive-Areas)}"
|
||||
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
|
||||
LB_PARENT_ARCHIVE_AREAS="$(echo "${LB_PARENT_ARCHIVE_AREAS}" | tr "," " ")"
|
||||
export LB_PARENT_ARCHIVE_AREAS
|
||||
|
||||
LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-$(Get_configuration config/build Type)}"
|
||||
LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}"
|
||||
export LIVE_IMAGE_TYPE
|
||||
}
|
||||
|
||||
# Prepare config for use, filling in defaults where no value provided for instance
|
||||
Prepare_config ()
|
||||
{
|
||||
# FIXME
|
||||
New_configuration
|
||||
|
||||
# Colouring is re-evaluated here just incase a hard coded override was given in the saved config
|
||||
case "${_COLOR}" in
|
||||
true)
|
||||
|
@ -91,6 +31,8 @@ Prepare_config ()
|
|||
_QUIET="${_QUIET:-false}"
|
||||
_VERBOSE="${_VERBOSE:-false}"
|
||||
|
||||
LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION:-${LIVE_BUILD_VERSION}}"
|
||||
|
||||
LB_SYSTEM="${LB_SYSTEM:-live}"
|
||||
|
||||
if [ $(which lsb_release) ]
|
||||
|
@ -116,6 +58,37 @@ Prepare_config ()
|
|||
LB_DISTRIBUTION_CHROOT="${LB_DISTRIBUTION_CHROOT:-${LB_DISTRIBUTION}}"
|
||||
LB_DISTRIBUTION_BINARY="${LB_DISTRIBUTION_BINARY:-${LB_DISTRIBUTION_CHROOT}}"
|
||||
|
||||
LIVE_IMAGE_NAME="${LIVE_IMAGE_NAME:-live-image}"
|
||||
LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE:-iso-hybrid}"
|
||||
|
||||
if [ -z "${LB_ARCHITECTURE}" ]; then
|
||||
if [ $(which dpkg) ]; then
|
||||
LB_ARCHITECTURE="$(dpkg --print-architecture)"
|
||||
else
|
||||
case "$(uname -m)" in
|
||||
x86_64)
|
||||
LB_ARCHITECTURE="amd64"
|
||||
;;
|
||||
|
||||
i?86)
|
||||
LB_ARCHITECTURE="i386"
|
||||
;;
|
||||
|
||||
*)
|
||||
Echo_error "Unable to determine current architecture"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
# For backwards compat with custom hooks and conditional includes
|
||||
LB_ARCHITECTURES="${LB_ARCHITECTURE}"
|
||||
|
||||
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main}"
|
||||
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
|
||||
LB_ARCHIVE_AREAS="$(echo "${LB_ARCHIVE_AREAS}" | tr "," " ")"
|
||||
LB_PARENT_ARCHIVE_AREAS="$(echo "${LB_PARENT_ARCHIVE_AREAS}" | tr "," " ")"
|
||||
|
||||
LB_BACKPORTS="${LB_BACKPORTS:-false}"
|
||||
if [ -n "$LB_PARENT_DISTRIBUTION" ]; then
|
||||
LB_PARENT_DISTRIBUTION_CHROOT="${LB_PARENT_DISTRIBUTION_CHROOT:-${LB_PARENT_DISTRIBUTION}}"
|
||||
|
@ -743,33 +716,3 @@ Validate_config_dependencies ()
|
|||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
Get_configuration ()
|
||||
{
|
||||
local CONFIGURATION_FILE="${1}"
|
||||
local FIELD_NAME="${2}"
|
||||
local FIELD_BODY
|
||||
|
||||
if [ -e "${CONFIGURATION_FILE}" ]
|
||||
then
|
||||
FIELD_BODY="$(grep ^${FIELD_NAME}: ${CONFIGURATION_FILE} | awk '{ $1=""; print $0 }' | sed -e 's|^ ||')"
|
||||
fi
|
||||
|
||||
echo ${FIELD_BODY}
|
||||
}
|
||||
|
||||
Set_configuration ()
|
||||
{
|
||||
local CONFIGURATION_FILE="${1}"
|
||||
local FIELD_NAME="${2}"
|
||||
local FIELD_BODY="${3}"
|
||||
|
||||
if grep -qs "^${FIELD_NAME}:" "${CONFIGURATION_FILE}"
|
||||
then
|
||||
# Update configuration
|
||||
sed -i -e "s|^${FIELD_NAME}:.*$|${FIELD_NAME}: ${FIELD_BODY}|" "${CONFIGURATION_FILE}"
|
||||
else
|
||||
# Append configuration
|
||||
echo "${FIELD_NAME}: ${FIELD_BODY}" >> "${CONFIGURATION_FILE}"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.TH LIVE\-BUILD 1 2020\-03\-30 1:20191222 "Debian Live Project"
|
||||
.TH LIVE\-BUILD 1 2020\-04\-06 1:20191222 "Debian Live Project"
|
||||
|
||||
.SH NAME
|
||||
\fBlb_config\fR \- Create config directory
|
||||
|
@ -225,7 +225,7 @@
|
|||
.PP
|
||||
\fBlb config\fR populates the configuration directory for live\-build. This directory is named 'config' and is created in the current directory where \fBlb config\fR was executed.
|
||||
.PP
|
||||
Note: \fBlb config\fR tries to be smart and sets defaults for some options depending upon the settings of others. However, this only typically happens when no existing saved config exists, because values are only automatically set when not already defined (and running \fBlb config\fR involves loading any existing config). This means that when generating a new configuration, you should typically first ensure that any existing saved config files are removed (by deletion of \fBconfig/{binary,build,bootstrap,chroot,common,source}\fR), before then calling \fBlb config\fR just once with \fBall\fR necessary options specified. Calling it when an existing saved config exists risks ending up with a non\-working configuration, depending on the options changed, since in doing so other options may end up with different values than they otherwise might have had had automatic setting of them not been blocked by an existing saved value. In some cases invalid combinations will be noticed and reported as an error or warning, but this is not always the case and should not be relied upon.
|
||||
Note: \fBlb config\fR tries to be smart and sets defaults for some options depending upon the settings of others. However, this only typically happens when no existing saved config exists, because values are only automatically set when not already defined (and running \fBlb config\fR involves loading any existing config). This means that when generating a new configuration, you should typically first ensure that any existing saved config files are removed (by deletion of \fBconfig/{binary,bootstrap,chroot,common,source}\fR), before then calling \fBlb config\fR just once with \fBall\fR necessary options specified. Calling it when an existing saved config exists risks ending up with a non\-working configuration, depending on the options changed, since in doing so other options may end up with different values than they otherwise might have had had automatic setting of them not been blocked by an existing saved value. In some cases invalid combinations will be noticed and reported as an error or warning, but this is not always the case and should not be relied upon.
|
||||
|
||||
.SH OPTIONS
|
||||
In addition to its specific options \fBlb config\fR understands all generic live\-build options. See \fIlive\-build\fR(7) for a complete list of all generic live\-build options.
|
||||
|
|
|
@ -973,6 +973,9 @@ fi
|
|||
cat > config/common << EOF
|
||||
# config/common - common options for live-build(7)
|
||||
|
||||
# \$LIVE_CONFIGURATION_VERSION: version of live-build used to build config (config format version)
|
||||
LIVE_CONFIGURATION_VERSION="${LIVE_CONFIGURATION_VERSION}"
|
||||
|
||||
# \$LB_APT: set package manager
|
||||
LB_APT="${LB_APT}"
|
||||
|
||||
|
@ -1027,6 +1030,9 @@ LB_MODE="${LB_MODE}"
|
|||
# \$LB_SYSTEM: set system type
|
||||
LB_SYSTEM="${LB_SYSTEM}"
|
||||
|
||||
# \$LIVE_IMAGE_NAME: set base name of the image
|
||||
LIVE_IMAGE_NAME="${LIVE_IMAGE_NAME}"
|
||||
|
||||
# live-build options
|
||||
|
||||
# \$_BREAKPOINTS: enable breakpoints
|
||||
|
@ -1066,6 +1072,9 @@ EOF
|
|||
cat > config/bootstrap << EOF
|
||||
# config/bootstrap - options for live-build(7), bootstrap stage
|
||||
|
||||
# \$LB_ARCHITECTURE: select architecture to use
|
||||
LB_ARCHITECTURE="${LB_ARCHITECTURE}"
|
||||
|
||||
# \$LB_DISTRIBUTION: select distribution to use
|
||||
LB_DISTRIBUTION="${LB_DISTRIBUTION}"
|
||||
|
||||
|
@ -1087,6 +1096,12 @@ LB_PARENT_DISTRIBUTION_BINARY="${LB_PARENT_DISTRIBUTION_BINARY}"
|
|||
# \$LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION: select parent distribution for debian-installer to use
|
||||
LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"
|
||||
|
||||
# \$LB_ARCHIVE_AREAS: select archive areas to use
|
||||
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS}"
|
||||
|
||||
# \$LB_PARENT_ARCHIVE_AREAS: select parent archive areas to use
|
||||
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS}"
|
||||
|
||||
# \$LB_PARENT_MIRROR_BOOTSTRAP: set parent mirror to bootstrap from
|
||||
LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP}"
|
||||
|
||||
|
@ -1183,6 +1198,9 @@ mkdir -p config/bootloaders
|
|||
cat > config/binary << EOF
|
||||
# config/binary - options for live-build(7), binary stage
|
||||
|
||||
# \$LIVE_IMAGE_TYPE: set image type
|
||||
LIVE_IMAGE_TYPE="${LIVE_IMAGE_TYPE}"
|
||||
|
||||
# \$LB_BINARY_FILESYSTEM: set image filesystem
|
||||
LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM}"
|
||||
|
||||
|
@ -1360,35 +1378,5 @@ esac
|
|||
|
||||
fi
|
||||
|
||||
cat > config/build << EOF
|
||||
[Image]
|
||||
Architecture: ${LB_ARCHITECTURE}
|
||||
Archive-Areas: ${LB_ARCHIVE_AREAS}
|
||||
Distribution-Chroot: ${LB_DISTRIBUTION_CHROOT}
|
||||
Distribution-Binary: ${LB_DISTRIBUTION_BINARY}
|
||||
Mirror-Bootstrap: ${LB_MIRROR_BOOTSTRAP}
|
||||
EOF
|
||||
|
||||
if [ "${LB_DERIVATIVE}" = "true" ]
|
||||
then
|
||||
|
||||
cat >> config/build << EOF
|
||||
|
||||
Parent-Archive-Areas: ${LB_PARENT_ARCHIVE_AREAS}
|
||||
Parent-Distribution-Chroot: ${LB_PARENT_DISTRIBUTION_CHROOT}
|
||||
Parent-Distribution-Binary: ${LB_PARENT_DISTRIBUTION_BINARY}
|
||||
Parent-Mirror-Bootstrap: ${LB_PARENT_MIRROR_BOOTSTRAP}
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
cat >> config/build << EOF
|
||||
|
||||
[FIXME]
|
||||
Configuration-Version: ${LIVE_CONFIGURATION_VERSION}
|
||||
Name: ${LIVE_IMAGE_NAME}
|
||||
Type: ${LIVE_IMAGE_TYPE}
|
||||
EOF
|
||||
|
||||
# Creating stage file
|
||||
Create_stagefile
|
||||
|
|
Loading…
Reference in New Issue