forked from Dark-Horse-Linux/pyrois
up thorugh 17.13.2, backup facility needs additional testing
parent
4b302e0c89
commit
7868997024
14
Makefile
14
Makefile
|
@ -55,10 +55,18 @@ disarm_chroot:
|
|||
enter_chroot:
|
||||
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/enter_chroot.sh"
|
||||
|
||||
#embeds and kicks off rex
|
||||
#embeds and kicks off rex from inside chroot
|
||||
build_stage3:
|
||||
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage3.sh"
|
||||
|
||||
# offers to back up
|
||||
build_stage4backup:
|
||||
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage4backup.sh"
|
||||
|
||||
build_stage4:
|
||||
sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage4.sh"
|
||||
|
||||
|
||||
# example:
|
||||
# make dirs
|
||||
# make install_rex
|
||||
|
@ -68,8 +76,10 @@ build_stage3:
|
|||
# make build_stage2
|
||||
# optional: make enter_chroot
|
||||
# make build_stage3
|
||||
# optional: make build_stage4backup
|
||||
# make build_stage4
|
||||
|
||||
all: disarm_chroot clean dirs install_rex download_patches download_sources build_stage1 build_stage2 build_stage3
|
||||
all: disarm_chroot clean dirs install_rex download_patches download_sources build_stage1 build_stage2 build_stage3 build_stage4backup build_stage4
|
||||
|
||||
# Remember, before you make clean or make purge_artifacts you MUST run
|
||||
# make disarm_chroot beforehand or you could cause irreversible damage
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
127.0.0.1 localhost localhost.localdomain
|
||||
::1 localhost
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
ulimit -l unlimited
|
||||
|
||||
#ulimit -n 10240
|
||||
ulimit -c unlimited
|
||||
|
||||
|
||||
# closely aligns with LFS Ch 5, 6
|
||||
T_SYSROOT=${dir_sysroot}
|
||||
|
||||
project_root=/rex_embedded
|
||||
|
||||
echo "Bootstrapping from MAKE to REX..."
|
||||
dir_rex=/rex_embedded/rex.project
|
||||
|
||||
# Executes rex from within the chroot.
|
||||
/usr/sbin/chroot "${T_SYSROOT}" /usr/bin/env -i \
|
||||
HOME="/" \
|
||||
TERM="$TERM" \
|
||||
COLORTERM=$COLORTERM \
|
||||
PS1='\n(Dark Horse Linux) [ \u @ \H ] << \w >>\n\n[- ' \
|
||||
PATH=/usr/bin:/usr/sbin \
|
||||
project_root="${project_root}" \
|
||||
dir_rex="${dir_rex}" \
|
||||
dir_logs="/${project_root}/logs" \
|
||||
/rex_embedded/stage/rex/rex -v -c ${dir_rex}/x86_64/rex.config -p ${dir_rex}/x86_64/plans/stage4.plan
|
||||
|
||||
|
||||
retVal=$?
|
||||
echo "Rex exited with error code '$retVal'."
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# fix an issue with open files limit on some hosts
|
||||
ulimit -l unlimited
|
||||
|
||||
#ulimit -n 10240
|
||||
ulimit -c unlimited
|
||||
|
||||
echo "Bootstrapping from MAKE to REX..."
|
||||
|
||||
# Executes rex from within the shell.
|
||||
|
||||
${dir_localtools}/rex -v \
|
||||
-c ${dir_rex}/x86_64/rex.config \
|
||||
-p ${dir_rex}/x86_64/plans/stage4backup.plan
|
||||
|
||||
retVal=$?
|
|
@ -17,6 +17,7 @@ echo "Loading project_config.sh...."
|
|||
# this is where the directory for foster is located. serves as the
|
||||
# parent directory for most other directories
|
||||
project_root="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
|
||||
|
||||
# the project files for the make system that is used to orchestrate the
|
||||
# build steps
|
||||
dir_make=${project_root}/make.project
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
#!/bin/bash
|
||||
# desc:
|
||||
# stages, builds, installs
|
||||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
# ----------------------------------------------------------------------
|
||||
# the name of this application
|
||||
APPNAME="bison"
|
||||
|
||||
# the version of this application
|
||||
VERSION="3.8.2"
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Variables and functions sourced from Environment:
|
||||
# ----------------------------------------------------------------------
|
||||
# assert_zero()
|
||||
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||
#
|
||||
# LOGS_ROOT
|
||||
# The parent directory where logs from this project will go.
|
||||
#
|
||||
# TEMP_STAGE_DIR
|
||||
# The parent directory of where source archives are extracted to.
|
||||
|
||||
# register mode selections
|
||||
ARGUMENT_LIST=(
|
||||
"stage"
|
||||
"build"
|
||||
"install"
|
||||
"all"
|
||||
"help"
|
||||
)
|
||||
|
||||
# modes to associate with switches
|
||||
# assumes you want nothing done unless you ask for it.
|
||||
MODE_STAGE=false
|
||||
MODE_BUILD=false
|
||||
MODE_INSTALL=false
|
||||
MODE_ALL=false
|
||||
MODE_HELP=false
|
||||
|
||||
# the file to log to
|
||||
LOGFILE="${APPNAME}.log"
|
||||
|
||||
# ISO 8601 variation
|
||||
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||
|
||||
# the path where the source will be located when complete
|
||||
# note: TEMP_STAGE_DIR is sourced from environment
|
||||
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||
|
||||
# read defined arguments
|
||||
opts=$(getopt \
|
||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||
--name "$APPNAME" \
|
||||
--options "" \
|
||||
-- "$@"
|
||||
)
|
||||
|
||||
# process supplied arguments into flags that enable execution modes
|
||||
eval set --$opts
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--stage)
|
||||
MODE_STAGE=true
|
||||
shift 1
|
||||
;;
|
||||
--build)
|
||||
MODE_BUILD=true
|
||||
shift 1
|
||||
;;
|
||||
--install)
|
||||
MODE_INSTALL=true
|
||||
shift 1
|
||||
;;
|
||||
--all)
|
||||
MODE_ALL=true
|
||||
shift 1
|
||||
;;
|
||||
--help)
|
||||
MODE_HELP=true
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# print to stdout, print to log
|
||||
logprint() {
|
||||
mkdir -p "${LOG_DIR}"
|
||||
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||
}
|
||||
|
||||
# Tell the user we're alive...
|
||||
logprint "Initializing the ${APPNAME} utility..."
|
||||
|
||||
# when the stage mode is enabled, this will execute
|
||||
mode_stage() {
|
||||
logprint "Starting stage of ${APPNAME}..."
|
||||
|
||||
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||
rm -Rf "${T_SOURCE_DIR}"*
|
||||
|
||||
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
# conditionally rename if it needs it
|
||||
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
|
||||
|
||||
logprint "Staging operation complete."
|
||||
}
|
||||
|
||||
# when the build_pass1 mode is enabled, this will execute
|
||||
mode_build() {
|
||||
|
||||
# patch, configure and build
|
||||
logprint "Starting build of ${APPNAME}..."
|
||||
|
||||
logprint "Entering stage dir."
|
||||
pushd "${T_SOURCE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
logprint "Configuring ${APPNAME}..."
|
||||
./configure --prefix=/usr --docdir=/usr/share/doc/bison-${VERSION}
|
||||
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 "Partial install operation complete."
|
||||
}
|
||||
|
||||
|
||||
mode_help() {
|
||||
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --help ]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$MODE_ALL" = "true" ]; then
|
||||
MODE_STAGE=true
|
||||
MODE_BUILD=true
|
||||
MODE_INSTALL=true
|
||||
fi
|
||||
|
||||
# if no options were selected, then show help and exit
|
||||
if \
|
||||
[ "$MODE_HELP" != "true" ] && \
|
||||
[ "$MODE_STAGE" != "true" ] && \
|
||||
[ "$MODE_BUILD" != "true" ] && \
|
||||
[ "$MODE_INSTALL" != "true" ]
|
||||
then
|
||||
logprint "No option selected during execution."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
# if help was supplied at all, show help and exit
|
||||
if [ "$MODE_HELP" = "true" ]; then
|
||||
logprint "Help option selected. Printing options and exiting."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
if [ "$MODE_STAGE" = "true" ]; then
|
||||
logprint "Staging option selected."
|
||||
mode_stage
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_BUILD" = "true" ]; then
|
||||
logprint "Build of ${APPNAME} selected."
|
||||
mode_build
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_INSTALL" = "true" ]; then
|
||||
logprint "Install of ${APPNAME} selected."
|
||||
mode_install
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
logprint "Execution of ${APPNAME} completed."
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#!/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="Cleaning up the Temporary System"
|
||||
|
||||
# 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}"
|
||||
}
|
||||
|
||||
logprint "Cleaning up the Temporary System"
|
||||
|
||||
|
||||
# this may need an alternative approach when we shift deliverables towards an install iso
|
||||
logprint "Removing temp documentation files..."
|
||||
rm -rvf /usr/share/{info,man,doc}/*
|
||||
assert_zero $?
|
||||
|
||||
logprint "Removing temp libtool artifacts..."
|
||||
find /usr/{lib,exec} -name \*.la -delete
|
||||
assert_zero $?
|
||||
|
||||
logprint "Cleaning out Temporary Cross-Compilation Toolchain"
|
||||
rm -Rf ${CROSSTOOLS_DIR}
|
||||
assert_zero $?
|
|
@ -0,0 +1,56 @@
|
|||
#!/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="Creating Essential Files and Symlinks"
|
||||
|
||||
# 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}"
|
||||
}
|
||||
|
||||
logprint "Creating Essential Files and Symlinks"
|
||||
|
||||
|
||||
# this may need an alternative approach when we shift deliverables towards an install iso
|
||||
logprint "Generating /etc/mtab from /proc/self/mounts"
|
||||
ln -sv /proc/self/mounts /etc/mtab
|
||||
assert_zero $?
|
||||
|
||||
logprint "Staging /etc/hosts file"
|
||||
cp -f ${dir_configs}/etc_hosts /etc/hosts
|
||||
assert_zero $?
|
||||
|
||||
logprint "creating a temporary user and group for some tests later"
|
||||
echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd
|
||||
assert_zero $?
|
||||
echo "tester:x:101:" >> /etc/group
|
||||
assert_zero $?
|
||||
|
||||
logprint "creating the tester user home dir"
|
||||
install -o tester -d /home/tester
|
||||
assert_zero $?
|
||||
|
||||
logprint "creating log placeholders for login/agetty/init/btmp/lastlog"
|
||||
touch /var/log/{btmp,lastlog,faillog,wtmp}
|
||||
assert_zero $?
|
||||
|
||||
chgrp -v utmp /var/log/lastlog
|
||||
assert_zero $?
|
||||
|
||||
chmod -v 664 /var/log/lastlog
|
||||
assert_zero $?
|
||||
|
||||
chmod -v 600 /var/log/btmp
|
||||
assert_zero $?
|
|
@ -0,0 +1,72 @@
|
|||
#!/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="Creating system directories"
|
||||
|
||||
# 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}"
|
||||
}
|
||||
|
||||
logprint "Creating system directories..."
|
||||
|
||||
mkdir -pv /{boot,home,mnt,opt,srv}
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /etc/{opt,sysconfig}
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /lib/firmware
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /media/{floppy,cdrom}
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /usr/{,local/}{include,src}
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /usr/local/{bin,lib,sbin}
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /usr/{,local/}share/man/man{1..8}
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /var/{cache,local,log,mail,opt,spool}
|
||||
assert_zero $?
|
||||
|
||||
mkdir -pv /var/lib/{color,misc,locate}
|
||||
assert_zero $?
|
||||
|
||||
ln -sfv /run /var/run
|
||||
assert_zero $?
|
||||
|
||||
ln -sfv /run/lock /var/lock
|
||||
assert_zero $?
|
||||
|
||||
install -dv -m 0750 /root
|
||||
assert_zero $?
|
||||
|
||||
install -dv -m 1777 /tmp /var/tmp
|
||||
assert_zero $?
|
||||
|
||||
# additional FHS compliance directories go here
|
||||
# these are only a subset
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
#!/bin/bash
|
||||
# desc:
|
||||
# stages, builds, installs
|
||||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
# ----------------------------------------------------------------------
|
||||
# the name of this application
|
||||
APPNAME="gettext"
|
||||
|
||||
# the version of this application
|
||||
VERSION="0.21.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 --disable-shared
|
||||
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..."
|
||||
cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin/
|
||||
assert_zero $?
|
||||
|
||||
logprint "Partial 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."
|
||||
|
|
@ -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="perl"
|
||||
|
||||
# the version of this application
|
||||
VERSION="5.36.0"
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Variables and functions sourced from Environment:
|
||||
# ----------------------------------------------------------------------
|
||||
# assert_zero()
|
||||
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||
#
|
||||
# LOGS_ROOT
|
||||
# The parent directory where logs from this project will go.
|
||||
#
|
||||
# TEMP_STAGE_DIR
|
||||
# The parent directory of where source archives are extracted to.
|
||||
|
||||
# register mode selections
|
||||
ARGUMENT_LIST=(
|
||||
"stage"
|
||||
"build"
|
||||
"install"
|
||||
"all"
|
||||
"help"
|
||||
)
|
||||
|
||||
# modes to associate with switches
|
||||
# assumes you want nothing done unless you ask for it.
|
||||
MODE_STAGE=false
|
||||
MODE_BUILD=false
|
||||
MODE_INSTALL=false
|
||||
MODE_ALL=false
|
||||
MODE_HELP=false
|
||||
|
||||
# the file to log to
|
||||
LOGFILE="${APPNAME}.log"
|
||||
|
||||
# ISO 8601 variation
|
||||
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||
|
||||
# the path where the source will be located when complete
|
||||
# note: TEMP_STAGE_DIR is sourced from environment
|
||||
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||
|
||||
# read defined arguments
|
||||
opts=$(getopt \
|
||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||
--name "$APPNAME" \
|
||||
--options "" \
|
||||
-- "$@"
|
||||
)
|
||||
|
||||
# process supplied arguments into flags that enable execution modes
|
||||
eval set --$opts
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--stage)
|
||||
MODE_STAGE=true
|
||||
shift 1
|
||||
;;
|
||||
--build)
|
||||
MODE_BUILD=true
|
||||
shift 1
|
||||
;;
|
||||
--install)
|
||||
MODE_INSTALL=true
|
||||
shift 1
|
||||
;;
|
||||
--all)
|
||||
MODE_ALL=true
|
||||
shift 1
|
||||
;;
|
||||
--help)
|
||||
MODE_HELP=true
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# print to stdout, print to log
|
||||
logprint() {
|
||||
mkdir -p "${LOG_DIR}"
|
||||
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||
}
|
||||
|
||||
# Tell the user we're alive...
|
||||
logprint "Initializing the ${APPNAME} utility..."
|
||||
|
||||
# when the stage mode is enabled, this will execute
|
||||
mode_stage() {
|
||||
logprint "Starting stage of ${APPNAME}..."
|
||||
|
||||
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||
rm -Rf "${T_SOURCE_DIR}"*
|
||||
|
||||
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
# conditionally rename if it needs it
|
||||
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
|
||||
|
||||
logprint "Staging operation complete."
|
||||
}
|
||||
|
||||
# when the build_pass1 mode is enabled, this will execute
|
||||
mode_build() {
|
||||
|
||||
# patch, configure and build
|
||||
logprint "Starting build of ${APPNAME}..."
|
||||
|
||||
logprint "Entering stage dir."
|
||||
pushd "${T_SOURCE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
logprint "Configuring ${APPNAME}..."
|
||||
sh Configure \
|
||||
-des \
|
||||
-Dprefix=/usr \
|
||||
-Dvendorprefix=/usr \
|
||||
-Dprivlib=/usr/lib/perl5/${VERSION}/core_perl \
|
||||
-Darchlib=/usr/lib/perl5/${VERSION}/core_perl \
|
||||
-Dsitelib=/usr/lib/perl5/${VERSION}/site_perl \
|
||||
-Dsitearch=/usr/lib/perl5/${VERSION}/site_perl \
|
||||
-Dvendorlib=/usr/lib/perl5/${VERSION}/vendor_perl \
|
||||
-Dvendorarch=/usr/lib/perl5/${VERSION}/vendor_perl
|
||||
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 "Partial install operation complete."
|
||||
}
|
||||
|
||||
|
||||
mode_help() {
|
||||
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --help ]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$MODE_ALL" = "true" ]; then
|
||||
MODE_STAGE=true
|
||||
MODE_BUILD=true
|
||||
MODE_INSTALL=true
|
||||
fi
|
||||
|
||||
# if no options were selected, then show help and exit
|
||||
if \
|
||||
[ "$MODE_HELP" != "true" ] && \
|
||||
[ "$MODE_STAGE" != "true" ] && \
|
||||
[ "$MODE_BUILD" != "true" ] && \
|
||||
[ "$MODE_INSTALL" != "true" ]
|
||||
then
|
||||
logprint "No option selected during execution."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
# if help was supplied at all, show help and exit
|
||||
if [ "$MODE_HELP" = "true" ]; then
|
||||
logprint "Help option selected. Printing options and exiting."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
if [ "$MODE_STAGE" = "true" ]; then
|
||||
logprint "Staging option selected."
|
||||
mode_stage
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_BUILD" = "true" ]; then
|
||||
logprint "Build of ${APPNAME} selected."
|
||||
mode_build
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_INSTALL" = "true" ]; then
|
||||
logprint "Install of ${APPNAME} selected."
|
||||
mode_install
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
logprint "Execution of ${APPNAME} completed."
|
||||
|
|
@ -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="Python"
|
||||
|
||||
# the version of this application
|
||||
VERSION="3.11.2"
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Variables and functions sourced from Environment:
|
||||
# ----------------------------------------------------------------------
|
||||
# assert_zero()
|
||||
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||
#
|
||||
# LOGS_ROOT
|
||||
# The parent directory where logs from this project will go.
|
||||
#
|
||||
# TEMP_STAGE_DIR
|
||||
# The parent directory of where source archives are extracted to.
|
||||
|
||||
# register mode selections
|
||||
ARGUMENT_LIST=(
|
||||
"stage"
|
||||
"build"
|
||||
"install"
|
||||
"all"
|
||||
"help"
|
||||
)
|
||||
|
||||
# modes to associate with switches
|
||||
# assumes you want nothing done unless you ask for it.
|
||||
MODE_STAGE=false
|
||||
MODE_BUILD=false
|
||||
MODE_INSTALL=false
|
||||
MODE_ALL=false
|
||||
MODE_HELP=false
|
||||
|
||||
# the file to log to
|
||||
LOGFILE="${APPNAME}.log"
|
||||
|
||||
# ISO 8601 variation
|
||||
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||
|
||||
# the path where the source will be located when complete
|
||||
# note: TEMP_STAGE_DIR is sourced from environment
|
||||
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||
|
||||
# read defined arguments
|
||||
opts=$(getopt \
|
||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||
--name "$APPNAME" \
|
||||
--options "" \
|
||||
-- "$@"
|
||||
)
|
||||
|
||||
# process supplied arguments into flags that enable execution modes
|
||||
eval set --$opts
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--stage)
|
||||
MODE_STAGE=true
|
||||
shift 1
|
||||
;;
|
||||
--build)
|
||||
MODE_BUILD=true
|
||||
shift 1
|
||||
;;
|
||||
--install)
|
||||
MODE_INSTALL=true
|
||||
shift 1
|
||||
;;
|
||||
--all)
|
||||
MODE_ALL=true
|
||||
shift 1
|
||||
;;
|
||||
--help)
|
||||
MODE_HELP=true
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# print to stdout, print to log
|
||||
logprint() {
|
||||
mkdir -p "${LOG_DIR}"
|
||||
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||
}
|
||||
|
||||
# Tell the user we're alive...
|
||||
logprint "Initializing the ${APPNAME} utility..."
|
||||
|
||||
# when the stage mode is enabled, this will execute
|
||||
mode_stage() {
|
||||
logprint "Starting stage of ${APPNAME}..."
|
||||
|
||||
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||
rm -Rf "${T_SOURCE_DIR}"*
|
||||
|
||||
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
# conditionally rename if it needs it
|
||||
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
|
||||
|
||||
logprint "Staging operation complete."
|
||||
}
|
||||
|
||||
# when the build_pass1 mode is enabled, this will execute
|
||||
mode_build() {
|
||||
|
||||
# patch, configure and build
|
||||
logprint "Starting build of ${APPNAME}..."
|
||||
|
||||
logprint "Entering stage dir."
|
||||
pushd "${T_SOURCE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
logprint "Configuring ${APPNAME}..."
|
||||
./configure --prefix=/usr --enable-shared --without-ensurepip
|
||||
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
|
||||
|
||||
# this assert may result in false positives?
|
||||
assert_zero $?
|
||||
|
||||
logprint "Partial install operation complete."
|
||||
}
|
||||
|
||||
|
||||
mode_help() {
|
||||
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --help ]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$MODE_ALL" = "true" ]; then
|
||||
MODE_STAGE=true
|
||||
MODE_BUILD=true
|
||||
MODE_INSTALL=true
|
||||
fi
|
||||
|
||||
# if no options were selected, then show help and exit
|
||||
if \
|
||||
[ "$MODE_HELP" != "true" ] && \
|
||||
[ "$MODE_STAGE" != "true" ] && \
|
||||
[ "$MODE_BUILD" != "true" ] && \
|
||||
[ "$MODE_INSTALL" != "true" ]
|
||||
then
|
||||
logprint "No option selected during execution."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
# if help was supplied at all, show help and exit
|
||||
if [ "$MODE_HELP" = "true" ]; then
|
||||
logprint "Help option selected. Printing options and exiting."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
if [ "$MODE_STAGE" = "true" ]; then
|
||||
logprint "Staging option selected."
|
||||
mode_stage
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_BUILD" = "true" ]; then
|
||||
logprint "Build of ${APPNAME} selected."
|
||||
mode_build
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_INSTALL" = "true" ]; then
|
||||
logprint "Install of ${APPNAME} selected."
|
||||
mode_install
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
logprint "Execution of ${APPNAME} completed."
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
#!/bin/bash
|
||||
# desc:
|
||||
# stages, builds, installs
|
||||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
# ----------------------------------------------------------------------
|
||||
# the name of this application
|
||||
APPNAME="texinfo"
|
||||
|
||||
# the version of this application
|
||||
VERSION="7.0.2"
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Variables and functions sourced from Environment:
|
||||
# ----------------------------------------------------------------------
|
||||
# assert_zero()
|
||||
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||
#
|
||||
# LOGS_ROOT
|
||||
# The parent directory where logs from this project will go.
|
||||
#
|
||||
# TEMP_STAGE_DIR
|
||||
# The parent directory of where source archives are extracted to.
|
||||
|
||||
# register mode selections
|
||||
ARGUMENT_LIST=(
|
||||
"stage"
|
||||
"build"
|
||||
"install"
|
||||
"all"
|
||||
"help"
|
||||
)
|
||||
|
||||
# modes to associate with switches
|
||||
# assumes you want nothing done unless you ask for it.
|
||||
MODE_STAGE=false
|
||||
MODE_BUILD=false
|
||||
MODE_INSTALL=false
|
||||
MODE_ALL=false
|
||||
MODE_HELP=false
|
||||
|
||||
# the file to log to
|
||||
LOGFILE="${APPNAME}.log"
|
||||
|
||||
# ISO 8601 variation
|
||||
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||
|
||||
# the path where the source will be located when complete
|
||||
# note: TEMP_STAGE_DIR is sourced from environment
|
||||
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||
|
||||
# read defined arguments
|
||||
opts=$(getopt \
|
||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||
--name "$APPNAME" \
|
||||
--options "" \
|
||||
-- "$@"
|
||||
)
|
||||
|
||||
# process supplied arguments into flags that enable execution modes
|
||||
eval set --$opts
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--stage)
|
||||
MODE_STAGE=true
|
||||
shift 1
|
||||
;;
|
||||
--build)
|
||||
MODE_BUILD=true
|
||||
shift 1
|
||||
;;
|
||||
--install)
|
||||
MODE_INSTALL=true
|
||||
shift 1
|
||||
;;
|
||||
--all)
|
||||
MODE_ALL=true
|
||||
shift 1
|
||||
;;
|
||||
--help)
|
||||
MODE_HELP=true
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# print to stdout, print to log
|
||||
logprint() {
|
||||
mkdir -p "${LOG_DIR}"
|
||||
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||
}
|
||||
|
||||
# Tell the user we're alive...
|
||||
logprint "Initializing the ${APPNAME} utility..."
|
||||
|
||||
# when the stage mode is enabled, this will execute
|
||||
mode_stage() {
|
||||
logprint "Starting stage of ${APPNAME}..."
|
||||
|
||||
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||
rm -Rf "${T_SOURCE_DIR}"*
|
||||
|
||||
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
# conditionally rename if it needs it
|
||||
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
|
||||
|
||||
logprint "Staging operation complete."
|
||||
}
|
||||
|
||||
# when the build_pass1 mode is enabled, this will execute
|
||||
mode_build() {
|
||||
|
||||
# patch, configure and build
|
||||
logprint "Starting build of ${APPNAME}..."
|
||||
|
||||
logprint "Entering stage 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 "Partial install operation complete."
|
||||
}
|
||||
|
||||
|
||||
mode_help() {
|
||||
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --help ]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$MODE_ALL" = "true" ]; then
|
||||
MODE_STAGE=true
|
||||
MODE_BUILD=true
|
||||
MODE_INSTALL=true
|
||||
fi
|
||||
|
||||
# if no options were selected, then show help and exit
|
||||
if \
|
||||
[ "$MODE_HELP" != "true" ] && \
|
||||
[ "$MODE_STAGE" != "true" ] && \
|
||||
[ "$MODE_BUILD" != "true" ] && \
|
||||
[ "$MODE_INSTALL" != "true" ]
|
||||
then
|
||||
logprint "No option selected during execution."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
# if help was supplied at all, show help and exit
|
||||
if [ "$MODE_HELP" = "true" ]; then
|
||||
logprint "Help option selected. Printing options and exiting."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
if [ "$MODE_STAGE" = "true" ]; then
|
||||
logprint "Staging option selected."
|
||||
mode_stage
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_BUILD" = "true" ]; then
|
||||
logprint "Build of ${APPNAME} selected."
|
||||
mode_build
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_INSTALL" = "true" ]; then
|
||||
logprint "Install of ${APPNAME} selected."
|
||||
mode_install
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
logprint "Execution of ${APPNAME} completed."
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
#!/bin/bash
|
||||
# desc:
|
||||
# stages, builds, installs
|
||||
|
||||
# make variables persist in subprocesses for logging function
|
||||
set -a
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Configuration:
|
||||
# ----------------------------------------------------------------------
|
||||
# the name of this application
|
||||
APPNAME="util-linux"
|
||||
|
||||
# the version of this application
|
||||
VERSION="2.38.1"
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Variables and functions sourced from Environment:
|
||||
# ----------------------------------------------------------------------
|
||||
# assert_zero()
|
||||
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||
#
|
||||
# LOGS_ROOT
|
||||
# The parent directory where logs from this project will go.
|
||||
#
|
||||
# TEMP_STAGE_DIR
|
||||
# The parent directory of where source archives are extracted to.
|
||||
|
||||
# register mode selections
|
||||
ARGUMENT_LIST=(
|
||||
"stage"
|
||||
"build"
|
||||
"install"
|
||||
"all"
|
||||
"help"
|
||||
)
|
||||
|
||||
# modes to associate with switches
|
||||
# assumes you want nothing done unless you ask for it.
|
||||
MODE_STAGE=false
|
||||
MODE_BUILD=false
|
||||
MODE_INSTALL=false
|
||||
MODE_ALL=false
|
||||
MODE_HELP=false
|
||||
|
||||
# the file to log to
|
||||
LOGFILE="${APPNAME}.log"
|
||||
|
||||
# ISO 8601 variation
|
||||
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||
|
||||
# the path where logs are written to
|
||||
# note: LOGS_ROOT is sourced from environment
|
||||
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||
|
||||
# the path where the source will be located when complete
|
||||
# note: TEMP_STAGE_DIR is sourced from environment
|
||||
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||
|
||||
# read defined arguments
|
||||
opts=$(getopt \
|
||||
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||
--name "$APPNAME" \
|
||||
--options "" \
|
||||
-- "$@"
|
||||
)
|
||||
|
||||
# process supplied arguments into flags that enable execution modes
|
||||
eval set --$opts
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--stage)
|
||||
MODE_STAGE=true
|
||||
shift 1
|
||||
;;
|
||||
--build)
|
||||
MODE_BUILD=true
|
||||
shift 1
|
||||
;;
|
||||
--install)
|
||||
MODE_INSTALL=true
|
||||
shift 1
|
||||
;;
|
||||
--all)
|
||||
MODE_ALL=true
|
||||
shift 1
|
||||
;;
|
||||
--help)
|
||||
MODE_HELP=true
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# print to stdout, print to log
|
||||
logprint() {
|
||||
mkdir -p "${LOG_DIR}"
|
||||
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||
}
|
||||
|
||||
# Tell the user we're alive...
|
||||
logprint "Initializing the ${APPNAME} utility..."
|
||||
|
||||
# when the stage mode is enabled, this will execute
|
||||
mode_stage() {
|
||||
logprint "Starting stage of ${APPNAME}..."
|
||||
|
||||
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||
rm -Rf "${T_SOURCE_DIR}"*
|
||||
|
||||
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
# conditionally rename if it needs it
|
||||
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
|
||||
|
||||
logprint "Staging operation complete."
|
||||
}
|
||||
|
||||
# when the build_pass1 mode is enabled, this will execute
|
||||
mode_build() {
|
||||
|
||||
# patch, configure and build
|
||||
logprint "Starting build of ${APPNAME}..."
|
||||
|
||||
logprint "Removing pre-staged getopt utility..."
|
||||
rm -f /usr/local/bin/getopt
|
||||
assert_zero $?
|
||||
|
||||
# silently fail, since it's already there from earlier
|
||||
mkdir -p /var/lib/hwclock
|
||||
assert_zero $?
|
||||
|
||||
logprint "Entering stage dir."
|
||||
pushd "${T_SOURCE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
logprint "Configuring ${APPNAME}..."
|
||||
./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
|
||||
--libdir==/usr/lib \
|
||||
--docdir=/usr/share/doc/util-linux-${VERSION} \
|
||||
--disable-chfn-chsh \
|
||||
--disable-login \
|
||||
--disable-nologin \
|
||||
--disable-su \
|
||||
--disable-setpriv \
|
||||
--disable-runuser \
|
||||
--disable-pylibmount \
|
||||
--disable-static \
|
||||
--without-python \
|
||||
runstatedir=/run
|
||||
assert_zero $?
|
||||
|
||||
logprint "Compiling..."
|
||||
make
|
||||
assert_zero $?
|
||||
|
||||
logprint "Build operation complete."
|
||||
}
|
||||
|
||||
mode_install() {
|
||||
logprint "Starting install of ${APPNAME}..."
|
||||
pushd "${T_SOURCE_DIR}"
|
||||
assert_zero $?
|
||||
|
||||
logprint "Installing..."
|
||||
make install
|
||||
assert_zero $?
|
||||
|
||||
logprint "Partial install operation complete."
|
||||
}
|
||||
|
||||
|
||||
mode_help() {
|
||||
echo "${APPNAME} [ --stage ] [ --build ] [ --install ] [ --all ] [ --help ]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$MODE_ALL" = "true" ]; then
|
||||
MODE_STAGE=true
|
||||
MODE_BUILD=true
|
||||
MODE_INSTALL=true
|
||||
fi
|
||||
|
||||
# if no options were selected, then show help and exit
|
||||
if \
|
||||
[ "$MODE_HELP" != "true" ] && \
|
||||
[ "$MODE_STAGE" != "true" ] && \
|
||||
[ "$MODE_BUILD" != "true" ] && \
|
||||
[ "$MODE_INSTALL" != "true" ]
|
||||
then
|
||||
logprint "No option selected during execution."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
# if help was supplied at all, show help and exit
|
||||
if [ "$MODE_HELP" = "true" ]; then
|
||||
logprint "Help option selected. Printing options and exiting."
|
||||
mode_help
|
||||
fi
|
||||
|
||||
if [ "$MODE_STAGE" = "true" ]; then
|
||||
logprint "Staging option selected."
|
||||
mode_stage
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_BUILD" = "true" ]; then
|
||||
logprint "Build of ${APPNAME} selected."
|
||||
mode_build
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
if [ "$MODE_INSTALL" = "true" ]; then
|
||||
logprint "Install of ${APPNAME} selected."
|
||||
mode_install
|
||||
assert_zero $?
|
||||
fi
|
||||
|
||||
logprint "Execution of ${APPNAME} completed."
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
#!/bin/bash
|
||||
# move this to the makefile as a dedicated target
|
||||
|
||||
APPNAME="Offer Backup"
|
||||
|
||||
# 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}"
|
||||
}
|
||||
|
||||
logprint "Giving the user the option of backing up before proceeding."
|
||||
|
||||
is_mounted() {
|
||||
findmnt $1 &> /dev/null
|
||||
if [ $? != 0 ]; then
|
||||
logprint "Not mounted...skipping."
|
||||
/usr/bin/false
|
||||
else
|
||||
logprint "Mounted..."
|
||||
/usr/bin/true
|
||||
fi
|
||||
}
|
||||
|
||||
function disarm_chroot() {
|
||||
logprint "Unmounting CHROOT VFKS mounts"
|
||||
|
||||
logprint "Unmounting ${T_SYSROOT}/dev"
|
||||
is_mounted ${T_SYSROOT}/dev && umount -l ${T_SYSROOT}/dev
|
||||
|
||||
logprint "Unmounting ${T_SYSROOT}/dev/pts"
|
||||
is_mounted ${T_SYSROOT}/dev/pts && umount -l ${T_SYSROOT}/dev/pts
|
||||
|
||||
logprint "Unmounting ${T_SYSROOT}/proc"
|
||||
is_mounted ${T_SYSROOT}/proc && umount -l ${T_SYSROOT}/proc
|
||||
|
||||
# not a symlink on ubuntu
|
||||
logprint "Unmounting ${T_SYSROOT}/dev/shm"
|
||||
is_mounted ${T_SYSROOT}/dev/shm && umount -l ${T_SYSROOT}/dev/shm
|
||||
|
||||
logprint "Unmounting pyrois inside of chroot"
|
||||
is_mounted ${T_SYSROOT}/rex_embedded && umount -l ${T_SYSROOT}/rex_embedded
|
||||
}
|
||||
|
||||
function perform_backup() {
|
||||
logprint "Entering backup routine."
|
||||
disarm_chroot
|
||||
disarm_chroot
|
||||
logprint "Performing backup...This will take a long time..."
|
||||
tar czfp ${project_root}/${TIMESTAMP}.backup.tgz ${dir_stage}
|
||||
assert_zero $?
|
||||
logprint "Backup completed successfully. Moving on."
|
||||
logprint "Entering project root."
|
||||
pushd ${project_root}
|
||||
assert_zero $?
|
||||
logprint "Re-arming chroot..."
|
||||
make arm_chroot
|
||||
echo
|
||||
logprint "You may now proceed to run 'make build_stage4'."
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
read -r -d '' msg <<-'EOF'
|
||||
This is a great stopping point for backing up the stage if you're
|
||||
debugging. The following prompt will ask if you'd like to back up the
|
||||
existing sysroot, in case you need to start from stage 4 again for
|
||||
whatever reason, such as a build failure.
|
||||
|
||||
If you select yes, you will see a gzipped tarball containing the
|
||||
sysroot generated in your project root. If you select no, your backup
|
||||
will not be created, and you'll move on to stage 4.
|
||||
|
||||
If you skip the backup and something fails from here, you'll need to
|
||||
run "make clean" and start from the beginning.
|
||||
|
||||
If you do decide to back up, which you should, should you need to
|
||||
restore from your backup, simply running "make restore" will perform
|
||||
the operations necessary.
|
||||
EOF
|
||||
|
||||
read -r -d '' yn_msg <<-'EOF'
|
||||
Do you want to back up the stage?
|
||||
|
||||
If you select yes, the VKFS mounts for the chroot will be unmounted temporarily to perform this operation.
|
||||
EOF
|
||||
|
||||
# Use the dialog utility to display information to the user
|
||||
dialog --backtitle "Dark Horse Linux: Pyrois" --title "IMPORTANT NOTICE" --msgbox "$msg" 20 78
|
||||
|
||||
# Use the dialog utility to prompt the user with a yes/no question
|
||||
dialog --backtitle "Dark Horse Linux: Pyrois" --title "Back up the stage?" --yesno "$yn_msg" 10 60
|
||||
response=$?
|
||||
|
||||
if [ $response -eq 0 ]; then
|
||||
logprint "User selected to perform backups."
|
||||
perform_backup
|
||||
else
|
||||
logprint "User selected to skip backups. Moving on."
|
||||
exit 0
|
||||
fi
|
|
@ -5,6 +5,51 @@
|
|||
"name": "welcome 3",
|
||||
"dependencies": [ null ],
|
||||
"comment": "greet the user"
|
||||
},
|
||||
{
|
||||
"name": "creating system directory structure",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.5"
|
||||
},
|
||||
{
|
||||
"name": "creating essential files and symlinks",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.6"
|
||||
},
|
||||
{
|
||||
"name": "gettext",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.7"
|
||||
},
|
||||
{
|
||||
"name": "bison",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.8"
|
||||
},
|
||||
{
|
||||
"name": "perl",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.9"
|
||||
},
|
||||
{
|
||||
"name": "python",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.10"
|
||||
},
|
||||
{
|
||||
"name": "texinfo",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.11"
|
||||
},
|
||||
{
|
||||
"name": "util-linux",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.12"
|
||||
},
|
||||
{
|
||||
"name": "cleaning up the temp system",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.13"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plan":
|
||||
[
|
||||
{
|
||||
"name": "offer backup",
|
||||
"dependencies": [ null ],
|
||||
"comment": "LFS 11.3-systemd-rc1 Ch. 7.13.2"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -17,6 +17,168 @@
|
|||
"group": "root",
|
||||
"supply_environment": true,
|
||||
"environment": "environments/stage3.env.bash"
|
||||
},
|
||||
{
|
||||
"name": "creating system directory structure",
|
||||
"target": "components/stage3/create_system_dir_structure.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/stage3.env.bash"
|
||||
},
|
||||
{
|
||||
"name": "creating essential files and symlinks",
|
||||
"target": "components/stage3/create_essential_files_links.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/stage3.env.bash"
|
||||
},
|
||||
{
|
||||
"name": "gettext",
|
||||
"target": "components/stage3/gettext.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": "root",
|
||||
"group": "root",
|
||||
"supply_environment": true,
|
||||
"environment": "environments/stage3.env.bash"
|
||||
},
|
||||
{
|
||||
"name": "bison",
|
||||
"target": "components/stage3/bison.bash --all",
|
||||
"is_shell_command": true,
|
||||
"shell_definition": "bash",
|
||||
"force_pty": true,
|
||||
"set_working_directory": false,
|
||||
"working_directory": "",
|
||||
"rectify": false,
|
||||
"rectifier": "",
|
||||
"active": true,
|
||||
"required": true,
|
||||
"set_user_context": true,
|
||||
"user": "root",
|
||||
"group": "root",
|
||||
"supply_environment": true,
|
||||
"environment": "environments/stage3.env.bash"
|
||||
},
|
||||
{
|
||||
"name": "perl",
|
||||
"target": "components/stage3/perl.bash --all",
|
||||
"is_shell_command": true,
|
||||
"shell_definition": "bash",
|
||||
"force_pty": true,
|
||||
"set_working_directory": false,
|
||||
"working_directory": "",
|
||||
"rectify": false,
|
||||
"rectifier": "",
|
||||
"active": true,
|
||||
"required": true,
|
||||
"set_user_context": true,
|
||||
"user": "root",
|
||||
"group": "root",
|
||||
"supply_environment": true,
|
||||
"environment": "environments/stage3.env.bash"
|
||||
},
|
||||
{
|
||||
"name": "python",
|
||||
"target": "components/stage3/python.bash --all",
|
||||
"is_shell_command": true,
|
||||
"shell_definition": "bash",
|
||||
"force_pty": true,
|
||||
"set_working_directory": false,
|
||||
"working_directory": "",
|
||||
"rectify": false,
|
||||
"rectifier": "",
|
||||
"active": true,
|
||||
"required": true,
|
||||
"set_user_context": true,
|
||||
"user": "root",
|
||||
"group": "root",
|
||||
"supply_environment": true,
|
||||
"environment": "environments/stage3.env.bash"
|
||||
},
|
||||
{
|
||||
"name": "texinfo",
|
||||
"target": "components/stage3/texinfo.bash --all",
|
||||
"is_shell_command": true,
|
||||
"shell_definition": "bash",
|
||||
"force_pty": true,
|
||||
"set_working_directory": false,
|
||||
"working_directory": "",
|
||||
"rectify": false,
|
||||
"rectifier": "",
|
||||
"active": true,
|
||||
"required": true,
|
||||
"set_user_context": true,
|
||||
"user": "root",
|
||||
"group": "root",
|
||||
"supply_environment": true,
|
||||
"environment": "environments/stage3.env.bash"
|
||||
},
|
||||
{
|
||||
"name": "util-linux",
|
||||
"target": "components/stage3/util-linux.bash --all",
|
||||
"is_shell_command": true,
|
||||
"shell_definition": "bash",
|
||||
"force_pty": true,
|
||||
"set_working_directory": false,
|
||||
"working_directory": "",
|
||||
"rectify": false,
|
||||
"rectifier": "",
|
||||
"active": true,
|
||||
"required": true,
|
||||
"set_user_context": true,
|
||||
"user": "root",
|
||||
"group": "root",
|
||||
"supply_environment": true,
|
||||
"environment": "environments/stage3.env.bash"
|
||||
},
|
||||
{
|
||||
"name": "cleaning up the temp system",
|
||||
"target": "components/stage3/clean-temp.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/stage3.env.bash"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"units": [
|
||||
{
|
||||
"name": "offer backup",
|
||||
"target": "components/stage4backup/offer_backup.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"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue