chroot cross-compilation / stage 2 complete / through Ch 7.3

master
phanes 2023-02-19 21:00:09 -05:00
parent 6051ca386f
commit b45e23b34a
20 changed files with 3325 additions and 22 deletions

View File

@ -185,8 +185,11 @@ mode_build_pass2() {
logprint "Entering build dir."
pushd "${T_SOURCE_DIR}"
# sourced from environment: checks $? -- aborts script execution if non-zero
assert_zero $?
# hrmmmmmm....
logprint "Hack to fix bundled libtool..."
sed '6009s/$add_dir//' -i ltmain.sh
assert_zero $?
logprint "Entering build subdir"
@ -194,7 +197,6 @@ mode_build_pass2() {
pushd build
assert_zero $?
# might be wrong, check if --enable-64-bit-bfd is needed on 64-bit targets
logprint "Configuring binutils pass2..."
../configure \
--prefix=/usr \
@ -202,12 +204,13 @@ mode_build_pass2() {
--host=${T_TRIPLET} \
--disable-nls \
--enable-shared \
--enable-gprofng=no \
--disable-werror \
--enable-64-bit-bfd
assert_zero $?
logprint "Compiling..."
make -j1
make
assert_zero $?
logprint "Build operation complete."
@ -218,7 +221,7 @@ mode_install_pass1() {
pushd "${T_SOURCE_DIR}/build"
assert_zero $?
make -j1 install
make install
assert_zero $?
logprint "Install operation complete."
@ -229,12 +232,12 @@ mode_install_pass2() {
pushd "${T_SOURCE_DIR}/build"
assert_zero $?
make -j1 DESTDIR=${T_SYSROOT} install
make DESTDIR=${T_SYSROOT} install
assert_zero $?
# doublecheck this
logprint "Clean up items..."
logprint "Applying hotfix for libctf.so / host zlib bug"
install -vm755 libctf/.libs/libctf.so.0.0.0 ${T_SYSROOT}/usr/lib
rm -v ${T_SYSROOT}/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la}
assert_zero $?
logprint "Install operation complete."

View File

@ -368,35 +368,42 @@ mode_build_gcc_pass2() {
patch -p0 < "${PATCHES_DIR}/gcc_libarchpath_fhs.patch"
assert_zero $?
# TODO turn this into a patch
logprint "Enabling posix thread support..."
sed '/thread_header =/s/@.*@/gthr-posix.h/' \
-i libgcc/Makefile.in libstdc++-v3/include/Makefile.in
assert_zero $?
logprint "Entering build subdirectory"
mkdir -p build
pushd build
assert_zero $?
logprint "Creating posix thread support compatibility symlink..."
mkdir -pv ${T_TRIPLET}/libgcc
assert_zero $?
ln -s ../../../libgcc/gthr-posix.h ${T_TRIPLET}/libgcc/gthr-default.h
assert_zero $?
# from SURRO+LFS, removed in LFS
# seems to be new cli arg introductions that address this...
#logprint "Creating posix thread support compatibility symlink..."
#mkdir -pv ${T_TRIPLET}/libgcc
#assert_zero $?
#ln -s ../../../libgcc/gthr-posix.h ${T_TRIPLET}/libgcc/gthr-default.h
#assert_zero $?
logprint "Configuring ${APPNAME}..."
../configure \
--build=$(../config.guess) \
--host=${T_TRIPLET} \
--target=${T_TRIPLET} \
LDFLAGS_FOR_TARGET=-L$PWD/${T_TRIPLET}/libgcc \
--prefix=/usr \
CC_FOR_TARGET=${T_TRIPLET}-gcc \
--with-build-sysroot=${T_SYSROOT} \
--enable-initfini-array \
--enable-default-pie \
--enable-default-ssp \
--disable-nls \
--disable-multilib \
--disable-decimal-float \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++
assert_zero $?
@ -412,7 +419,7 @@ mode_install_gcc_pass2() {
pushd "${T_SOURCE_DIR}/build"
assert_zero $?
make -j1 DESTDIR=${T_SYSROOT} install
make -DESTDIR=${T_SYSROOT} install
assert_zero $?

View File

@ -0,0 +1,223 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="bash"
# the version of this application
VERSION="5.2.15"
# ----------------------------------------------------------------------
# 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 \
--build=$(sh support/config.guess) \
--host=${T_TRIPLET} \
--without-bash-malloc
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} install
assert_zero $?
logprint "Cleaning up installation..."
# from SURRO
#logprint "Moving /usr/bin/bash to /bin/bash"
#mv ${T_SYSROOT}/usr/bin/bash ${T_SYSROOT}/bin/bash
#assert_zero $?
logprint "Creating /bin/sh->bash symlink for T_SYSROOT"
ln -sv bash ${T_SYSROOT}/bin/sh
# TODO update this section to check if a symlink points to bash here and create it if it's not there.
#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,228 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="coreutils"
# the version of this application
VERSION="9.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 \
--host=${T_TRIPLET} \
--build=$(build-aux/config.guess) \
--enable-install-program=hostname \
--enable-no-install-program=kill,uptime
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} install
assert_zero $?
logprint "Cleaning up installation..."
logprint "Moving programs to final locations..."
mv -v ${T_SYSROOT}/usr/bin/chroot ${T_SYSROOT}/usr/sbin/
assert_zero $?
# TODO: investigate removing this entirely once an explanation is found
logprint "Doin' wacky shit with the chroot manpage for some reason..."
mkdir -vp ${T_SYSROOT}/usr/share/man/man8
assert_zero $?
mv -v ${T_SYSROOT}/usr/share/man/man1/chroot.1 ${T_SYSROOT}/usr/share/man/man8/chroot.8
assert_zero $?
sed -i 's/"1"/"8"/' ${T_SYSROOT}/usr/share/man/man8/chroot.8
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,208 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="diffutils"
# the version of this application
VERSION="3.9"
# ----------------------------------------------------------------------
# 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 \
--host=${T_TRIPLET}
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} 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,230 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="file"
# the version of this application
VERSION="5.44"
# ----------------------------------------------------------------------
# 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 "Building a local file for signature file generation"
mkdir -pv build
pushd build
assert_zero $?
../configure \
--disable-bzlib \
--disable-libseccomp \
--disable-xzlib \
--disable-zlib
assert_zero $?
make
assert_zero $?
popd
logprint "Configuring ${APPNAME}..."
./configure \
--prefix=/usr \
--host=${T_TRIPLET} \
--build=$(./config.guess)
assert_zero $?
logprint "Compiling..."
make FILE_COMPILE=$(pwd)/build/src/file
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}/build"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} install
assert_zero $?
# error in FHS
#logprint "Cleaning up libtool archives..."
#rm -v ${T_SYSROOT}/usr/lib/libmagic.la
#assert_zero $?
logprint "Install operation complete."
}
mode_help() {
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
exit 1
}
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,209 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="findutils"
# the version of this application
VERSION="4.9.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_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 \
--localstatedir=/var/lib/locate \
--host=${T_TRIPLET} \
--build=$(build-aux/config.guess)
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} 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,30 @@
#!/bin/bash
# Prepares sysroot ownership and perms for chrooting
# print to stdout, print to log
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
APPNAME="FIX_CHROOT_PERMS"
# ISO 8601 variation
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
logprint() {
mkdir -p "${LOG_DIR}"
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
| tee -a "${LOG_DIR}/${LOGFILE}"
}
logprint "Fixing ownership on T_SYSROOT"
chown -R root:root ${T_SYSROOT}/{usr,lib,var,etc,bin,sbin}
assert_zero $?
chown -R root:root ${CROSSTOOLS_DIR}
assert_zero $?
chown -R root:root ${ARCHLIB_DIR}
assert_zero $?

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="gawk"
# the version of this application
VERSION="5.2.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 $?
# TODO make this a patch
logprint "Adjusting makefile..."
sed -i 's/extras//' Makefile.in
logprint "Configuring ${APPNAME}..."
./configure \
--prefix=/usr \
--host=${T_TRIPLET} \
--build=$(build-aux/config.guess)
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} 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,207 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="grep"
# the version of this application
VERSION="3.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_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 \
--host=${T_TRIPLET}
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} 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,215 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="gzip"
# the version of this application
VERSION="1.12"
# ----------------------------------------------------------------------
# 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 \
--host=${T_TRIPLET}
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} install
assert_zero $?
#logprint "Cleanup items..."
#logprint "Moving files to their proper location..."
# from SURRO
# looks wrong
#mv -v ${T_SYSROOT}/usr/bin/gzip ${T_SYSROOT}/bin
#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,217 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="make"
# the version of this application
VERSION="4.4"
# ----------------------------------------------------------------------
# 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 $?
# from LFS
# TODO turn this into a patch
logprint "Prebuild hacks..."
sed -e '/ifdef SIGPIPE/,+2 d' \
-e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \
-i src/main.c
assert_zero $?
logprint "Configuring ${APPNAME}..."
./configure \
--without-guile \
--prefix=/usr \
--host=${T_TRIPLET} \
--build=$(build-aux/config.guess)
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} 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,207 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="patch"
# the version of this application
VERSION="2.7.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_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 \
--host=${T_TRIPLET} \
--build=$(build-aux/config.guess)
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} 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,88 @@
#!/bin/bash
# Prepares sysroot ownership and perms for chrooting
# print to stdout, print to log
# the path where logs are written to
# note: LOGS_ROOT is sourced from environment
APPNAME="CHROOT VFS SETUP"
# ISO 8601 variation
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
# the file to log to
LOGFILE="${APPNAME}.log"
logprint() {
mkdir -p "${LOG_DIR}"
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
| tee -a "${LOG_DIR}/${LOGFILE}"
}
is_mounted() {
findmnt $1 &> /dev/null
if [ $? != 0 ]; then
/usr/bin/false
else
/usr/bin/true
fi
}
logprint "CHROOT VFS SETUP"
mkdir -pv ${T_SYSROOT}/{dev,proc,sys,run}
assert_zero $?
logprint "Bind mounting /dev from host to chroot sysroot..."
is_mounted ${T_SYSROOT}/dev || mount -v --bind /dev ${T_SYSROOT}/dev
assert_zero $?
logprint "Bind mounting /dev/pts from host to chroot sysroot..."
is_mounted ${T_SYSROOT}/dev/pts || mount -v --bind /dev/pts ${T_SYSROOT}/dev/pts
assert_zero $?
logprint "mounting proc filesystem from to chroot sysroot..."
is_mounted ${T_SYSROOT}/proc || mount -v -t proc proc ${T_SYSROOT}/proc
assert_zero $?
# not a symlink on ubuntu
if [ -h ${T_SYSROOT}/dev/shm ]; then
mkdir -vp ${T_SYSROOT}/$(readlink ${T_SYSROOT})/dev/shm
assert_zero $?
else
mount -t tmpfs -o nosuid,nodev tmpfs ${T_SYSROOT}/dev/shm
fi
# don't remember what this was for
#logprint "Creating mount point for project root."
#mkdir -pv ${T_SYSROOT}/${PROJECT_ROOT}
#assert_zero $?
## source these majors and minors
#logprint "Creating block device for console..."
#sudo rm -f ${T_SYSROOT}/dev/console
#mknod -m 600 ${T_SYSROOT}/dev/console c 5 1
#assert_zero $?
# source these majors and minors
#logprint "Create block device for null..."
#sudo rm -f ${T_SYSROOT}/dev/null
#mknod -m 666 ${T_SYSROOT}/dev/null c 1 3
#logprint "mounting /sys filesystem from to chroot sysroot..."
#is_mounted ${T_SYSROOT}/sys || mount -v -t sysfs sysfs ${T_SYSROOT}/sys
#assert_zero $?
#logprint "mounting tmpfs/run filesystem from to chroot sysroot..."
#is_mounted ${T_SYSROOT}/run || mount -v -t tmpfs tmpfs ${T_SYSROOT}/run
#assert_zero $?
#logprint "bind mounting stage 2 files for posterity!"
#is_mounted ${T_SYSROOT}${PROJECT_ROOT} || mount -v --bind ${PROJECT_ROOT} ${T_SYSROOT}${PROJECT_ROOT}
#assert_zero $?
#logprint "Copy Rex to Chroot"
#mkdir -p ${T_SYSROOT}/usr/local/bin
#stat ${T_SYSROOT}/usr/local/bin/rex 2>/dev/null || cp -Rf /usr/local/bin/rex ${T_SYSROOT}/usr/local/bin/rex
#assert_zero $?

