various typo fixes and progress up to 8.8

master
phanes 2023-02-26 15:36:36 -05:00
parent 7868997024
commit 05c65e8d1d
34 changed files with 1859 additions and 21 deletions

View File

@ -11,59 +11,78 @@ ifndef project_root
else
clean:
clean_unsafe:
set -e
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/clean.sh"
clean:
set -e
make disarm_chroot
make clean_unsafe
# same as clean, but retain logs
purge_artifacts:
set -e
${dir_make}/purge_artifacts.sh
# these need run in the following order:
dirs:
set -e
${dir_make}/dirs.sh
# installs the latest version of rex from master branch
# will later be tied to a release tag
install_rex:
set -e
${dir_make}/install_rex.sh
# installs the versions designed for this run
download_sources:
set -e
${dir_make}/download_sources.sh
# ""
download_patches:
set -e
${dir_make}/download_patches.sh
# kicks off rex
build_stage1:
set -e
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage1.sh"
# kicks off rex
build_stage2:
set -e
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage2.sh"
arm_chroot:
set -e
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/arm_chroot.sh"
disarm_chroot:
set -e
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/disarm_chroot.sh"
# do not enter the chroot like this unless you have run arm_chroot.
# build_stage2 does this automatically.
enter_chroot:
set -e
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/enter_chroot.sh"
#embeds and kicks off rex from inside chroot
build_stage3:
set -e
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage3.sh"
# offers to back up
build_stage4backup:
set -e
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage4backup.sh"
build_stage4:
set -e
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage4.sh"
@ -79,7 +98,21 @@ build_stage4:
# optional: make build_stage4backup
# make build_stage4
all: disarm_chroot clean dirs install_rex download_patches download_sources build_stage1 build_stage2 build_stage3 build_stage4backup build_stage4
.ONESHELL:
all:
set -e; \
make disarm_chroot && \
make clean && \
make dirs && \
make install_rex && \
make download_patches && \
make download_sources && \
make build_stage1 && \
make build_stage2 && \
make build_stage3 && \
make build_stage4backup && \
make build_stage4
# Remember, before you make clean or make purge_artifacts you MUST run
# make disarm_chroot beforehand or you could cause irreversible damage

2
configs/etc_ld.so.conf Normal file
View File

