diff --git a/rex.project/x86_64/components/stage4/dbus.bash b/rex.project/x86_64/components/stage4/dbus.bash new file mode 100755 index 0000000..6315a8b --- /dev/null +++ b/rex.project/x86_64/components/stage4/dbus.bash @@ -0,0 +1,218 @@ +#!/bin/bash +# desc: +# stages, builds, installs + +# make variables persist in subprocesses for logging function +set -a + +# ---------------------------------------------------------------------- +# Configuration: +# ---------------------------------------------------------------------- +# the name of this application +APPNAME="dbus" + +# the version of this application +VERSION="1.14.6" + +# ---------------------------------------------------------------------- +# Variables and functions sourced from Environment: +# ---------------------------------------------------------------------- +# assert_zero() +# Checks if $1 is 0. If non-0 value, halts the execution of the script. +# +# LOGS_ROOT +# The parent directory where logs from this project will go. +# +# TEMP_STAGE_DIR +# The parent directory of where source archives are extracted to. + +# register mode selections +ARGUMENT_LIST=( + "stage" + "build" + "install" + "all" + "help" +) + +# modes to associate with switches +# assumes you want nothing done unless you ask for it. +MODE_STAGE=false +MODE_BUILD=false +MODE_INSTALL=false +MODE_ALL=false +MODE_HELP=false + +# the file to log to +LOGFILE="${APPNAME}.log" + +# ISO 8601 variation +TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)" + +# the path where logs are written to +# note: LOGS_ROOT is sourced from environment +LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}" + +# the path where the source will be located when complete +# note: TEMP_STAGE_DIR is sourced from environment +T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}" + +# read defined arguments +opts=$(getopt \ + --longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \ + --name "$APPNAME" \ + --options "" \ + -- "$@" +) + +# process supplied arguments into flags that enable execution modes +eval set --$opts +while [[ $# -gt 0 ]]; do + case "$1" in + --stage) + MODE_STAGE=true + shift 1 + ;; + --build) + MODE_BUILD=true + shift 1 + ;; + --install) + MODE_INSTALL=true + shift 1 + ;; + --all) + MODE_ALL=true + shift 1 + ;; + --help) + MODE_HELP=true + shift 1 + ;; + *) + break + ;; + esac +done + +# print to stdout, print to log +logprint() { + mkdir -p "${LOG_DIR}" + echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \ + | tee -a "${LOG_DIR}/${LOGFILE}" +} + +# Tell the user we're alive... +logprint "Initializing the ${APPNAME} utility..." + +# when the stage mode is enabled, this will execute +mode_stage() { + logprint "Starting stage of ${APPNAME}..." + + logprint "Removing any pre-existing staging for ${APPNAME}." + rm -Rf "${T_SOURCE_DIR}"* + + logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}" + tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}" + assert_zero $? + + # conditionally rename if it needs it + stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}" + + logprint "Staging operation complete." +} + +# when the build_pass1 mode is enabled, this will execute +mode_build() { + + # patch, configure and build + logprint "Starting build of ${APPNAME}..." + + logprint "Entering build dir." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Configuring ${APPNAME}..." + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --runstatedir=/run \ + --disable-static \ + --disable-doxygen-docs \ + --disable-xml-docs \ + --docdir=/usr/share/doc/${APPNAME}-${VERSION} \ + --with-system-socket=/run/${APPNAME}/system_bus_socket + assert_zero $? + + logprint "Compiling..." + make + assert_zero $? + + logprint "Build operation complete." +} + +mode_install() { + logprint "Starting install of ${APPNAME}..." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Installing..." + make install + assert_zero $? + + logprint "Cleanup..." + ln -sfv /etc/machine-id /var/lib/dbus + assert_zero $? + + logprint "Install operation complete." +} + + +mode_help() { + echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]" + exit 1 +} + +if [ "$MODE_ALL" = "true" ]; then + MODE_STAGE=true + MODE_BUILD=true + MODE_INSTALL=true +fi + +# if no options were selected, then show help and exit +if \ + [ "$MODE_HELP" != "true" ] && \ + [ "$MODE_STAGE" != "true" ] && \ + [ "$MODE_BUILD" != "true" ] && \ + [ "$MODE_INSTALL" != "true" ] +then + logprint "No option selected during execution." + mode_help +fi + +# if help was supplied at all, show help and exit +if [ "$MODE_HELP" = "true" ]; then + logprint "Help option selected. Printing options and exiting." + mode_help +fi + +if [ "$MODE_STAGE" = "true" ]; then + logprint "Staging option selected." + mode_stage + assert_zero $? +fi + +if [ "$MODE_BUILD" = "true" ]; then + logprint "Build of ${APPNAME} selected." + mode_build + assert_zero $? +fi + +if [ "$MODE_INSTALL" = "true" ]; then + logprint "Install of ${APPNAME} selected." + mode_install + assert_zero $? +fi + +logprint "Execution of ${APPNAME} completed." diff --git a/rex.project/x86_64/components/stage4/e2fsprogs.bash b/rex.project/x86_64/components/stage4/e2fsprogs.bash new file mode 100755 index 0000000..ff3c8d7 --- /dev/null +++ b/rex.project/x86_64/components/stage4/e2fsprogs.bash @@ -0,0 +1,242 @@ +#!/bin/bash +# desc: +# stages, builds, installs + +# make variables persist in subprocesses for logging function +set -a + +# ---------------------------------------------------------------------- +# Configuration: +# ---------------------------------------------------------------------- +# the name of this application +APPNAME="e2fsprogs" + +# the version of this application +VERSION="1.47.0" + +# ---------------------------------------------------------------------- +# Variables and functions sourced from Environment: +# ---------------------------------------------------------------------- +# assert_zero() +# Checks if $1 is 0. If non-0 value, halts the execution of the script. +# +# LOGS_ROOT +# The parent directory where logs from this project will go. +# +# TEMP_STAGE_DIR +# The parent directory of where source archives are extracted to. + +# register mode selections +ARGUMENT_LIST=( + "stage" + "build" + "install" + "all" + "help" +) + +# modes to associate with switches +# assumes you want nothing done unless you ask for it. +MODE_STAGE=false +MODE_BUILD=false +MODE_INSTALL=false +MODE_ALL=false +MODE_HELP=false + +# the file to log to +LOGFILE="${APPNAME}.log" + +# ISO 8601 variation +TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)" + +# the path where logs are written to +# note: LOGS_ROOT is sourced from environment +LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}" + +# the path where the source will be located when complete +# note: TEMP_STAGE_DIR is sourced from environment +T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}" + +# read defined arguments +opts=$(getopt \ + --longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \ + --name "$APPNAME" \ + --options "" \ + -- "$@" +) + +# process supplied arguments into flags that enable execution modes +eval set --$opts +while [[ $# -gt 0 ]]; do + case "$1" in + --stage) + MODE_STAGE=true + shift 1 + ;; + --build) + MODE_BUILD=true + shift 1 + ;; + --install) + MODE_INSTALL=true + shift 1 + ;; + --all) + MODE_ALL=true + shift 1 + ;; + --help) + MODE_HELP=true + shift 1 + ;; + *) + break + ;; + esac +done + +# print to stdout, print to log +logprint() { + mkdir -p "${LOG_DIR}" + echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \ + | tee -a "${LOG_DIR}/${LOGFILE}" +} + +# Tell the user we're alive... +logprint "Initializing the ${APPNAME} utility..." + +# when the stage mode is enabled, this will execute +mode_stage() { + logprint "Starting stage of ${APPNAME}..." + + logprint "Removing any pre-existing staging for ${APPNAME}." + rm -Rf "${T_SOURCE_DIR}"* + + logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}" + tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}" + assert_zero $? + + # conditionally rename if it needs it + stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}" + + logprint "Staging operation complete." +} + +# when the build_pass1 mode is enabled, this will execute +mode_build() { + + # patch, configure and build + logprint "Starting build of ${APPNAME}..." + + logprint "Entering build dir." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + mkdir -vp build + pushd build + assert_zero $? + + logprint "Configuring ${APPNAME}..." + ../configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --enable-elf-shlibs \ + --disable-libblkid \ + --disable-libuuid \ + --disable-uuidd \ + --disable-fsck + assert_zero $? + + logprint "Compiling..." + make + assert_zero $? + + logprint "Checking" + make check + logprint "Checks exited with '$?'. " + + logprint "Build operation complete." +} + +mode_install() { + logprint "Starting install of ${APPNAME}..." + pushd "${T_SOURCE_DIR}/build" + assert_zero $? + + logprint "Installing..." + make install + assert_zero $? + + logprint "Cleaning up..." + rm -fv /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a + assert_zero $? + + # i question the necessity of this... + gunzip -v /usr/share/info/libext2fs.info.gz + assert_zero $? + + # and this... + install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info + assert_zero $? + + logprint "Generating additional documentation..." + makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo + assert_zero $? + + install -v -m644 doc/com_err.info /usr/share/info + assert_zero $? + + install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info + assert_zero $? + + logprint "Install operation complete." +} + + +mode_help() { + echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]" + exit 1 +} + +if [ "$MODE_ALL" = "true" ]; then + MODE_STAGE=true + MODE_BUILD=true + MODE_INSTALL=true +fi + +# if no options were selected, then show help and exit +if \ + [ "$MODE_HELP" != "true" ] && \ + [ "$MODE_STAGE" != "true" ] && \ + [ "$MODE_BUILD" != "true" ] && \ + [ "$MODE_INSTALL" != "true" ] +then + logprint "No option selected during execution." + mode_help +fi + +# if help was supplied at all, show help and exit +if [ "$MODE_HELP" = "true" ]; then + logprint "Help option selected. Printing options and exiting." + mode_help +fi + +if [ "$MODE_STAGE" = "true" ]; then + logprint "Staging option selected." + mode_stage + assert_zero $? +fi + +if [ "$MODE_BUILD" = "true" ]; then + logprint "Build of ${APPNAME} selected." + mode_build + assert_zero $? +fi + +if [ "$MODE_INSTALL" = "true" ]; then + logprint "Install of ${APPNAME} selected." + mode_install + assert_zero $? +fi + +logprint "Execution of ${APPNAME} completed." diff --git a/rex.project/x86_64/components/stage4/man-db.bash b/rex.project/x86_64/components/stage4/man-db.bash new file mode 100755 index 0000000..a484051 --- /dev/null +++ b/rex.project/x86_64/components/stage4/man-db.bash @@ -0,0 +1,216 @@ +#!/bin/bash +# desc: +# stages, builds, installs + +# make variables persist in subprocesses for logging function +set -a + +# ---------------------------------------------------------------------- +# Configuration: +# ---------------------------------------------------------------------- +# the name of this application +APPNAME="man-db" + +# the version of this application +VERSION="2.11.2" + +# ---------------------------------------------------------------------- +# Variables and functions sourced from Environment: +# ---------------------------------------------------------------------- +# assert_zero() +# Checks if $1 is 0. If non-0 value, halts the execution of the script. +# +# LOGS_ROOT +# The parent directory where logs from this project will go. +# +# TEMP_STAGE_DIR +# The parent directory of where source archives are extracted to. + +# register mode selections +ARGUMENT_LIST=( + "stage" + "build" + "install" + "all" + "help" +) + +# modes to associate with switches +# assumes you want nothing done unless you ask for it. +MODE_STAGE=false +MODE_BUILD=false +MODE_INSTALL=false +MODE_ALL=false +MODE_HELP=false + +# the file to log to +LOGFILE="${APPNAME}.log" + +# ISO 8601 variation +TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)" + +# the path where logs are written to +# note: LOGS_ROOT is sourced from environment +LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}" + +# the path where the source will be located when complete +# note: TEMP_STAGE_DIR is sourced from environment +T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}" + +# read defined arguments +opts=$(getopt \ + --longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \ + --name "$APPNAME" \ + --options "" \ + -- "$@" +) + +# process supplied arguments into flags that enable execution modes +eval set --$opts +while [[ $# -gt 0 ]]; do + case "$1" in + --stage) + MODE_STAGE=true + shift 1 + ;; + --build) + MODE_BUILD=true + shift 1 + ;; + --install) + MODE_INSTALL=true + shift 1 + ;; + --all) + MODE_ALL=true + shift 1 + ;; + --help) + MODE_HELP=true + shift 1 + ;; + *) + break + ;; + esac +done + +# print to stdout, print to log +logprint() { + mkdir -p "${LOG_DIR}" + echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \ + | tee -a "${LOG_DIR}/${LOGFILE}" +} + +# Tell the user we're alive... +logprint "Initializing the ${APPNAME} utility..." + +# when the stage mode is enabled, this will execute +mode_stage() { + logprint "Starting stage of ${APPNAME}..." + + logprint "Removing any pre-existing staging for ${APPNAME}." + rm -Rf "${T_SOURCE_DIR}"* + + logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}" + tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}" + assert_zero $? + + # conditionally rename if it needs it + stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}" + + logprint "Staging operation complete." +} + +# when the build_pass1 mode is enabled, this will execute +mode_build() { + + # patch, configure and build + logprint "Starting build of ${APPNAME}..." + + logprint "Entering build dir." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Configuring ${APPNAME}..." + ./configure \ + --prefix=/usr \ + --docdir=/usr/share/doc/${APPNAME}-${VERSION} \ + --disable-setuid \ + --enable-cache-owner=bin \ + --with-browser=/usr/bin/lynx \ + --with-vgrind=/usr/bin/vgrind \ + --with-grap=/usr/bin/grap + assert_zero $? + + logprint "Compiling..." + make + assert_zero $? + + logprint "Checking" + make check + logprint "Checks exited with '$?'. " + + logprint "Build operation complete." +} + +mode_install() { + logprint "Starting install of ${APPNAME}..." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Installing..." + make install + assert_zero $? + + logprint "Install operation complete." +} + + +mode_help() { + echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]" + exit 1 +} + +if [ "$MODE_ALL" = "true" ]; then + MODE_STAGE=true + MODE_BUILD=true + MODE_INSTALL=true +fi + +# if no options were selected, then show help and exit +if \ + [ "$MODE_HELP" != "true" ] && \ + [ "$MODE_STAGE" != "true" ] && \ + [ "$MODE_BUILD" != "true" ] && \ + [ "$MODE_INSTALL" != "true" ] +then + logprint "No option selected during execution." + mode_help +fi + +# if help was supplied at all, show help and exit +if [ "$MODE_HELP" = "true" ]; then + logprint "Help option selected. Printing options and exiting." + mode_help +fi + +if [ "$MODE_STAGE" = "true" ]; then + logprint "Staging option selected." + mode_stage + assert_zero $? +fi + +if [ "$MODE_BUILD" = "true" ]; then + logprint "Build of ${APPNAME} selected." + mode_build + assert_zero $? +fi + +if [ "$MODE_INSTALL" = "true" ]; then + logprint "Install of ${APPNAME} selected." + mode_install + assert_zero $? +fi + +logprint "Execution of ${APPNAME} completed." diff --git a/rex.project/x86_64/components/stage4/procps-ng.bash b/rex.project/x86_64/components/stage4/procps-ng.bash new file mode 100755 index 0000000..f1cc614 --- /dev/null +++ b/rex.project/x86_64/components/stage4/procps-ng.bash @@ -0,0 +1,214 @@ +#!/bin/bash +# desc: +# stages, builds, installs + +# make variables persist in subprocesses for logging function +set -a + +# ---------------------------------------------------------------------- +# Configuration: +# ---------------------------------------------------------------------- +# the name of this application +APPNAME="procps-ng" + +# the version of this application +VERSION="4.0.2" + +# ---------------------------------------------------------------------- +# Variables and functions sourced from Environment: +# ---------------------------------------------------------------------- +# assert_zero() +# Checks if $1 is 0. If non-0 value, halts the execution of the script. +# +# LOGS_ROOT +# The parent directory where logs from this project will go. +# +# TEMP_STAGE_DIR +# The parent directory of where source archives are extracted to. + +# register mode selections +ARGUMENT_LIST=( + "stage" + "build" + "install" + "all" + "help" +) + +# modes to associate with switches +# assumes you want nothing done unless you ask for it. +MODE_STAGE=false +MODE_BUILD=false +MODE_INSTALL=false +MODE_ALL=false +MODE_HELP=false + +# the file to log to +LOGFILE="${APPNAME}.log" + +# ISO 8601 variation +TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)" + +# the path where logs are written to +# note: LOGS_ROOT is sourced from environment +LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}" + +# the path where the source will be located when complete +# note: TEMP_STAGE_DIR is sourced from environment +T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}" + +# read defined arguments +opts=$(getopt \ + --longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \ + --name "$APPNAME" \ + --options "" \ + -- "$@" +) + +# process supplied arguments into flags that enable execution modes +eval set --$opts +while [[ $# -gt 0 ]]; do + case "$1" in + --stage) + MODE_STAGE=true + shift 1 + ;; + --build) + MODE_BUILD=true + shift 1 + ;; + --install) + MODE_INSTALL=true + shift 1 + ;; + --all) + MODE_ALL=true + shift 1 + ;; + --help) + MODE_HELP=true + shift 1 + ;; + *) + break + ;; + esac +done + +# print to stdout, print to log +logprint() { + mkdir -p "${LOG_DIR}" + echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \ + | tee -a "${LOG_DIR}/${LOGFILE}" +} + +# Tell the user we're alive... +logprint "Initializing the ${APPNAME} utility..." + +# when the stage mode is enabled, this will execute +mode_stage() { + logprint "Starting stage of ${APPNAME}..." + + logprint "Removing any pre-existing staging for ${APPNAME}." + rm -Rf "${T_SOURCE_DIR}"* + + logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}" + tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}" + assert_zero $? + + # conditionally rename if it needs it + stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}" + + logprint "Staging operation complete." +} + +# when the build_pass1 mode is enabled, this will execute +mode_build() { + + # patch, configure and build + logprint "Starting build of ${APPNAME}..." + + logprint "Entering build dir." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Configuring ${APPNAME}..." + ./configure \ + --prefix=/usr \ + --docdir=/usr/share/doc/${APPNAME}-${VERSION} \ + --disable-static \ + --disable-kill \ + --with-systemd + assert_zero $? + + logprint "Compiling..." + make + assert_zero $? + + logprint "Checking" + make check + logprint "Checks exited with '$?'. " + + logprint "Build operation complete." +} + +mode_install() { + logprint "Starting install of ${APPNAME}..." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Installing..." + make install + assert_zero $? + + logprint "Install operation complete." +} + + +mode_help() { + echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]" + exit 1 +} + +if [ "$MODE_ALL" = "true" ]; then + MODE_STAGE=true + MODE_BUILD=true + MODE_INSTALL=true +fi + +# if no options were selected, then show help and exit +if \ + [ "$MODE_HELP" != "true" ] && \ + [ "$MODE_STAGE" != "true" ] && \ + [ "$MODE_BUILD" != "true" ] && \ + [ "$MODE_INSTALL" != "true" ] +then + logprint "No option selected during execution." + mode_help +fi + +# if help was supplied at all, show help and exit +if [ "$MODE_HELP" = "true" ]; then + logprint "Help option selected. Printing options and exiting." + mode_help +fi + +if [ "$MODE_STAGE" = "true" ]; then + logprint "Staging option selected." + mode_stage + assert_zero $? +fi + +if [ "$MODE_BUILD" = "true" ]; then + logprint "Build of ${APPNAME} selected." + mode_build + assert_zero $? +fi + +if [ "$MODE_INSTALL" = "true" ]; then + logprint "Install of ${APPNAME} selected." + mode_install + assert_zero $? +fi + +logprint "Execution of ${APPNAME} completed." diff --git a/rex.project/x86_64/components/stage4/util-linux.bash b/rex.project/x86_64/components/stage4/util-linux.bash new file mode 100755 index 0000000..6420e48 --- /dev/null +++ b/rex.project/x86_64/components/stage4/util-linux.bash @@ -0,0 +1,219 @@ +#!/bin/bash +# desc: +# stages, builds, installs + +# make variables persist in subprocesses for logging function +set -a + +# ---------------------------------------------------------------------- +# Configuration: +# ---------------------------------------------------------------------- +# the name of this application +APPNAME="util-linux" + +# the version of this application +VERSION="2.38.1" + +# ---------------------------------------------------------------------- +# Variables and functions sourced from Environment: +# ---------------------------------------------------------------------- +# assert_zero() +# Checks if $1 is 0. If non-0 value, halts the execution of the script. +# +# LOGS_ROOT +# The parent directory where logs from this project will go. +# +# TEMP_STAGE_DIR +# The parent directory of where source archives are extracted to. + +# register mode selections +ARGUMENT_LIST=( + "stage" + "build" + "install" + "all" + "help" +) + +# modes to associate with switches +# assumes you want nothing done unless you ask for it. +MODE_STAGE=false +MODE_BUILD=false +MODE_INSTALL=false +MODE_ALL=false +MODE_HELP=false + +# the file to log to +LOGFILE="${APPNAME}.log" + +# ISO 8601 variation +TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)" + +# the path where logs are written to +# note: LOGS_ROOT is sourced from environment +LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}" + +# the path where the source will be located when complete +# note: TEMP_STAGE_DIR is sourced from environment +T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}" + +# read defined arguments +opts=$(getopt \ + --longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \ + --name "$APPNAME" \ + --options "" \ + -- "$@" +) + +# process supplied arguments into flags that enable execution modes +eval set --$opts +while [[ $# -gt 0 ]]; do + case "$1" in + --stage) + MODE_STAGE=true + shift 1 + ;; + --build) + MODE_BUILD=true + shift 1 + ;; + --install) + MODE_INSTALL=true + shift 1 + ;; + --all) + MODE_ALL=true + shift 1 + ;; + --help) + MODE_HELP=true + shift 1 + ;; + *) + break + ;; + esac +done + +# print to stdout, print to log +logprint() { + mkdir -p "${LOG_DIR}" + echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \ + | tee -a "${LOG_DIR}/${LOGFILE}" +} + +# Tell the user we're alive... +logprint "Initializing the ${APPNAME} utility..." + +# when the stage mode is enabled, this will execute +mode_stage() { + logprint "Starting stage of ${APPNAME}..." + + logprint "Removing any pre-existing staging for ${APPNAME}." + rm -Rf "${T_SOURCE_DIR}"* + + logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}" + tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}" + assert_zero $? + + # conditionally rename if it needs it + stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}" + + logprint "Staging operation complete." +} + +# when the build_pass1 mode is enabled, this will execute +mode_build() { + + # patch, configure and build + logprint "Starting build of ${APPNAME}..." + + logprint "Entering build dir." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Configuring ${APPNAME}..." + ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --bindir=/usr/bin \ + --libdir=/usr/lib \ + --sbindir=/usr/sbin \ + --disable-chfn-chsh \ + --disable-login \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --docdir=/usr/share/doc/${APPNAME}-${VERSION} + assert_zero $? + + logprint "Compiling..." + make + assert_zero $? + + # TODO reflow this so that it runs tests as the test user + + logprint "Build operation complete." +} + +mode_install() { + logprint "Starting install of ${APPNAME}..." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Installing..." + make install + assert_zero $? + + logprint "Install operation complete." +} + + +mode_help() { + echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]" + exit 1 +} + +if [ "$MODE_ALL" = "true" ]; then + MODE_STAGE=true + MODE_BUILD=true + MODE_INSTALL=true +fi + +# if no options were selected, then show help and exit +if \ + [ "$MODE_HELP" != "true" ] && \ + [ "$MODE_STAGE" != "true" ] && \ + [ "$MODE_BUILD" != "true" ] && \ + [ "$MODE_INSTALL" != "true" ] +then + logprint "No option selected during execution." + mode_help +fi + +# if help was supplied at all, show help and exit +if [ "$MODE_HELP" = "true" ]; then + logprint "Help option selected. Printing options and exiting." + mode_help +fi + +if [ "$MODE_STAGE" = "true" ]; then + logprint "Staging option selected." + mode_stage + assert_zero $? +fi + +if [ "$MODE_BUILD" = "true" ]; then + logprint "Build of ${APPNAME} selected." + mode_build + assert_zero $? +fi + +if [ "$MODE_INSTALL" = "true" ]; then + logprint "Install of ${APPNAME} selected." + mode_install + assert_zero $? +fi + +logprint "Execution of ${APPNAME} completed." diff --git a/rex.project/x86_64/plans/stage4.plan b/rex.project/x86_64/plans/stage4.plan index 370bfe9..b7cd9ef 100644 --- a/rex.project/x86_64/plans/stage4.plan +++ b/rex.project/x86_64/plans/stage4.plan @@ -360,6 +360,31 @@ "name": "systemd", "dependencies": [ null ], "comment": "LFS 11.3-systemd-rc1 Ch. 8.72" + }, + { + "name": "dbus", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 8.73" + }, + { + "name": "man-db", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 8.74" + }, + { + "name": "procps-ng", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 8.75" + }, + { + "name": "util-linux", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 8.76" + }, + { + "name": "e2fsprogs", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 8.77" } ] } diff --git a/rex.project/x86_64/units/stage4.units b/rex.project/x86_64/units/stage4.units index 93081f6..cbbf912 100644 --- a/rex.project/x86_64/units/stage4.units +++ b/rex.project/x86_64/units/stage4.units @@ -1295,6 +1295,96 @@ "group": "root", "supply_environment": true, "environment": "environments/stage4.env.bash" + }, + { + "name": "dbus", + "target": "components/stage4/dbus.bash --all", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" + }, + { + "name": "man-db", + "target": "components/stage4/man-db.bash --all", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" + }, + { + "name": "procps-ng", + "target": "components/stage4/procps-ng.bash --all", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" + }, + { + "name": "util-linux", + "target": "components/stage4/util-linux.bash --all", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" + }, + { + "name": "e2fsprogs", + "target": "components/stage4/e2fsprogs.bash --all", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" } ] }