diff --git a/.gitignore b/.gitignore index 80170d9..9a55da2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ stage logs +*.tgz diff --git a/Makefile b/Makefile index de0e82a..9ce3e32 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,9 @@ build_stage4: set -e sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/build_stage4.sh" +master: + set -e + sudo /usr/bin/env -i bash -c ". ./project_config.sh && ${dir_make}/master.sh" # example: # make dirs diff --git a/make.project/backup_create.sh b/make.project/backup_create.sh index ede025b..dd5bb11 100755 --- a/make.project/backup_create.sh +++ b/make.project/backup_create.sh @@ -13,7 +13,7 @@ echo "Bootstrapping from MAKE to REX..." ${dir_localtools}/rex -v \ -c ${dir_rex}/x86_64/rex.config \ - -p ${dir_rex}/x86_64/plans/stage4backup.plan + -p ${dir_rex}/x86_64/plans/backup.plan retVal=$? exit $retVal diff --git a/make.project/master.sh b/make.project/master.sh new file mode 100755 index 0000000..540d31c --- /dev/null +++ b/make.project/master.sh @@ -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/master.plan + +retVal=$? +echo "Rex exited with error code '$retVal'." +exit $retVal diff --git a/rex.project/x86_64/components/stage4backup/offer_backup.bash b/rex.project/x86_64/components/backup/offer_backup.bash similarity index 100% rename from rex.project/x86_64/components/stage4backup/offer_backup.bash rename to rex.project/x86_64/components/backup/offer_backup.bash diff --git a/rex.project/x86_64/components/master/welcome.bash b/rex.project/x86_64/components/master/welcome.bash new file mode 100755 index 0000000..e00487e --- /dev/null +++ b/rex.project/x86_64/components/master/welcome.bash @@ -0,0 +1,48 @@ +HORSE=$(cat <<'EOH' +⠀⠀⠀⠀⠀⠀⢀⠀⠀⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠘⣦⡀⠘⣆⠈⠛⠻⣗⠶⣶⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠈⣿⠀⠈⠳⠄⠀⠈⠙⠶⣍⡻⢿⣷⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⣰⣿⣧⠀⠀⠀⠀⠀⠀⠀⠈⠻⣮⡹⣿⣿⣷⣦⣄⣀⠀⠀⢀⣸⠃⠀⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⢠⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣮⢿⣿⣿⣿⣿⣿⣿⣿⠟⠀⢰⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⢀⣾⣿⠀⠀⠀⠀⠀⠀⠀⣷⠀⢷⠀⠀⠀⠙⢷⣿⣿⣿⣿⣟⣋⣀⣤⣴⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⢀⣼⢿⣿⡀⠀⠀⢀⣀⣴⣾⡟⠀⠈⣇⠀⠀⠀⠈⢻⡙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⣼⡏⠸⣿⣿⣶⣾⣿⡿⠟⠋⠀⠀⠀⢹⡆⠀⠀⠀⠀⠹⡽⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⣰⣿⠀⠀⠀⣀⡿⠛⠉⠀⠀⢿⠀⠀⠀⠘⣿⡄⠀⠀⠀⠀⠑⢹⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⣿⣿⣷⣶⣾⠏⠀⠀⠀⠀⠀⠘⣇⠀⠀⠀⢻⡇⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⡿⠃⠀⣠⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠈⠙⠿⠿⠋⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⢸⣷⠀⠀⠀⠀⠀⢀⠀⠹⣿⣿⣿⣿⣷⣶⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠀⠀⠀⢸⣿⠀⠀⠀⠀⢀⡞⠀⠀⠈⠛⠻⠿⠿⠯⠥⠤⢄⣀⣀⢀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠀⠀⠀⢸⡇⠀⠀⠀⢀⡼⠃⠀⠀⠀⠀⠀⣄⠀⠀⠀⠀⠀⠀⠈⠙⠂⠙⠳⢤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠇⠀⠀⠀⡾⠁⠀⠀⣠⡿⠃⠀⠀⠀⠀⠀⠀⠸⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠀⠀⠀⡸⠃⠀⢀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣷⣶⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⠇⠀⠀⠀⠃⢀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠏⠀⠀⠀⠀⣰⡟⠁⠀⠀⠀ ⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣧⠙⠻⣿⣿⣿⣿⣿⣿⣦⡀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⢀⡖⢰⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠟⠀⠀⠀⢸⣿⠀⠀⠈⢿⣿⣿⣿⣿⣿⡿ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡇⠀⠀⣼⠁⠼⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⣼⡇⠀⠀⣠⣾⣿⣿⣿⣿⠟⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠘⣇⠀⠀⢻⡄⢠⡄⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⡴⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠟⠁⠀⠀⠀⢀⣼⠏⠀⣠⣾⣿⣿⡿⣿⡿⠁⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⠁⠀⠘⠂⠀⠀⢳⠀⢳⡀⠀⠀⠀⠀⠀⠀⢀⡼⠁⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣾⣿⠃⠀⠀⠀⠀⣠⣾⠃⣠⣾⣿⣿⠿⠋⢰⡟⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⢠⣿⠃⠀⠀⠀⢀⣀⡴⠞⠙⠲⣷⡄⠀⠀⠀⠀⢠⡾⠁⠀⠀⠀⢀⣀⣠⣤⣶⠿⠟⠋⠀⡾⠀⠀⠀⢀⣴⠟⠁⢠⡟⢱⡿⠃⠀⠀⠸⣇⡀⠀⠀⠀ +⠀⠀⠀⠀⠀⢀⡴⠟⠁⠀⣀⡤⠖⠋⠁⠀⠀⠀⠀⣸⠇⠀⠀⠀⣤⠟⠑⠋⠉⣿⠋⠉⠉⠉⠁⣠⠞⠀⠀⠀⡇⠀⠀⢠⡿⠋⠀⠀⠈⠁⡿⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀ +⠀⠀⠀⢀⣾⣏⣤⣶⡾⠛⠉⠀⠀⠀⠀⠀⠀⢀⡼⠃⠀⠀⣠⠞⠁⠀⠀⠀⠀⣿⠀⠀⠀⢀⡼⠃⠀⠀⠀⢸⠇⠀⣰⠟⠀⠀⠀⠀⠀⠐⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⢀⣿⣿⡿⠛⠁⠀⠀⠀⠀⠀⠀⠀⢀⣴⠏⠀⠀⣠⠞⠁⠀⠀⠀⠀⠀⠀⣿⠀⠀⢀⡾⠃⠀⠀⠀⢀⡞⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⣼⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⣶⣶⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⣾⠇⠀⠀⠀⢀⣾⣣⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⢠⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠀⢠⡟⠀⠀⠀⢀⣾⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⡄⢀⣀⡀⠀⠀⠀⠀⠀⠀⢸⡇⠀⣾⠇⠀⠀⣰⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢸⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⣾⠀⣰⠟⠀⢀⣼⣿⣿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢸⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠿⠿⠿⠿⠃⠀⠀⠀⢸⣿⣶⠏⢀⣴⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢸⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⠃⢠⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⢿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⢃⣴⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠈⠛⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣧⣾⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⡟⢸⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⠁⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠿⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +EOH +) + +echo +echo +echo -e "\e[31m$HORSE\e[0m" +echo +echo "Welcome to Pyrois, the build system for Dark Horse Linux." +echo +echo "MASTER" +echo diff --git a/rex.project/x86_64/components/stage4/file.bash b/rex.project/x86_64/components/stage4/file.bash old mode 100644 new mode 100755 index b73d463..8c8c749 --- a/rex.project/x86_64/components/stage4/file.bash +++ b/rex.project/x86_64/components/stage4/file.bash @@ -12,7 +12,7 @@ set -a APPNAME="file" # the version of this application -VERSION="5.39" +VERSION="5.44" # ---------------------------------------------------------------------- # Variables and functions sourced from Environment: @@ -29,18 +29,18 @@ VERSION="5.39" # register mode selections ARGUMENT_LIST=( "stage" - "build_temp" - "install_temp" - "all_temp" + "build" + "install" + "all" "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_BUILD=false +MODE_INSTALL=false +MODE_ALL=false MODE_HELP=false # the file to log to @@ -73,16 +73,16 @@ while [[ $# -gt 0 ]]; do MODE_STAGE=true shift 1 ;; - --build_temp) - MODE_BUILD_TEMP=true + --build) + MODE_BUILD=true shift 1 ;; - --install_temp) - MODE_INSTALL_TEMP=true + --install) + MODE_INSTALL=true shift 1 ;; - --all_temp) - MODE_ALL_TEMP=true + --all) + MODE_ALL=true shift 1 ;; --help) @@ -123,7 +123,7 @@ mode_stage() { } # when the build_pass1 mode is enabled, this will execute -mode_build_temp() { +mode_build() { # patch, configure and build logprint "Starting build of ${APPNAME}..." @@ -131,41 +131,29 @@ mode_build_temp() { 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) + + ./configure --prefix=/usr assert_zero $? logprint "Compiling..." - make FILE_COMPILE=$(pwd)/build/src/file + make + assert_zero $? + + + logprint "Checks..." + make check assert_zero $? logprint "Build operation complete." } -mode_install_temp() { +mode_install() { logprint "Starting install of ${APPNAME}..." - pushd "${T_SOURCE_DIR}/build" + pushd "${T_SOURCE_DIR}" assert_zero $? logprint "Installing..." - make DESTDIR=${T_SYSROOT} install + make install assert_zero $? logprint "Install operation complete." @@ -177,18 +165,18 @@ mode_help() { exit 1 } -if [ "$MODE_ALL_TEMP" = "true" ]; then +if [ "$MODE_ALL" = "true" ]; then MODE_STAGE=true - MODE_BUILD_TEMP=true - MODE_INSTALL_TEMP=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_TEMP" != "true" ] && \ - [ "$MODE_INSTALL_TEMP" != "true" ] + [ "$MODE_BUILD" != "true" ] && \ + [ "$MODE_INSTALL" != "true" ] then logprint "No option selected during execution." mode_help @@ -206,17 +194,16 @@ if [ "$MODE_STAGE" = "true" ]; then assert_zero $? fi -if [ "$MODE_BUILD_TEMP" = "true" ]; then +if [ "$MODE_BUILD" = "true" ]; then logprint "Build of ${APPNAME} selected." - mode_build_temp + mode_build assert_zero $? fi -if [ "$MODE_INSTALL_TEMP" = "true" ]; then +if [ "$MODE_INSTALL" = "true" ]; then logprint "Install of ${APPNAME} selected." - mode_install_temp + mode_install assert_zero $? fi logprint "Execution of ${APPNAME} completed." - diff --git a/rex.project/x86_64/components/stage4/m4.bash b/rex.project/x86_64/components/stage4/m4.bash new file mode 100755 index 0000000..fae5091 --- /dev/null +++ b/rex.project/x86_64/components/stage4/m4.bash @@ -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="m4" + +# the version of this application +VERSION="1.4.19" + +# ---------------------------------------------------------------------- +# 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 "Checking" + make check + logprint "Checks exited with '$?'. " + + logprint "Build operation complete." +} + +mode_install() { + logprint "Starting install of ${APPNAME}..." + pushd "${T_SOURCE_DIR}" + assert_zero $? + + logprint "Installing..." + make install + assert_zero $? + + logprint "Install operation complete." +} + + +mode_help() { + echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]" + exit 0 +} + +if [ "$MODE_ALL" = "true" ]; then + MODE_STAGE=true + MODE_BUILD=true + MODE_INSTALL=true +fi + +# if no options were selected, then show help and exit +if \ + [ "$MODE_HELP" != "true" ] && \ + [ "$MODE_STAGE" != "true" ] && \ + [ "$MODE_BUILD" != "true" ] && \ + [ "$MODE_INSTALL" != "true" ] +then + logprint "No option selected during execution." + mode_help +fi + +# if help was supplied at all, show help and exit +if [ "$MODE_HELP" = "true" ]; then + logprint "Help option selected. Printing options and exiting." + mode_help +fi + +if [ "$MODE_STAGE" = "true" ]; then + logprint "Staging option selected." + mode_stage + assert_zero $? +fi + +if [ "$MODE_BUILD" = "true" ]; then + logprint "Build of ${APPNAME} selected." + mode_build + assert_zero $? +fi + +if [ "$MODE_INSTALL" = "true" ]; then + logprint "Install of ${APPNAME} selected." + mode_install + assert_zero $? +fi + +logprint "Execution of ${APPNAME} completed." diff --git a/rex.project/x86_64/components/stage4/readline.bash b/rex.project/x86_64/components/stage4/readline.bash old mode 100644 new mode 100755 index 078184e..d4ee2d8 --- a/rex.project/x86_64/components/stage4/readline.bash +++ b/rex.project/x86_64/components/stage4/readline.bash @@ -12,7 +12,7 @@ set -a APPNAME="readline" # the version of this application -VERSION="8.1" +VERSION="8.2" # ---------------------------------------------------------------------- # Variables and functions sourced from Environment: @@ -131,9 +131,19 @@ mode_build() { logprint "Entering stage dir." pushd "${T_SOURCE_DIR}" assert_zero $? - + + logprint "Applying patches..." - patch -Np1 -i ${PATCHES_DIR}/readline-8.1-ldconfig_fix.patch + + # TODO convert these to patches + sed -i '/MV.*old/d' Makefile.in + assert_zero $? + + # TODO convert these to patches + sed -i '/{OLDSUFF}/c:' support/shlib-install + assert_zero $? + + patch -Np1 -i ${PATCHES_DIR}/readline-${VERSION}-upstream_fix-1.patch assert_zero $? logprint "Configuring ${APPNAME}" @@ -141,17 +151,15 @@ mode_build() { --prefix=/usr \ --disable-static \ --with-curses \ - --docdir=/usr/share/doc/readline-8.1 + --docdir=/usr/share/doc/readline-${VERSION} assert_zero $? logprint "Compiling..." + make SHLIB_LIBS="-lncursesw" assert_zero $? - logprint "Checking ${APPNAME}" - make check - logprint "Build operation complete." } @@ -164,18 +172,8 @@ mode_install() { make SHLIB_LIBS="-lncursesw" install assert_zero $? - logprint "Cleaning up..." - mv -v /usr/lib/lib{readline,history}.so.* /lib - assert_zero $? - - ln -sfv ../../lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.so - assert_zero $? - - ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so - assert_zero $? - logprint "Installing documentation..." - install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.1 + install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-${VERSION} assert_zero $? logprint "Install operation complete." diff --git a/rex.project/x86_64/components/stage4/zstd.bash b/rex.project/x86_64/components/stage4/zstd.bash old mode 100644 new mode 100755 index f80ecec..866f397 --- a/rex.project/x86_64/components/stage4/zstd.bash +++ b/rex.project/x86_64/components/stage4/zstd.bash @@ -12,7 +12,7 @@ set -a APPNAME="zstd" # the version of this application -VERSION="1.4.8" +VERSION="1.5.4" # ---------------------------------------------------------------------- # Variables and functions sourced from Environment: @@ -134,7 +134,7 @@ mode_build() { logprint "Compiling..." - make + make prefix=/usr assert_zero $? logprint "Checking ${APPNAME}" @@ -153,11 +153,7 @@ mode_install() { assert_zero $? logprint "Cleaning up..." - mv -v /usr/lib/libzstd.so.* /lib - assert_zero $? - - # what a weird practice... - ln -sfv ../../lib/$(readlink /usr/liblibzstd.so) /usr/lib/libzstd.so + rm -v /usr/lib/libzstd.a assert_zero $? logprint "Install operation complete." diff --git a/rex.project/x86_64/plans/stage4backup.plan b/rex.project/x86_64/plans/backup.plan similarity index 100% rename from rex.project/x86_64/plans/stage4backup.plan rename to rex.project/x86_64/plans/backup.plan diff --git a/rex.project/x86_64/plans/master.plan b/rex.project/x86_64/plans/master.plan new file mode 100644 index 0000000..e267ac9 --- /dev/null +++ b/rex.project/x86_64/plans/master.plan @@ -0,0 +1,10 @@ +{ + "plan": + [ + { + "name": "welcome master", + "dependencies": [ null ], + "comment": "greet the user" + } + ] +} diff --git a/rex.project/x86_64/plans/stage4.plan b/rex.project/x86_64/plans/stage4.plan index 13eaef6..763be7c 100644 --- a/rex.project/x86_64/plans/stage4.plan +++ b/rex.project/x86_64/plans/stage4.plan @@ -35,6 +35,26 @@ "name": "xz", "dependencies": [ null ], "comment": "LFS 11.3-systemd-rc1 Ch. 8.8" + }, + { + "name": "zstd", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 8.9" + }, + { + "name": "file final", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 8.10" + }, + { + "name": "readline final", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 8.11" + }, + { + "name": "m4 final", + "dependencies": [ null ], + "comment": "LFS 11.3-systemd-rc1 Ch. 8.12" } ] } diff --git a/rex.project/x86_64/units/stage4backup.units b/rex.project/x86_64/units/backup.units similarity index 88% rename from rex.project/x86_64/units/stage4backup.units rename to rex.project/x86_64/units/backup.units index c58f237..b3b5f9e 100644 --- a/rex.project/x86_64/units/stage4backup.units +++ b/rex.project/x86_64/units/backup.units @@ -2,7 +2,7 @@ "units": [ { "name": "offer backup", - "target": "components/stage4backup/offer_backup.bash", + "target": "components/backup/offer_backup.bash", "is_shell_command": true, "shell_definition": "bash", "force_pty": true, diff --git a/rex.project/x86_64/units/master.units b/rex.project/x86_64/units/master.units new file mode 100644 index 0000000..897884b --- /dev/null +++ b/rex.project/x86_64/units/master.units @@ -0,0 +1,22 @@ +{ + "units": [ + { + "name": "welcome master", + "target": "components/master/welcome.bash", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" + } + ] +} diff --git a/rex.project/x86_64/units/stage4.units b/rex.project/x86_64/units/stage4.units index 81745ff..7160978 100644 --- a/rex.project/x86_64/units/stage4.units +++ b/rex.project/x86_64/units/stage4.units @@ -125,6 +125,78 @@ "group": "root", "supply_environment": true, "environment": "environments/stage4.env.bash" + }, + { + "name": "zstd", + "target": "components/stage4/zstd.bash --all", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" + }, + { + "name": "file final", + "target": "components/stage4/file.bash --all", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" + }, + { + "name": "readline final", + "target": "components/stage4/readline.bash --all", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" + }, + { + "name": "m4 final", + "target": "components/stage4/m4.bash --all", + "is_shell_command": true, + "shell_definition": "bash", + "force_pty": true, + "set_working_directory": false, + "working_directory": "", + "rectify": false, + "rectifier": "", + "active": true, + "required": true, + "set_user_context": true, + "user": "root", + "group": "root", + "supply_environment": true, + "environment": "environments/stage4.env.bash" } ] }