@ -0,0 +1,2 @@
include /etc/ld.so.conf.d/*.conf

View File

@ -0,0 +1 @@
/opt/lib

View File

@ -0,0 +1 @@
/usr/local/lib

15
configs/etc_nsswitch.conf Normal file
View File

@ -0,0 +1,15 @@
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
# End /etc/nsswitch.conf

View File

@ -17,3 +17,4 @@ ${dir_localtools}/rex -v \
-p ${dir_rex}/x86_64/plans/stage1.plan
retVal=$?
exit $retVal

View File

@ -17,3 +17,4 @@ ${dir_localtools}/rex -v \
-p ${dir_rex}/x86_64/plans/stage2.plan
retVal=$?
exit $retVal

View File

@ -30,3 +30,4 @@ dir_rex=/rex_embedded/rex.project
retVal=$?
echo "Rex exited with error code '$retVal'."
exit $retVal

View File

@ -30,3 +30,4 @@ dir_rex=/rex_embedded/rex.project
retVal=$?
echo "Rex exited with error code '$retVal'."
exit $retVal

View File

@ -16,3 +16,4 @@ ${dir_localtools}/rex -v \
-p ${dir_rex}/x86_64/plans/stage4backup.plan
retVal=$?
exit $retVal

View File

@ -7,3 +7,4 @@ echo
echo "Deleting ${dir_stage}"
rm -Rf ${dir_logs}
echo

View File

@ -30,3 +30,4 @@ err=$?
popd 1>/dev/null 2>/dev/null
echo "Finished with exit code $err"
exit $err

View File

@ -28,3 +28,4 @@ err=$?
popd 1>/dev/null 2>/dev/null
echo "Finished with exit code $err"
exit $err

View File

@ -30,3 +30,4 @@ logprint() {
PS1='\n(dark horse linux) [ \u @ \H ] << \w >>\n\n[- ' \
PATH=/usr/bin:/usr/sbin \
/bin/bash --login
exit $?

View File

@ -134,7 +134,7 @@ mode_build_pass1() {
pushd ${TEMP_STAGE_DIR}
assert_zero $?
echo "rootsbindir=/usr/sbin" > configparms
echo "rootsbindir=/usr/sbin" > ${T_SOURCE_DIR}/configparms
assert_zero $?
# fuck this part in particular!

View File

@ -4,7 +4,7 @@
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
APPNAME="CHROOT PASSWD/GROUPS"
APPNAME="CHROOT PASSWD GROUPS"
# ISO 8601 variation
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"

View File

@ -29,7 +29,7 @@ rm -rvf /usr/share/{info,man,doc}/*
assert_zero $?
logprint "Removing temp libtool artifacts..."
find /usr/{lib,exec} -name \*.la -delete
find /usr/{lib,libexec} -name \*.la -delete
assert_zero $?
logprint "Cleaning out Temporary Cross-Compilation Toolchain"

View File

@ -29,7 +29,7 @@ ln -sv /proc/self/mounts /etc/mtab
assert_zero $?
logprint "Staging /etc/hosts file"
cp -f ${dir_configs}/etc_hosts /etc/hosts
cp -f ${CONFIGS_DIR}/etc_hosts /etc/hosts
assert_zero $?
logprint "creating a temporary user and group for some tests later"

View File

@ -0,0 +1,122 @@
#!/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.36.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
# 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}"
# 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
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
build() {
# patch, configure and build
logprint "Starting build of temporary getopt from ${APPNAME}..."
logprint "Creating hwclock dir..."
mkdir -pv ${T_SYSROOT}/var/lib/hwclock
logprint "Entering stage dir."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Configuring ${APPNAME}..."
./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
--docdir=/usr/share/doc/util-linux-2.36.2 \
--disable-chfn-chsh \
--disable-login \
--disable-nologin \
--disable-su \
--disable-setpriv \
--disable-runuser \
--disable-pylibmount \
--disable-static \
--without-python \
runstatedir=/run
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
install_getopt() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing getopt..."
cp -v ./getopt ${T_SYSROOT}/usr/local/bin/getopt
assert_zero $?
logprint "Install operation complete."
}
stage
build
install_getopt
logprint "Execution of ${APPNAME} completed."

View File

@ -40,7 +40,7 @@ ARGUMENT_LIST=(
MODE_STAGE=false
MODE_BUILD=false
MODE_INSTALL=false
MODE_ALL=false
MODE_ALL=true
MODE_HELP=false
# the file to log to
@ -128,11 +128,6 @@ mode_build() {
# patch, configure and build
logprint "Starting build of ${APPNAME}..."
logprint "Removing pre-staged getopt utility..."
rm -f /usr/local/bin/getopt
assert_zero $?
# silently fail, since it's already there from earlier
mkdir -p /var/lib/hwclock
assert_zero $?
@ -142,7 +137,7 @@ mode_build() {
logprint "Configuring ${APPNAME}..."
./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
--libdir==/usr/lib \
--libdir=/usr/lib \
--docdir=/usr/share/doc/util-linux-${VERSION} \
--disable-chfn-chsh \
--disable-login \
@ -171,6 +166,10 @@ mode_install() {
logprint "Installing..."
make install
assert_zero $?
logprint "Installing getopt..."
cp ./getopt /usr/bin/
assert_zero $?
logprint "Partial install operation complete."
}

View File

@ -0,0 +1,240 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="bzip2"
# the version of this application
VERSION="1.0.8"
# ----------------------------------------------------------------------
# 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 stage dir."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Applying documentation install patch..."
patch -Np1 -i ${PATCHES_DIR}/bzip2-1.0.8-install_docs-1.patch
assert_zero $?
# create this
logprint "Applying relative symbolic links patch..."
patch -Np1 -i ${PATCHES_DIR}/bzip2-1.0.8-relative_links.patch
assert_zero $?
# create this
logprint "Applying man page path fix patch..."
patch -Np1 -i ${PATCHES_DIR}/bzip2-1.0.8-man_path.patch
assert_zero $?
logprint "Compiling..."
make -f Makefile-libbz2_so
assert_zero $?
make clean
assert_zero $?
make
assert_zero $?
logprint "Build operation complete."
}
mode_install() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make PREFIX=/usr install
assert_zero $?
logprint "Cleaning up..."
cp -av libbz2.so.* /usr/lib/
assert_zero $?
ln -sv libbz2.so.${VERSION} /usr/lib/libbz2.so
assert_zero $?
cp -v bzip2-shared /bin/bzip2
assert_zero $?
for i in /usr/bin/{bzcat,bunzip2}; do
ln -sfv bzip2 $i
assert_zero $?
done
rm -fv /usr/lib/libbz2.a
assert_zero $?
logprint "Install operation complete."
}
mode_help() {
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --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."

View File

@ -0,0 +1,315 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="glibc"
# the version of this application
VERSION="2.37"
# ----------------------------------------------------------------------
# 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}/pass1 of stage2..."
logprint "Entering stage dir."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Applying patches..."
patch -Np1 -i ${PATCHES_DIR}/glibc-${VERSION}-fhs-1.patch
assert_zero $?
# TODO make this a patch
sed '/width -=/s/workend - string/number_length/' -i stdio-common/vfprintf-process-arg.c
assert_zero $?
logprint "Entering temp build dir..."
mkdir -p build
pushd build
assert_zero $?
# TODO make this a patch
echo "rootsbindir=/usr/sbin" > ${T_SOURCE_DIR}/build/configparms
assert_zero $?
logprint "Configuring ${APPNAME}..."
../configure \
--prefix=/usr \
--disable-werror \
--enable-kernel=3.2 \
--enable-stack-protector=strong \
--with-headers=/usr/include \
libc_cv_slibdir=/usr/lib
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Testing build..."
make check
logprint "Build operation complete."
}
mode_install() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}/build"
assert_zero $?
logprint "Creating empty ld.so.conf"
touch /etc/ld.so.conf
assert_zero $?
# TODO make this a patch
logprint "Patching the makefile... :/"
sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
assert_zero $?
logprint "Installing..."
make install
assert_zero $?
logprint "Doing the ridiculous glibc post-install work..."
logprint "Fixing hardcoded path to the executable loader in the ldd script"
sed '/RTLDLIST=/s@/usr@@g' -i /usr/bin/ldd
assert_zero $?
logprint "Installing /etc/nscd.conf"
cp -v ../nscd/nscd.conf /etc/nscd.conf
assert_zero $?
logprint "Creating /var/cache/nscd"
mkdir -pv /var/cache/nscd
logprint "Installing systemD support for nscd..."
install -v -Dm644 ../nscd/nscd.tmpfiles /usr/lib/tmpfiles.d/nscd.conf
assert_zero $?
install -v -Dm644 ../nscd/nscd.service /usr/lib/systemd/system/nscd.service
assert_zero $?
mkdir -pv /usr/lib/locale
assert_zero $?
logprint "Installing locale definitions..."
make localedata/install-locales
assert_zero $?
localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
assert_zero $?
logprint "Installing /etc/nsswitch.conf"
cp -vf ${CONFIGS_DIR}/etc_nsswitch.conf /etc/nsswitch.conf
assert_zero $?
logprint "Installing tzdata which glibc should totally be remotely related to (not)..."
mkdir -p tzdata
pushd tzdata
assert_zero $?
tar -xvf ${SOURCES_DIR}/tzdata2022g.tar.gz -C ./
ZI=/usr/share/zoneinfo
mkdir -p ${ZI}/{posix,right}
for TZ in etcetera southamerica northamerica europe africa antarctica asia australasia backward; do
zic -L /dev/null -d ${ZI} ${TZ}
zic -L /dev/null -d ${ZI}/posix ${TZ}
zic -L leapseconds -d ${ZI}/right ${TZ}
done
cp -v zone.tab zone1970.tab iso3166.tab ${ZI}
assert_zero $?
# this will likely become part of the installer for TZ selection
# NOTE: really should default to UTC until set by user at that point
zic -d ${ZI} -p America/New_York
assert_zero $?
unset ${ZI}
logprint "Setting timezone to UTC..."
ln -sfv /usr/share/zoneinfo/UTC /etc/localtime
assert_zero $?
logprint "Installing /etc/ld.so.conf"
cp -vf ${CONFIGS_DIR}/etc_ld.so.conf /etc/ld.so.conf
assert_zero $?
mkdir -pv /etc/ld.so.conf.d
asset_zero $?
cp -vf ${CONFIGS_DIR}/etc_ld.so.conf.d_usr-local-lib.conf /etc/ld.so.conf.d/user-local-lib.conf
assert_zero $?
cp -vf ${CONFIGS_DIR}/etc_ld.so.conf.d_opt-lib.conf /etc/ld.so.conf.d/opt-lib.conf
assert_zero $?
logprint "Glibc install operation complete. Jesus-- we think?"
}
mode_help() {
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --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."

View File

@ -0,0 +1,194 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="iana-etc"
# the version of this application
VERSION="20230202"
# ----------------------------------------------------------------------
# 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() {
logprint "Nothing to build."
}
mode_install() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
cp -v services /etc
assert_zero $?
cp -v protocols /etc
assert_zero $?
logprint "install operation complete."
}
mode_help() {
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --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."

View File

@ -0,0 +1,191 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="man-pages"
# the version of this application
VERSION="6.03"
# ----------------------------------------------------------------------
# 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() {
logprint "Nothing to build."
}
mode_install() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make prefix=/usr install
assert_zero $?
logprint "install operation complete."
}
mode_help() {
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --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."

View File

@ -0,0 +1,48 @@
HORSE=$(cat <<'EOH'
⠀⠀⠀⠀⠀⠀⢀⠀⠀⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠘⣦⡀⠘⣆⠈⠛⠻⣗⠶⣶⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⣿⠀⠈⠳⠄⠀⠈⠙⠶⣍⡻⢿⣷⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣰⣿⣧⠀⠀⠀⠀⠀⠀⠀⠈⠻⣮⡹⣿⣿⣷⣦⣄⣀⠀⠀⢀⣸⠃⠀⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢠⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣮⢿⣿⣿⣿⣿⣿⣿⣿⠟⠀⢰⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⣾⣿⠀⠀⠀⠀⠀⠀⠀⣷⠀⢷⠀⠀⠀⠙⢷⣿⣿⣿⣿⣟⣋⣀⣤⣴⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⣼⢿⣿⡀⠀⠀⢀⣀⣴⣾⡟⠀⠈⣇⠀⠀⠀⠈⢻⡙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣼⡏⠸⣿⣿⣶⣾⣿⡿⠟⠋⠀⠀⠀⢹⡆⠀⠀⠀⠀⠹⡽⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣰⣿⠀⠀⠀⣀⡿⠛⠉⠀⠀⢿⠀⠀⠀⠘⣿⡄⠀⠀⠀⠀⠑⢹⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣷⣶⣾⠏⠀⠀⠀⠀⠀⠘⣇⠀⠀⠀⢻⡇⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⡿⠃⠀⣠⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠈⠙⠿⠿⠋⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⢸⣷⠀⠀⠀⠀⠀⢀⠀⠹⣿⣿⣿⣿⣷⣶⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠀⠀⠀⢸⣿⠀⠀⠀⠀⢀⡞⠀⠀⠈⠛⠻⠿⠿⠯⠥⠤⢄⣀⣀⢀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠀⠀⠀⢸⡇⠀⠀⠀⢀⡼⠃⠀⠀⠀⠀⠀⣄⠀⠀⠀⠀⠀⠀⠈⠙⠂⠙⠳⢤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠇⠀⠀⠀⡾⠁⠀⠀⣠⡿⠃⠀⠀⠀⠀⠀⠀⠸⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠀⠀⠀⡸⠃⠀⢀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣷⣶⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⠇⠀⠀⠀⠃⢀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠏⠀⠀⠀⠀⣰⡟⠁⠀⠀⠀ ⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣧⠙⠻⣿⣿⣿⣿⣿⣿⣦⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⢀⡖⢰⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠟⠀⠀⠀⢸⣿⠀⠀⠈⢿⣿⣿⣿⣿⣿⡿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡇⠀⠀⣼⠁⠼⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⣼⡇⠀⠀⣠⣾⣿⣿⣿⣿⠟⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠘⣇⠀⠀⢻⡄⢠⡄⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⡴⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠟⠁⠀⠀⠀⢀⣼⠏⠀⣠⣾⣿⣿⡿⣿⡿⠁⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⠁⠀⠘⠂⠀⠀⢳⠀⢳⡀⠀⠀⠀⠀⠀⠀⢀⡼⠁⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣾⣿⠃⠀⠀⠀⠀⣠⣾⠃⣠⣾⣿⣿⠿⠋⢰⡟⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢠⣿⠃⠀⠀⠀⢀⣀⡴⠞⠙⠲⣷⡄⠀⠀⠀⠀⢠⡾⠁⠀⠀⠀⢀⣀⣠⣤⣶⠿⠟⠋⠀⡾⠀⠀⠀⢀⣴⠟⠁⢠⡟⢱⡿⠃⠀⠀⠸⣇⡀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⡴⠟⠁⠀⣀⡤⠖⠋⠁⠀⠀⠀⠀⣸⠇⠀⠀⠀⣤⠟⠑⠋⠉⣿⠋⠉⠉⠉⠁⣠⠞⠀⠀⠀⡇⠀⠀⢠⡿⠋⠀⠀⠈⠁⡿⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀
⠀⠀⠀⢀⣾⣏⣤⣶⡾⠛⠉⠀⠀⠀⠀⠀⠀⢀⡼⠃⠀⠀⣠⠞⠁⠀⠀⠀⠀⣿⠀⠀⠀⢀⡼⠃⠀⠀⠀⢸⠇⠀⣰⠟⠀⠀⠀⠀⠀⠐⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣿⣿⡿⠛⠁⠀⠀⠀⠀⠀⠀⠀⢀⣴⠏⠀⠀⣠⠞⠁⠀⠀⠀⠀⠀⠀⣿⠀⠀⢀⡾⠃⠀⠀⠀⢀⡞⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣼⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⣶⣶⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⣾⠇⠀⠀⠀⢀⣾⣣⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢠⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠀⢠⡟⠀⠀⠀⢀⣾⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⡄⢀⣀⡀⠀⠀⠀⠀⠀⠀⢸⡇⠀⣾⠇⠀⠀⣰⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢸⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⣾⠀⣰⠟⠀⢀⣼⣿⣿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢸⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠿⠿⠿⠿⠃⠀⠀⠀⢸⣿⣶⠏⢀⣴⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢸⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⠃⢠⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⢃⣴⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠈⠛⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣧⣾⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⡟⢸⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⠁⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠿⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
EOH
)
echo
echo
echo -e "\e[31m$HORSE\e[0m"
echo
echo "Welcome to Pyrois, the build system for Dark Horse Linux."
echo
echo "Stage 4, PRIME TIME - Ya made it!"
echo

View File

@ -0,0 +1,212 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="xz"
# the version of this application
VERSION="5.4.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_temp"
"install_temp"
"all_temp"
"help"
)
# modes to associate with switches
# assumes you want nothing done unless you ask for it.
MODE_STAGE=false
MODE_BUILD_TEMP=false
MODE_INSTALL_TEMP=false
MODE_ALL_TEMP=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_temp)
MODE_BUILD_TEMP=true
shift 1
;;
--install_temp)
MODE_INSTALL_TEMP=true
shift 1
;;
--all_temp)
MODE_ALL_TEMP=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_temp() {
# patch, configure and build
logprint "Starting build of ${APPNAME}..."
logprint "Entering stage dir."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Configuring ${APPNAME}..."
./configure \
--prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/xz-5.2.5
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
make check
logprint "Make check exited with exit code '$?'."
logprint "Build operation complete."
}
mode_install_temp() {
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 0
}
if [ "$MODE_ALL_TEMP" = "true" ]; then
MODE_STAGE=true
MODE_BUILD_TEMP=true
MODE_INSTALL_TEMP=true
fi
# if no options were selected, then show help and exit
if \
[ "$MODE_HELP" != "true" ] && \
[ "$MODE_STAGE" != "true" ] && \
[ "$MODE_BUILD_TEMP" != "true" ] && \
[ "$MODE_INSTALL_TEMP" != "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_TEMP" = "true" ]; then
logprint "Build of ${APPNAME} selected."
mode_build_temp
assert_zero $?
fi
if [ "$MODE_INSTALL_TEMP" = "true" ]; then
logprint "Install of ${APPNAME} selected."
mode_install_temp
assert_zero $?
fi
logprint "Execution of ${APPNAME} completed."

View File

@ -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="zlib"
# the version of this application
VERSION="1.2.13"
# ----------------------------------------------------------------------
# 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 stage dir."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Configuring ${APPNAME}..."
./configure --prefix=/usr
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Checking zlib"
make check
logprint "Make check completed with exit code '$?'."
logprint "Build operation complete."
}
mode_install() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make install
assert_zero $?
logprint "Removing unused artifacts..."
rm -fv /usr/lib/libz.a
assert_zero $?
logprint "Install operation complete."
}
mode_help() {
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --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."

View File

@ -55,7 +55,7 @@ TEMP_STAGE_DIR=${T_SYSROOT}/source_stage
# from project_config
SOURCES_DIR=${dir_sources}
PATCHES_DIR=${dir_patches}
LOGS_ROOT=${dir_logs}
LOGS_ROOT=${dir_logs}/apps/stage1
# fail the unit in the event of a non-zero value passed
# used primarily to check exit codes on previous commands

View File

@ -54,7 +54,7 @@ TEMP_STAGE_DIR=${T_SYSROOT}/source_stage
# from project_config
SOURCES_DIR=${dir_sources}
PATCHES_DIR=${dir_patches}
LOGS_ROOT=${dir_logs}
LOGS_ROOT=${dir_logs}/apps/stage2
# fail the unit in the event of a non-zero value passed
# used primarily to check exit codes on previous commands

View File

@ -55,7 +55,8 @@ TEMP_STAGE_DIR=/source_stage
# from project_config
SOURCES_DIR=/rex_embedded/stage/sources
PATCHES_DIR=/rex_embedded/stage/patches
LOGS_ROOT=/rex_embedded/logs
LOGS_ROOT=/rex_embedded/logs/apps/stage3
CONFIGS_DIR=/rex_embedded/configs
# fail the unit in the event of a non-zero value passed
# used primarily to check exit codes on previous commands

View File

@ -0,0 +1,71 @@
set -a
# We now do paths relative to / since we are INSIDE $T_SYSROOT
TERM=xterm-256color
COLORTERM=truecolor
LC_ALL=C
function echofail() {
echo
echo "FAILED: $1"
echo
exit 1
}
rex_dir="/rex_embedded"
# keeps talking about T_SYSROOT as $LFS
# wants $LFS path to be a mount
# needs to be set for any user including root
#2.6
# sourced from project_config
T_SYSROOT="/"
LFS=${T_SYSROOT}
# 4.3 we skip user and group creation, it's expected to be done before
# you start if you want a different user than you're running as
# == after that, configure the rex unit for dir creation to use that user
if [ "$(id -u)" -ne 0 ]; then
echo "Not running as root."
fi
# 4.4
# The set +h command turns off bash's hash function, which affects caching of paths for executables
set +h
# ensures newly created files and directories are only writable by their owner, but are readable and executable by anyone
umask 022
# sets a comptabile machine name description for use when building crosstools that isn't going to be what the host system is using
# $LFS_TGT is what LFS uses for this
T_TRIPLET=x86_64-dhl-linux-gnu
# prevents some configure scripts from looking in the wrong place for config.site
CONFIG_SITE=/usr/share/config.site
# 4.5
MAKEFLAGS="-j$(nproc)"
# where the cross-compiler gets installed ($LFS/tools)
TEMP_STAGE_DIR=/source_stage
# from project_config
SOURCES_DIR=/rex_embedded/stage/sources
PATCHES_DIR=/rex_embedded/stage/patches
LOGS_ROOT=/rex_embedded/logs/apps/stage4
CONFIGS_DIR=/rex_embedded/configs
# fail the unit in the event of a non-zero value passed
# used primarily to check exit codes on previous commands
# also a great convenient place to add in a "press any key to continue"
assert_zero() {
if [[ "$1" -eq 0 ]]; then
return
else
exit $1
fi
}
ARCHLIB_DIR=/lib64
PATH=/usr/bin:/usr/sbin

View File

@ -16,6 +16,11 @@
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 7.6"
},
{
"name": "util-linux",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 7.12"
},
{
"name": "gettext",
"dependencies": [ null ],
@ -41,11 +46,6 @@
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 7.11"
},
{
"name": "util-linux",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 7.12"
},
{
"name": "cleaning up the temp system",
"dependencies": [ null ],

View File

@ -0,0 +1,40 @@
{
"plan":
[
{
"name": "welcome 4",
"dependencies": [ null ],
"comment": "greet the user"
},
{
"name": "man pages",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 8.3"
},
{
"name": "iana-etc",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 8.4"
},
{
"name": "glibc final",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 8.5"
},
{
"name": "zlib",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 8.6"
},
{
"name": "bzip2",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 8.7"
},
{
"name": "xz",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 8.8"
}
]
}

View File

@ -0,0 +1,130 @@
{
"units": [
{
"name": "welcome 4",
"target": "components/stage4/welcome.bash",
"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 pages",
"target": "components/stage4/man-pages.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": "iana-etc",
"target": "components/stage4/iana-etc.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": "glibc final",
"target": "components/stage4/glibc.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": "zlib",
"target": "components/stage4/zlib.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": "bzip2",
"target": "components/stage4/bzip2.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": "xz",
"target": "components/stage4/xz.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"
}
]
}