forked from Dark-Horse-Linux/pyrois
adding missing livecd files
parent
8b7e0cc32f
commit
2ce0b4fb7a
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
mkdir /run/overlay
|
||||
|
||||
# Set up the overlay filesystem
|
||||
mount -t tmpfs tmpfs /run/overlay
|
||||
mkdir -p /run/overlay/upper
|
||||
mkdir -p /run/overlay/work
|
||||
mkdir -p /run/overlay/root
|
||||
|
||||
mount -t overlay overlay -o lowerdir=/,upperdir=/run/overlay/upper,workdir=/run/overlay/work /run/overlay/root
|
||||
|
||||
# Pivot the root filesystem to the overlay filesystem
|
||||
pivot_root /run/overlay/root /run/overlay/root/mnt
|
||||
|
||||
# Move the original mount points to their new locations
|
||||
for i in dev proc sys run; do
|
||||
mount --move /mnt/$i /$i
|
||||
done
|
||||
|
||||
# Clean up and switch to the new init
|
||||
umount /mnt
|
||||
exec chroot . /sbin/init <dev/console >dev/console 2>&1
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -u
|
||||
|
||||
APPNAME="CHROOT VFS SETUP"
|
||||
T_SYSROOT=${dir_sysroot}
|
||||
set -a
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -u
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
ulimit -l unlimited
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -u
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
ulimit -l unlimited
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
# closely aligns with LFS Ch 5, 6
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -u
|
||||
# closely aligns with LFS Ch 5, 6
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
ulimit -l unlimited
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
ulimit -l unlimited
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
ulimit -l unlimited
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# clean the slate
|
||||
set -u
|
||||
|
||||
echo
|
||||
echo "Deleting ${dir_stage}"
|
||||
rm -Rf ${dir_stage}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -u
|
||||
|
||||
function echofail() {
|
||||
echo $1
|
||||
exit 1
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -u
|
||||
|
||||
APPNAME="CHROOT VKFS SETUP"
|
||||
|
||||
# ISO 8601 variation
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
function echofail() {
|
||||
echo "FAILED: $1"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
function echofail() {
|
||||
echo "FAILED: $1"
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -u
|
||||
|
||||
|
||||
APPNAME="CHROOT VFS SETUP"
|
||||
T_SYSROOT=${dir_sysroot}
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -u
|
||||
|
||||
function echofail() {
|
||||
echo "Failed: $1"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -u
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
ulimit -l unlimited
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
ulimit -l unlimited
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -u
|
||||
|
||||
echo
|
||||
echo "Recreating ${dir_artifacts}"
|
||||
rm -Rf ${dir_artifacts}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
|
||||
set -u
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
# ----------------------------------------------------------------------
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
APPNAME="livecd"
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
@ -326,6 +327,9 @@ mode_install_pass2() {
|
|||
rm -v ${T_SYSROOT}/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la}
|
||||
assert_zero $?
|
||||
|
||||
rm -v rm -fv /usr/share/man/man1/{gprofng,gp-*}.1
|
||||
assert_zero $?
|
||||
|
||||
logprint "Install operation complete."
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
# Simple script to list version numbers of critical development tools
|
||||
set -u
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
echo
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
mkdir -pv ${dir_sysroot}/{etc,var} ${dir_sysroot}/usr/{bin,lib,sbin} || echofail "Creating sysroot directories..."
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# print to stdout, print to log
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
set -u
|
||||
|
||||
APPNAME="FIX_CHROOT_PERMS"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
|
||||
set -u
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
# ----------------------------------------------------------------------
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# print to stdout, print to log
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
set -u
|
||||
|
||||
APPNAME="CHROOT PASSWD GROUPS"
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# print to stdout, print to log
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
set -u
|
||||
|
||||
APPNAME="CHROOT VFS SETUP"
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
set -u
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# print to stdout, print to log
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
set -u
|
||||
|
||||
APPNAME="Cleaning up the Temporary System"
|
||||
|
||||
|
|
|
@ -0,0 +1,219 @@
|
|||
#!/bin/bash
|
||||
# desc:
|
||||
# stages, builds, installs
|
||||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
# ----------------------------------------------------------------------
|
||||
# the name of this application
|
||||
APPNAME="squashfs"
|
||||
|
||||
# the version of this application
|
||||
VERSION="4.6.1"
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Variables and functions sourced from Environment:
|
||||
# ----------------------------------------------------------------------
|
||||
# assert_zero()
|
||||
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||
#
|
||||
# LOGS_ROOT
|
||||
# The parent directory where logs from this project will go.
|
||||
#
|
||||
# TEMP_STAGE_DIR
|
||||
# The parent directory of where source archives are extracted to.
|
||||
|
||||
# register mode selections
|
||||
ARGUMENT_LIST=(
|
||||
"stage"
|
||||
"build"
|
||||
"install"
|
||||
"all"
|
||||
"help"
|
||||
)
|
||||
|
||||
# modes to associate with switches
|
||||
# assumes you want nothing done unless you ask for it.
|
||||
MODE_STAGE=false
|
||||
MODE_BUILD=false
|
||||
MODE_INSTALL=false
|
||||
MODE_ALL=false
|
||||
MODE_HELP=false
|
||||
|
||||
# the file to log to
|
||||
LOGFILE="${APPNAME}.log"
|
||||
|
||||
# ISO 8601 variation
|
||||
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||
|
||||
mkdir -p ${TEMP_STAGE_DIR}
|
||||
# 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}"
|
||||
echo "${SOURCES_DIR}/${APPNAME}${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||
tar xf "${SOURCES_DIR}/${APPNAME}${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
# conditionally rename if it needs it
|
||||
stat "${T_SOURCE_DIR}"* && mv "${T_SOURCE_DIR}"* "${T_SOURCE_DIR}"
|
||||
|
||||
logprint "Staging operation complete."
|
||||
}
|
||||
|
||||
# when the build_pass1 mode is enabled, this will execute
|
||||
mode_build() {
|
||||
|
||||
# patch, configure and build
|
||||
logprint "Starting build of ${APPNAME}..."
|
||||
|
||||
logprint "Entering build dir."
|
||||
pushd "${T_SOURCE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
pushd squashfs-tools
|
||||
assert_zero $?
|
||||
|
||||
logprint "Compiling..."
|
||||
make
|
||||
assert_zero $?
|
||||
|
||||
logprint "Build operation complete."
|
||||
}
|
||||
|
||||
mode_install() {
|
||||
logprint "Starting install of ${APPNAME}..."
|
||||
pushd "${T_SOURCE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
pushd squashfs-tools
|
||||
assert_zero $?
|
||||
|
||||
# fixing nonsense
|
||||
#sed -i 's/ECHO=$(which echo)/ECHO="echo"/' ../generate-manpages/functions.sh
|
||||
#assert_zero $?
|
||||
|
||||
#sed -i '4,8s/^/#/' ../generate-manpages/functions.sh
|
||||
#assert_zero $?
|
||||
|
||||
sed -i 's|INSTALL_DIR = $(INSTALL_PREFIX)/bin|INSTALL_DIR = /usr/sbin|' Makefile
|
||||
assert_zero $?
|
||||
|
||||
logprint "Installing..."
|
||||
make install
|
||||
assert_zero $?
|
||||
|
||||
logprint "Install operation complete."
|
||||
}
|
||||
|
||||
|
||||
mode_help() {
|
||||
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$MODE_ALL" = "true" ]; then
|
||||
MODE_STAGE=true
|
||||
MODE_BUILD=true
|
||||
MODE_INSTALL=true
|
||||
fi
|
||||
|
||||
# if no options were selected, then show help and exit
|
||||
if \
|
||||
[ "$MODE_HELP" != "true" ] && \
|
||||
[ "$MODE_STAGE" != "true" ] && \
|
||||
[ "$MODE_BUILD" != "true" ] && \
|
||||
[ "$MODE_INSTALL" != "true" ]
|
||||
then
|
||||
logprint "No option selected during execution."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
# if help was supplied at all, show help and exit
|
||||
if [ "$MODE_HELP" = "true" ]; then
|
||||
logprint "Help option selected. Printing options and exiting."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
if [ "$MODE_STAGE" = "true" ]; then
|
||||
logprint "Staging option selected."
|
||||
mode_stage
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_BUILD" = "true" ]; then
|
||||
logprint "Build of ${APPNAME} selected."
|
||||
mode_build
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_INSTALL" = "true" ]; then
|
||||
logprint "Install of ${APPNAME} selected."
|
||||
mode_install
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
logprint "Execution of ${APPNAME} completed."
|
|
@ -0,0 +1,205 @@
|
|||
#!/bin/bash
|
||||
# desc:
|
||||
# stages, builds, installs
|
||||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
# ----------------------------------------------------------------------
|
||||
# the name of this application
|
||||
APPNAME="which"
|
||||
|
||||
# the version of this application
|
||||
VERSION="2.21"
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Variables and functions sourced from Environment:
|
||||
# ----------------------------------------------------------------------
|
||||
# assert_zero()
|
||||
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||
#
|
||||
# LOGS_ROOT
|
||||
# The parent directory where logs from this project will go.
|
||||
#
|
||||
# TEMP_STAGE_DIR
|
||||
# The parent directory of where source archives are extracted to.
|
||||
|
||||
# register mode selections
|
||||
ARGUMENT_LIST=(
|
||||
"stage"
|
||||
"build"
|
||||
"install"
|
||||
"all"
|
||||
"help"
|
||||
)
|
||||
|
||||
# modes to associate with switches
|
||||
# assumes you want nothing done unless you ask for it.
|
||||
MODE_STAGE=false
|
||||
MODE_BUILD=false
|
||||
MODE_INSTALL=false
|
||||
MODE_ALL=false
|
||||
MODE_HELP=false
|
||||
|
||||
# the file to log to
|
||||
LOGFILE="${APPNAME}.log"
|
||||
|
||||
# ISO 8601 variation
|
||||
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||
|
||||
# the path where the source will be located when complete
|
||||
# note: TEMP_STAGE_DIR is sourced from environment
|
||||
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||
|
||||
# read defined arguments
|
||||
opts=$(getopt \
|
||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||
--name "$APPNAME" \
|
||||
--options "" \
|
||||
-- "$@"
|
||||
)
|
||||
|
||||
# process supplied arguments into flags that enable execution modes
|
||||
eval set --$opts
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--stage)
|
||||
MODE_STAGE=true
|
||||
shift 1
|
||||
;;
|
||||
--build)
|
||||
MODE_BUILD=true
|
||||
shift 1
|
||||
;;
|
||||
--install)
|
||||
MODE_INSTALL=true
|
||||
shift 1
|
||||
;;
|
||||
--all)
|
||||
MODE_ALL=true
|
||||
shift 1
|
||||
;;
|
||||
--help)
|
||||
MODE_HELP=true
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# print to stdout, print to log
|
||||
logprint() {
|
||||
mkdir -p "${LOG_DIR}"
|
||||
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||
}
|
||||
|
||||
# Tell the user we're alive...
|
||||
logprint "Initializing the ${APPNAME} utility..."
|
||||
|
||||
# when the stage mode is enabled, this will execute
|
||||
mode_stage() {
|
||||
logprint "Starting stage of ${APPNAME}..."
|
||||
|
||||
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||
rm -Rf "${T_SOURCE_DIR}"*
|
||||
|
||||
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
# conditionally rename if it needs it
|
||||
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
|
||||
|
||||
logprint "Staging operation complete."
|
||||
}
|
||||
|
||||
# when the build_pass1 mode is enabled, this will execute
|
||||
mode_build() {
|
||||
|
||||
# patch, configure and build
|
||||
logprint "Starting build of ${APPNAME}..."
|
||||
|
||||
logprint "Entering build dir."
|
||||
pushd "${T_SOURCE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
logprint "Configuring ${APPNAME}..."
|
||||
./configure --prefix=/usr
|
||||
assert_zero $?
|
||||
|
||||
logprint "Compiling..."
|
||||
make
|
||||
assert_zero $?
|
||||
|
||||
logprint "Build operation complete."
|
||||
}
|
||||
|
||||
mode_install() {
|
||||
logprint "Starting install of ${APPNAME}..."
|
||||
pushd "${T_SOURCE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
logprint "Installing..."
|
||||
make install
|
||||
assert_zero $?
|
||||
|
||||
logprint "Install operation complete."
|
||||
}
|
||||
|
||||
|
||||
mode_help() {
|
||||
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$MODE_ALL" = "true" ]; then
|
||||
MODE_STAGE=true
|
||||
MODE_BUILD=true
|
||||
MODE_INSTALL=true
|
||||
fi
|
||||
|
||||
# if no options were selected, then show help and exit
|
||||
if \
|
||||
[ "$MODE_HELP" != "true" ] && \
|
||||
[ "$MODE_STAGE" != "true" ] && \
|
||||
[ "$MODE_BUILD" != "true" ] && \
|
||||
[ "$MODE_INSTALL" != "true" ]
|
||||
then
|
||||
logprint "No option selected during execution."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
# if help was supplied at all, show help and exit
|
||||
if [ "$MODE_HELP" = "true" ]; then
|
||||
logprint "Help option selected. Printing options and exiting."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
if [ "$MODE_STAGE" = "true" ]; then
|
||||
logprint "Staging option selected."
|
||||
mode_stage
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_BUILD" = "true" ]; then
|
||||
logprint "Build of ${APPNAME} selected."
|
||||
mode_build
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_INSTALL" = "true" ]; then
|
||||
logprint "Install of ${APPNAME} selected."
|
||||
mode_install
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
logprint "Execution of ${APPNAME} completed."
|
|
@ -0,0 +1,75 @@
|
|||
set -a
|
||||
|
||||
source ./project_config.sh
|
||||
|
||||
TERM=xterm-256color
|
||||
COLORTERM=truecolor
|
||||
LC_ALL=C
|
||||
|
||||
function echofail() {
|
||||
echo
|
||||
echo "FAILED: $1"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 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=${dir_sysroot}
|
||||
LFS=${T_SYSROOT}
|
||||
|
||||
rex_dir="/rex_embedded"
|
||||
|
||||
|
||||
# 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=${T_SYSROOT}/usr/share/config.site
|
||||
|
||||
# 4.5
|
||||
MAKEFLAGS="-j$(nproc)"
|
||||
|
||||
# where the cross-compiler gets installed ($LFS/tools)
|
||||
CROSSTOOLS_DIR=${T_SYSROOT}/xtools
|
||||
TEMP_STAGE_DIR=${T_SYSROOT}/source_stage
|
||||
# from project_config
|
||||
SOURCES_DIR=${dir_sources}
|
||||
PATCHES_DIR=${dir_patches}
|
||||
LOGS_ROOT=${dir_logs}/apps/stage2
|
||||
CONFIGS_DIR=${dir_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=${T_SYSROOT}/lib64
|
||||
PATH=${CROSSTOOLS_DIR}/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin
|
Loading…
Reference in New Issue