View File

@ -0,0 +1,207 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="sed"
# the version of this application
VERSION="4.9"
# ----------------------------------------------------------------------
# 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 \
--host=${T_TRIPLET}
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} 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,208 @@
#!/bin/bash
# desc:
# stages, builds, installs
# make variables persist in subprocesses for logging function
set -a
# ----------------------------------------------------------------------
# Configuration:
# ----------------------------------------------------------------------
# the name of this application
APPNAME="tar"
# the version of this application
VERSION="1.34"
# ----------------------------------------------------------------------
# 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 \
--host=${T_TRIPLET} \
--build=$(build-aux/config.guess)
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} 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="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 \
--host=${T_TRIPLET} \
--build=$(build-aux/config.guess) \
--disable-static \
--docdir=/usr/share/doc/xz-${VERSION}
assert_zero $?
logprint "Compiling..."
make
assert_zero $?
logprint "Build operation complete."
}
mode_install_temp() {
logprint "Starting install of ${APPNAME}..."
pushd "${T_SOURCE_DIR}"
assert_zero $?
logprint "Installing..."
make DESTDIR=${T_SYSROOT} install
assert_zero $?
logprint "Cleaning up..."
rm -v ${T_SYSROOT}/usr/lib/liblzma.la
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

@ -42,7 +42,6 @@ umask 022
# $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=${T_SYSROOT}/usr/share/config.site
@ -67,5 +66,5 @@ assert_zero() {
exit $1
fi
}
ARCHLIB_DIR=${T_SYSROOT}/lib64
PATH=${CROSSTOOLS_DIR}/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin

View File

@ -14,7 +14,92 @@
{
"name": "ncurses pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.2 (temp tools)"
"comment": "LFS 11.3-systemd-rc1 Ch. 6.3 (temp tools)"
},
{
"name": "bash pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.4 (temp tools)"
},
{
"name": "coreutils pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.5 (temp tools)"
},
{
"name": "diffutils pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.6 (temp tools)"
},
{
"name": "file pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.7 (temp tools)"
},
{
"name": "findutils pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.8 (temp tools)"
},
{
"name": "gawk pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.9 (temp tools)"
},
{
"name": "grep pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.10 (temp tools)"
},
{
"name": "gzip pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.11 (temp tools)"
},
{
"name": "make pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.12 (temp tools)"
},
{
"name": "patch pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.13 (temp tools)"
},
{
"name": "sed pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.14 (temp tools)"
},
{
"name": "tar pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.15 (temp tools)"
},
{
"name": "xz pass 1",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.16 (temp tools)"
},
{
"name": "binutils pass 2",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.17 (temp tools)"
},
{
"name": "gcc pass 2",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 6.18 (temp tools)"
},
{
"name": "set sysroot ownership for chroot",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 7.2 (chroot)"
},
{
"name": "preparing virtual kernel file systems",
"dependencies": [ null ],
"comment": "LFS 11.3-systemd-rc1 Ch. 7.3 (chroot)"
}
]
}

View File

@ -53,6 +53,312 @@
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "bash pass 1",
"target": "components/stage2/bash.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "coreutils pass 1",
"target": "components/stage2/coreutils.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "diffutils pass 1",
"target": "components/stage2/diffutils.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "file pass 1",
"target": "components/stage2/file.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "findutils pass 1",
"target": "components/stage2/findutils.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "gawk pass 1",
"target": "components/stage2/gawk.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "grep pass 1",
"target": "components/stage2/grep.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "gzip pass 1",
"target": "components/stage2/gzip.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "make pass 1",
"target": "components/stage2/make.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "patch pass 1",
"target": "components/stage2/patch.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "sed pass 1",
"target": "components/stage2/sed.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "tar pass 1",
"target": "components/stage2/tar.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "xz pass 1",
"target": "components/stage2/xz.bash --all_temp",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "binutils pass 2",
"target": "components/stage1/binutils.bash --pass2",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
},
{
"name": "gcc pass 2",
"target": "components/stage1/gcc.bash --gcc_pass2",
"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": "phanes",
"group": "phanes",
"supply_environment": true,
"environment": "environments/stage2.env.bash"
}
{
"name": "set sysroot ownership for chroot",
"target": "components/stage1/fix_chroot_perms.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/stage2.env.bash"
},
{
"name": "preparing virtual kernel file systems",
"target": "components/stage1/prepare_vkfs.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/stage2.env.bash"
}
]
}